Update main.cpp to use D3D12CommandList wrapper methods, add SetRenderTargets and Clear overloads
This commit is contained in:
@@ -61,6 +61,7 @@ public:
|
||||
void SetScissorRects(uint32_t count, const Rect* rects);
|
||||
void SetPrimitiveTopology(PrimitiveTopology topology);
|
||||
void SetRenderTargets(uint32_t count, ID3D12Resource** renderTargets, ID3D12Resource* depthStencil = nullptr);
|
||||
void SetRenderTargets(uint32_t count, const D3D12_CPU_DESCRIPTOR_HANDLE* renderTargetHandles, const D3D12_CPU_DESCRIPTOR_HANDLE* depthStencilHandle = nullptr);
|
||||
|
||||
void SetVertexBuffer(uint32_t slot, ID3D12Resource* buffer, uint64_t offset, uint32_t stride);
|
||||
void SetVertexBuffers(uint32_t startSlot, uint32_t count, const D3D12_VERTEX_BUFFER_VIEW* views);
|
||||
@@ -86,7 +87,9 @@ public:
|
||||
void DrawIndexedInstancedIndirect(ID3D12Resource* argBuffer, uint64_t alignedByteOffset);
|
||||
|
||||
void ClearRenderTargetView(ID3D12Resource* renderTarget, const float color[4], uint32_t rectCount = 0, const D3D12_RECT* rects = nullptr);
|
||||
void ClearRenderTargetView(D3D12_CPU_DESCRIPTOR_HANDLE renderTargetHandle, const float color[4], uint32_t rectCount = 0, const D3D12_RECT* rects = nullptr);
|
||||
void ClearDepthStencilView(ID3D12Resource* depthStencil, uint32_t clearFlags, float depth = 1.0f, uint8_t stencil = 0, uint32_t rectCount = 0, const D3D12_RECT* rects = nullptr);
|
||||
void ClearDepthStencilView(D3D12_CPU_DESCRIPTOR_HANDLE depthStencilHandle, uint32_t clearFlags, float depth = 1.0f, uint8_t stencil = 0, uint32_t rectCount = 0, const D3D12_RECT* rects = nullptr);
|
||||
void ClearUnorderedAccessView(D3D12_GPU_DESCRIPTOR_HANDLE viewHandle, D3D12_CPU_DESCRIPTOR_HANDLE resourceHandle, ID3D12Resource* unorderedAccess, const float values[4], uint32_t rectCount = 0, const D3D12_RECT* rects = nullptr);
|
||||
|
||||
void CopyResource(ID3D12Resource* dst, ID3D12Resource* src);
|
||||
|
||||
@@ -162,6 +162,10 @@ void D3D12CommandList::SetRenderTargets(uint32_t count, ID3D12Resource** renderT
|
||||
m_commandList->OMSetRenderTargets(count, count > 0 ? rtvHandles.data() : nullptr, FALSE, depthStencil ? &dsvHandle : nullptr);
|
||||
}
|
||||
|
||||
void D3D12CommandList::SetRenderTargets(uint32_t count, const D3D12_CPU_DESCRIPTOR_HANDLE* renderTargetHandles, const D3D12_CPU_DESCRIPTOR_HANDLE* depthStencilHandle) {
|
||||
m_commandList->OMSetRenderTargets(count, renderTargetHandles, FALSE, depthStencilHandle);
|
||||
}
|
||||
|
||||
void D3D12CommandList::SetVertexBuffer(uint32_t slot, ID3D12Resource* buffer, uint64_t offset, uint32_t stride) {
|
||||
D3D12_VERTEX_BUFFER_VIEW view = {};
|
||||
view.BufferLocation = buffer->GetGPUVirtualAddress() + offset;
|
||||
@@ -249,11 +253,19 @@ void D3D12CommandList::ClearRenderTargetView(ID3D12Resource* renderTarget, const
|
||||
m_commandList->ClearRenderTargetView(rtvHandle, color, rectCount, rects);
|
||||
}
|
||||
|
||||
void D3D12CommandList::ClearRenderTargetView(D3D12_CPU_DESCRIPTOR_HANDLE renderTargetHandle, const float color[4], uint32_t rectCount, const D3D12_RECT* rects) {
|
||||
m_commandList->ClearRenderTargetView(renderTargetHandle, color, rectCount, rects);
|
||||
}
|
||||
|
||||
void D3D12CommandList::ClearDepthStencilView(ID3D12Resource* depthStencil, uint32_t clearFlags, float depth, uint8_t stencil, uint32_t rectCount, const D3D12_RECT* rects) {
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE dsvHandle = {};
|
||||
m_commandList->ClearDepthStencilView(dsvHandle, static_cast<D3D12_CLEAR_FLAGS>(clearFlags), depth, stencil, rectCount, rects);
|
||||
}
|
||||
|
||||
void D3D12CommandList::ClearDepthStencilView(D3D12_CPU_DESCRIPTOR_HANDLE depthStencilHandle, uint32_t clearFlags, float depth, uint8_t stencil, uint32_t rectCount, const D3D12_RECT* rects) {
|
||||
m_commandList->ClearDepthStencilView(depthStencilHandle, static_cast<D3D12_CLEAR_FLAGS>(clearFlags), depth, stencil, rectCount, rects);
|
||||
}
|
||||
|
||||
void D3D12CommandList::ClearUnorderedAccessView(D3D12_GPU_DESCRIPTOR_HANDLE viewHandle, D3D12_CPU_DESCRIPTOR_HANDLE resourceHandle, ID3D12Resource* unorderedAccess, const float values[4], uint32_t rectCount, const D3D12_RECT* rects) {
|
||||
m_commandList->ClearUnorderedAccessViewFloat(viewHandle, resourceHandle, unorderedAccess, values, rectCount, rects);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user