Cogs.Core
RenderTargetsGLES30.h
1#pragma once
2
3#include "../IRenderTargets.h"
4
5#include "CommonGLES30.h"
6
7namespace Cogs
8{
9 struct TexturesGLES30;
10 struct CapabilitiesGLES30;
11
12 namespace OpenGLES30
13 {
14 const static size_t kMaxRenderTargets = 8;
15 }
16
18 {
19 uint8_t samples;
20 uint8_t baseIndex : 4;
21 uint8_t count : 4;
22 };
23
25 {
26 uint8_t basicType : 2; // 0 -> undefined, 1->float, 2->uint, 3->int
27 };
28
30 {
31 RenderTargetViewDescription views[OpenGLES30::kMaxRenderTargets] = {};
32 GLuint fbo = 0;
33 RenderTargetViewDataGLES30 viewData[OpenGLES30::kMaxRenderTargets] = {};
34 MultiViewGLES30 multiView;
35 uint8_t numViews : 7;
36 uint8_t broken : 1;
37 };
38
40 {
43 GLuint renderBuffer = 0;
44 GLuint fbo = 0;
45 MultiViewGLES30 multiView;
46 uint8_t broken : 1;
47 };
48
49
51 {
52 void initialize(CapabilitiesGLES30* caps, TexturesGLES30 * textures) {
53 this->caps = caps;
54 this->textures = textures;
55 };
56
57 void releaseRenderTarget(RenderTargetHandle renderTargetHandle) override;
58
60 DepthStencilHandle createDepthStencilTarget(const RenderTargetHandle handle, const TextureHandle textureHandle) override;
61 void releaseDepthStencilTarget(DepthStencilHandle depthStencilHandle) override;
62
63 DepthStencilStateHandle loadDepthStencilState(const DepthStencilState & depthStencilState) override;
65
66 RasterizerStateHandle loadRasterizerState(const RasterizerState & rasterizerState) override;
68
69 BlendStateHandle loadBlendState(const BlendState & blendState) override;
70 BlendStateHandle loadBlendState(const BlendState& blendStateColor, const BlendState& blendStateAlpha) override;
71 void releaseBlendState(BlendStateHandle handle) override;
72
73 void releaseResources() override;
74
75 // Internal API
76
77 bool bindRenderTargets(RenderTargetHandle renderTargetHandle, DepthStencilHandle depthStencilHandle);
78
82
85
86 // Inherited via IRenderTargets
87 virtual RenderTargetHandle createRenderTarget(const RenderTargetViewDescription * renderTargetViews, const size_t numViews) override;
88 virtual DepthStencilHandle createDepthStencilTarget(const RenderTargetHandle handle, const DepthStencilViewDescription & depthStencilView) override;
89 virtual RenderTargetHandle createRenderTarget(const RenderTargetViewDescription* renderTargetViews, const size_t numViews, const MultiViewDescription& multiView) override;
90 virtual DepthStencilHandle createDepthStencilTarget(const RenderTargetHandle handle, const DepthStencilViewDescription& depthStencilView, const MultiViewDescription& multiView) override;
91
92 private:
93 TexturesGLES30* textures = nullptr;
94 CapabilitiesGLES30* caps = nullptr;
95 };
96}
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
@ OpenGLES30
Graphics device using the OpenGLES 3.0 API.
Encapsulates blend state for the graphics pipeline in a state object.
Definition: BlendState.h:9
Encapsulates state for depth buffer usage and stencil buffer usage in a state object.
Describes a single depth stencil view and which resources to use from the underlying texture.
static const Handle_t NoHandle
Represents a handle to nothing.
Definition: Common.h:77
Provides render target management functionality.
Describes multiview framebuffer layout.
Encapsulates state for primitive rasterization in a state object.
Describes a single render target view and which resources to use from the underlying texture.
BlendStateHandle loadBlendState(const BlendState &blendState) override
Load a blend state object.
virtual RenderTargetHandle createRenderTarget(const RenderTargetViewDescription *renderTargetViews, const size_t numViews) override
Create a render target using the given view descriptions.
RasterizerStateHandle loadRasterizerState(const RasterizerState &rasterizerState) override
Load a rasterizer state object.
void releaseDepthStencilTarget(DepthStencilHandle depthStencilHandle) override
Release the depth target with the given depthStencilHandle.
DepthStencilStateHandle loadDepthStencilState(const DepthStencilState &depthStencilState) override
Load a depth stencil state object.
void releaseRasterizerState(RasterizerStateHandle handle) override
Release the rasterizer state with the given handle.
void releaseRenderTarget(RenderTargetHandle renderTargetHandle) override
Release the render target with the given renderTargetHandle.
DepthStencilHandle createDepthStencilTarget(const RenderTargetHandle handle) override
Creates a depth/stencil target to back the render target with the given handle.
void releaseBlendState(BlendStateHandle handle) override
Release the blend state with the given handle.
void releaseDepthStencilState(DepthStencilStateHandle handle) override
Release the depth stencil state with the given handle.
void releaseResources() override
Release all allocated render target resources.