yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f65d756bf
master
1// d3d12-submitter.cpp 2#include "d3d12-submitter.h" 3 4#include "d3d12-pipeline-state.h" 5 6namespace gfx 7{ 8namespace d3d12 9{ 10 11using namespace Slang ; 12 13void GraphicsSubmitter ::setRootConstantBufferView ( 14int index , 15D3D12_GPU_VIRTUAL_ADDRESS gpuBufferLocation ) 16{ 17m_commandList -> SetGraphicsRootConstantBufferView (index ,gpuBufferLocation ); 18} 19 20void GraphicsSubmitter ::setRootUAV (int index ,D3D12_GPU_VIRTUAL_ADDRESS gpuBufferLocation ) 21{ 22m_commandList -> SetGraphicsRootUnorderedAccessView (index ,gpuBufferLocation ); 23} 24 25void GraphicsSubmitter ::setRootSRV (int index ,D3D12_GPU_VIRTUAL_ADDRESS gpuBufferLocation ) 26{ 27m_commandList -> SetGraphicsRootShaderResourceView (index ,gpuBufferLocation ); 28} 29 30void GraphicsSubmitter ::setRootDescriptorTable ( 31int index , 32D3D12_GPU_DESCRIPTOR_HANDLE baseDescriptor ) 33{ 34m_commandList -> SetGraphicsRootDescriptorTable (index ,baseDescriptor ); 35} 36 37void GraphicsSubmitter ::setRootSignature (ID3D12RootSignature * rootSignature ) 38{ 39m_commandList -> SetGraphicsRootSignature (rootSignature ); 40} 41 42void GraphicsSubmitter ::setRootConstants ( 43Index rootParamIndex , 44Index dstOffsetIn32BitValues , 45Index countOf32BitValues , 46void const * srcData ) 47{ 48m_commandList -> SetGraphicsRoot32BitConstants ( 49UINT (rootParamIndex ), 50UINT (countOf32BitValues ), 51srcData , 52UINT (dstOffsetIn32BitValues )); 53} 54 55void GraphicsSubmitter ::setPipelineState (PipelineStateBase * pipeline ) 56{ 57auto pipelineImpl = static_cast < PipelineStateImpl *> (pipeline ); 58m_commandList -> SetPipelineState (pipelineImpl -> m_pipelineState .get ()); 59} 60 61void ComputeSubmitter ::setRootConstantBufferView ( 62int index , 63D3D12_GPU_VIRTUAL_ADDRESS gpuBufferLocation ) 64{ 65m_commandList -> SetComputeRootConstantBufferView (index ,gpuBufferLocation ); 66} 67 68void ComputeSubmitter ::setRootUAV (int index ,D3D12_GPU_VIRTUAL_ADDRESS gpuBufferLocation ) 69{ 70m_commandList -> SetComputeRootUnorderedAccessView (index ,gpuBufferLocation ); 71} 72 73void ComputeSubmitter ::setRootSRV (int index ,D3D12_GPU_VIRTUAL_ADDRESS gpuBufferLocation ) 74{ 75m_commandList -> SetComputeRootShaderResourceView (index ,gpuBufferLocation ); 76} 77 78void ComputeSubmitter ::setRootDescriptorTable (int index ,D3D12_GPU_DESCRIPTOR_HANDLE baseDescriptor ) 79{ 80m_commandList -> SetComputeRootDescriptorTable (index ,baseDescriptor ); 81} 82 83void ComputeSubmitter ::setRootSignature (ID3D12RootSignature * rootSignature ) 84{ 85m_commandList -> SetComputeRootSignature (rootSignature ); 86} 87 88void ComputeSubmitter ::setRootConstants ( 89Index rootParamIndex , 90Index dstOffsetIn32BitValues , 91Index countOf32BitValues , 92void const * srcData ) 93{ 94m_commandList -> SetComputeRoot32BitConstants ( 95UINT (rootParamIndex ), 96UINT (countOf32BitValues ), 97srcData , 98UINT (dstOffsetIn32BitValues )); 99} 100 101void ComputeSubmitter ::setPipelineState (PipelineStateBase * pipeline ) 102{ 103auto pipelineImpl = static_cast < PipelineStateImpl *> (pipeline ); 104m_commandList -> SetPipelineState (pipelineImpl -> m_pipelineState .get ()); 105} 106 107}// namespace d3d12 108}// namespace gfx