Cogs.Core
RenderTargetsD3D11.h
1#pragma once
2
3#include "../IRenderTargets.h"
4
5#include "CommonD3D11.h"
6
7namespace Cogs
8{
9 struct GraphicsDeviceD3D11;
10 struct TexturesD3D11;
11
12 const size_t kMaxRenderTargets11 = 8;
13
15 {
16 TextureHandle texture[kMaxRenderTargets11];
17 ResourcePointer<ID3D11RenderTargetView> views[kMaxRenderTargets11];
18 size_t numViews = 0;
19 };
20
22 {
23 void initialize(GraphicsDeviceD3D11 * graphicsDevice, TexturesD3D11 * textures)
24 {
25 this->graphicsDevice = graphicsDevice;
26 this->textures = textures;
27 }
28
29 void annotate(RenderTargetHandle handle, const StringView& name) override;
30 void annotate(DepthStencilHandle handle, const StringView& name) override;
31
32 RenderTargetHandle createRenderTarget(ID3D11Texture2D * texture, bool persistent = false);
34
35 RenderTargetHandle createRenderTarget(const RenderTargetViewDescription * renderTargetViews, const size_t numViews);
37
39 DepthStencilHandle createDepthStencilTarget(const RenderTargetHandle handle, const TextureHandle textureHandle) override;
41
42 DepthStencilStateHandle loadDepthStencilState(const DepthStencilState & depthStencilState) override;
44
45 RasterizerStateHandle loadRasterizerState(const RasterizerState & rasterizerState) override;
47
48 BlendStateHandle loadBlendState(const BlendState & blendState) override;
49 BlendStateHandle loadBlendState(const BlendState & blendStateColor, const BlendState& blendStateAlpha) override;
50 BlendStateHandle loadBlendState(const BlendState & blendStateColor, const BlendState& blendStateAlpha, const uint32_t flags) override;
51 BlendStateHandle loadBlendState(const BlendState * blendStateColor, const BlendState * blendStateAlpha, const uint32_t numBlendState, const uint32_t flags) override;
52
53 void releaseBlendState(BlendStateHandle handle) override;
54
55 void releaseResources() override;
56
60
63
64 private:
65 GraphicsDeviceD3D11 * graphicsDevice = nullptr;
66 TexturesD3D11 * textures = nullptr;
67 };
68}
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:24
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
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 releaseBlendState(BlendStateHandle handle) override
Release the blend state with the given handle.
void releaseRenderTarget(RenderTargetHandle handle)
Release the render target with the given renderTargetHandle.
RasterizerStateHandle loadRasterizerState(const RasterizerState &rasterizerState) override
Load a rasterizer state object.
void releaseDepthStencilState(DepthStencilStateHandle handle) override
Release the depth stencil state with the given handle.
void releaseRasterizerState(RasterizerStateHandle handle) override
Release the rasterizer state with the given handle.
DepthStencilHandle createDepthStencilTarget(const RenderTargetHandle handle, const DepthStencilViewDescription &depthStencilView)
Creates a depth stencil view using the given description.
DepthStencilStateHandle loadDepthStencilState(const DepthStencilState &depthStencilState) override
Load a depth stencil state object.
void releaseResources() override
Release all allocated render target resources.
BlendStateHandle loadBlendState(const BlendState &blendState) override
Load a blend state object.
void annotate(RenderTargetHandle handle, const StringView &name) override
Associate a name with an object for use in graphics debugging.
void releaseDepthStencilTarget(DepthStencilHandle handle) override
Release the depth target with the given depthStencilHandle.