3#include "../IRenderTargets.h"
5#include "Foundation/Collections/ConfigurablePagedPool.h"
7#include "CommonD3D12.h"
16 D3D12_CPU_DESCRIPTOR_HANDLE handle;
22 D3D12_DESCRIPTOR_HEAP_TYPE heapType;
31 D3D12_DESCRIPTOR_HEAP_DESC heapDesc = {};
32 heapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE;
33 heapDesc.Type = context.heapType;
34 heapDesc.NumDescriptors =
static_cast<UINT
>(pageSize);
35 heapDesc.NodeMask = 0;
37 context.device->CreateDescriptorHeap(&heapDesc, IID_PPV_ARGS(heap.internalPointer()));
39 auto heapStart = heap->GetCPUDescriptorHandleForHeapStart();
40 auto descriptorSize = context.device->GetDescriptorHandleIncrementSize(context.heapType);
42 for (
size_t i = 0; i < pageSize; ++i) {
45 CD3DX12_CPU_DESCRIPTOR_HANDLE::InitOffsetted(block->handle, heapStart,
static_cast<int>(i), descriptorSize);
46 block->next = (i == pageSize - 1) ?
nullptr : block + 1;
54 std::vector<uint8_t> storage;
62 context.device = device;
63 context.heapType = heapType;
65 ConfigurablePagedPool::initialize(context, capacity, capacity);
69 const size_t kMaxRenderTargets = 8;
75 D3D12_RENDER_TARGET_VIEW_DESC viewDesc[kMaxRenderTargets];
77 uint32_t numSamples = 1;
81 D3D12_CPU_DESCRIPTOR_HANDLE descriptorHandle[kMaxRenderTargets];
89 D3D12_DEPTH_STENCIL_VIEW_DESC viewDesc;
91 D3D12_CPU_DESCRIPTOR_HANDLE descriptorHandle;
98 D3D12_RASTERIZER_DESC rasterizerDesc;
103 D3D12_DEPTH_STENCIL_DESC depthStencilDesc;
108 D3D12_BLEND_DESC blendDesc;
Provides a configurable pool implementation usable as base implementation for several pool-like stora...
Contains all Cogs related functionality.
Encapsulates blend state for the graphics pipeline in a state object.
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 releaseRenderTarget(RenderTargetHandle handle)
Release the render target with the given renderTargetHandle.
RasterizerStateHandle loadRasterizerState(const RasterizerState &rasterizerState)
Load a rasterizer state object.
BlendStateHandle loadBlendState(const BlendState &blendState)
Load a blend state object.
void releaseBlendState(BlendStateHandle handle)
Release the blend state with the given handle.
void releaseDepthStencilTarget(DepthStencilHandle handle)
Release the depth target with the given depthStencilHandle.
DepthStencilStateHandle loadDepthStencilState(const DepthStencilState &depthStencilState)
Load a depth stencil state object.
void releaseDepthStencilState(DepthStencilStateHandle handle)
Release the depth stencil state with the given handle.
void releaseRasterizerState(RasterizerStateHandle handle)
Release the rasterizer state with the given handle.
void releaseResources()
Release all allocated render target resources.
DepthStencilHandle createDepthStencilTarget(const RenderTargetHandle handle)
Creates a depth/stencil target to back the render target with the given handle.