summaryrefslogtreecommitdiff
path: root/tools/gfx/d3d12/d3d12-submitter.cpp
diff options
context:
space:
mode:
authorlucy96chen <47800040+lucy96chen@users.noreply.github.com>2022-05-17 10:56:14 -0700
committerGitHub <noreply@github.com>2022-05-17 10:56:14 -0700
commit5a3aa6159e0ef0241b528812e1d138f0d7055f22 (patch)
tree71d286e06030ee73f0b739e071cd58dd05d507d1 /tools/gfx/d3d12/d3d12-submitter.cpp
parent716e75b9ed1acfaee3dc7f3bc347ad17fca65e05 (diff)
Split render-d3d12.h/cpp into a set of smaller files (#2231)
* Split render-d3d12 into numerous smaller files to make the code easier to parse * Added all new D3D12 files created from splitting render-d3d12 * Fixed several uses of attachment still floating around; Changed resource-d3d12 and descriptor-heap-d3d12 to match naming conventions of new d3d12 implementation header files * Readded files with name changes because changing them from inside VS apparently results in them being treated as new files * Merged in externals changes from master * Small cleanup changes * Rerun CI Co-authored-by: Theresa Foley <10618364+tangent-vector@users.noreply.github.com>
Diffstat (limited to 'tools/gfx/d3d12/d3d12-submitter.cpp')
-rw-r--r--tools/gfx/d3d12/d3d12-submitter.cpp100
1 files changed, 100 insertions, 0 deletions
diff --git a/tools/gfx/d3d12/d3d12-submitter.cpp b/tools/gfx/d3d12/d3d12-submitter.cpp
new file mode 100644
index 000000000..0abd21d70
--- /dev/null
+++ b/tools/gfx/d3d12/d3d12-submitter.cpp
@@ -0,0 +1,100 @@
+// d3d12-submitter.cpp
+#include "d3d12-submitter.h"
+
+#include "d3d12-pipeline-state.h"
+
+namespace gfx
+{
+namespace d3d12
+{
+
+using namespace Slang;
+
+void GraphicsSubmitter::setRootConstantBufferView(
+ int index, D3D12_GPU_VIRTUAL_ADDRESS gpuBufferLocation)
+{
+ m_commandList->SetGraphicsRootConstantBufferView(index, gpuBufferLocation);
+}
+
+void GraphicsSubmitter::setRootUAV(int index, D3D12_GPU_VIRTUAL_ADDRESS gpuBufferLocation)
+{
+ m_commandList->SetGraphicsRootUnorderedAccessView(index, gpuBufferLocation);
+}
+
+void GraphicsSubmitter::setRootSRV(int index, D3D12_GPU_VIRTUAL_ADDRESS gpuBufferLocation)
+{
+ m_commandList->SetGraphicsRootShaderResourceView(index, gpuBufferLocation);
+}
+
+void GraphicsSubmitter::setRootDescriptorTable(
+ int index, D3D12_GPU_DESCRIPTOR_HANDLE baseDescriptor)
+{
+ m_commandList->SetGraphicsRootDescriptorTable(index, baseDescriptor);
+}
+
+void GraphicsSubmitter::setRootSignature(ID3D12RootSignature* rootSignature)
+{
+ m_commandList->SetGraphicsRootSignature(rootSignature);
+}
+
+void GraphicsSubmitter::setRootConstants(
+ Index rootParamIndex,
+ Index dstOffsetIn32BitValues,
+ Index countOf32BitValues,
+ void const* srcData)
+{
+ m_commandList->SetGraphicsRoot32BitConstants(
+ UINT(rootParamIndex), UINT(countOf32BitValues), srcData, UINT(dstOffsetIn32BitValues));
+}
+
+void GraphicsSubmitter::setPipelineState(PipelineStateBase* pipeline)
+{
+ auto pipelineImpl = static_cast<PipelineStateImpl*>(pipeline);
+ m_commandList->SetPipelineState(pipelineImpl->m_pipelineState.get());
+}
+
+void ComputeSubmitter::setRootConstantBufferView(
+ int index, D3D12_GPU_VIRTUAL_ADDRESS gpuBufferLocation)
+{
+ m_commandList->SetComputeRootConstantBufferView(index, gpuBufferLocation);
+}
+
+void ComputeSubmitter::setRootUAV(int index, D3D12_GPU_VIRTUAL_ADDRESS gpuBufferLocation)
+{
+ m_commandList->SetComputeRootUnorderedAccessView(index, gpuBufferLocation);
+}
+
+void ComputeSubmitter::setRootSRV(int index, D3D12_GPU_VIRTUAL_ADDRESS gpuBufferLocation)
+{
+ m_commandList->SetComputeRootShaderResourceView(index, gpuBufferLocation);
+}
+
+void ComputeSubmitter::setRootDescriptorTable(
+ int index, D3D12_GPU_DESCRIPTOR_HANDLE baseDescriptor)
+{
+ m_commandList->SetComputeRootDescriptorTable(index, baseDescriptor);
+}
+
+void ComputeSubmitter::setRootSignature(ID3D12RootSignature* rootSignature)
+{
+ m_commandList->SetComputeRootSignature(rootSignature);
+}
+
+void ComputeSubmitter::setRootConstants(
+ Index rootParamIndex,
+ Index dstOffsetIn32BitValues,
+ Index countOf32BitValues,
+ void const* srcData)
+{
+ m_commandList->SetComputeRoot32BitConstants(
+ UINT(rootParamIndex), UINT(countOf32BitValues), srcData, UINT(dstOffsetIn32BitValues));
+}
+
+void ComputeSubmitter::setPipelineState(PipelineStateBase* pipeline)
+{
+ auto pipelineImpl = static_cast<PipelineStateImpl*>(pipeline);
+ m_commandList->SetPipelineState(pipelineImpl->m_pipelineState.get());
+}
+
+} // namespace d3d12
+} // namespace gfx