Cogs.Core
RenderTargetsGL20.h
1#pragma once
2
3#include "../IRenderTargets.h"
4
5#include "CommonGL20.h"
6
7namespace Cogs
8{
9 struct TexturesGL20;
10
11 namespace OpenGL20
12 {
13 const static size_t kMaxRenderTargets = 8;
14 }
15
17 {
18 TextureHandle textures[OpenGL20::kMaxRenderTargets];
19 size_t numTextures;
20 GLuint frameBuffer;
21 };
22
24 {
25 TextureHandle texture;
26 RenderTargetHandle renderTarget;
27 bool renderBuffer;
28 GLuint depthBuffer;
29 };
30
32 {
33 BlendState color;
34 BlendState alpha;
35 };
36
38 {
39 void initialize(TexturesGL20 * textures) {
40 this->textures = textures;
41 };
42
44
45 // Public API
46
47 RenderTargetHandle createRenderTarget(const RenderTargetViewDescription * renderTargetViews, const size_t numViews) override;
48 void releaseRenderTarget(RenderTargetHandle renderTargetHandle) override;
49
51 DepthStencilHandle createDepthStencilTarget(const RenderTargetHandle handle, const TextureHandle textureHandle) override;
53 void releaseDepthStencilTarget(DepthStencilHandle depthStencilHandle) override;
54
55 DepthStencilStateHandle loadDepthStencilState(const DepthStencilState & depthStencilState) override;
57
58 RasterizerStateHandle loadRasterizerState(const RasterizerState & rasterizerState) override;
60
61 BlendStateHandle loadBlendState(const BlendState& blendState) override;
62 BlendStateHandle loadBlendState(const BlendState& blendStateColor, const BlendState& blendStateAlpha) override;
63 void releaseBlendState(BlendStateHandle handle) override;
64
65 void releaseResources() override;
66
67 void annotate(RenderTargetHandle handle, const StringView& name) override;
68 void annotate(DepthStencilHandle handle, const StringView& name) override;
69
73
76
77 TexturesGL20 * textures;
78 };
79}
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:24
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
@ OpenGL20
Graphics device using OpenGL, supporting at least OpenGL 2.0.
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.
Provides render target management functionality.
Encapsulates state for primitive rasterization in a state object.
Describes a single render target view and which resources to use from the underlying texture.
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.
void releaseResources() override
Release all allocated render target resources.
void releaseBlendState(BlendStateHandle handle) override
Release the blend state with the given handle.
void releaseDepthStencilTarget(DepthStencilHandle depthStencilHandle) override
Release the depth target with the given depthStencilHandle.
RenderTargetHandle createRenderTarget(const RenderTargetViewDescription *renderTargetViews, const size_t numViews) override
Create a render target using the given view descriptions.
void releaseDepthStencilState(DepthStencilStateHandle handle) override
Release the depth stencil state with the given handle.
BlendStateHandle loadBlendState(const BlendState &blendState) override
Load a blend state object.
DepthStencilHandle createDepthStencilTarget(const RenderTargetHandle handle) override
Creates a depth/stencil target to back the render target with the given handle.
void annotate(RenderTargetHandle handle, const StringView &name) override
Associate a name with an object for use in graphics debugging.
DepthStencilStateHandle loadDepthStencilState(const DepthStencilState &depthStencilState) override
Load a depth stencil state object.
RasterizerStateHandle loadRasterizerState(const RasterizerState &rasterizerState) override
Load a rasterizer state object.