ID3D12GraphicsCommandList::SetComputeRootSignature method
Sets the layout of the compute root signature.
Syntax
void SetComputeRootSignature( [in, optional] ID3D12RootSignature *pRootSignature );
Parameters
- pRootSignature [in, optional]
-
Type: ID3D12RootSignature*
A pointer to the ID3D12RootSignature object.
Return value
This method does not return a value.
Examples
The D3D12nBodyGravity sample uses ID3D12GraphicsCommandList::SetComputeRootSignature as follows:
// Run the particle simulation using the compute shader. void D3D12nBodyGravity::Simulate(UINT threadIndex) { ID3D12GraphicsCommandList* pCommandList = m_computeCommandList[threadIndex].Get(); UINT srvIndex; UINT uavIndex; ID3D12Resource *pUavResource; if (m_srvIndex[threadIndex] == 0) { srvIndex = SrvParticlePosVelo0; uavIndex = UavParticlePosVelo1; pUavResource = m_particleBuffer1[threadIndex].Get(); } else { srvIndex = SrvParticlePosVelo1; uavIndex = UavParticlePosVelo0; pUavResource = m_particleBuffer0[threadIndex].Get(); } pCommandList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(pUavResource, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE, D3D12_RESOURCE_STATE_UNORDERED_ACCESS)); pCommandList->SetPipelineState(m_computeState.Get()); pCommandList->SetComputeRootSignature(m_computeRootSignature.Get()); ID3D12DescriptorHeap* ppHeaps[] = { m_srvUavHeap.Get() }; pCommandList->SetDescriptorHeaps(_countof(ppHeaps), ppHeaps); CD3DX12_GPU_DESCRIPTOR_HANDLE srvHandle(m_srvUavHeap->GetGPUDescriptorHandleForHeapStart(), srvIndex + threadIndex, m_srvUavDescriptorSize); CD3DX12_GPU_DESCRIPTOR_HANDLE uavHandle(m_srvUavHeap->GetGPUDescriptorHandleForHeapStart(), uavIndex + threadIndex, m_srvUavDescriptorSize); pCommandList->SetComputeRootConstantBufferView(RootParameterCB, m_constantBufferCS->GetGPUVirtualAddress()); pCommandList->SetComputeRootDescriptorTable(RootParameterSRV, srvHandle); pCommandList->SetComputeRootDescriptorTable(RootParameterUAV, uavHandle); pCommandList->Dispatch(static_cast<int>(ceil(ParticleCount / 128.0f)), 1, 1); pCommandList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(pUavResource, D3D12_RESOURCE_STATE_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE)); }
See Example Code in the D3D12 Reference.
Requirements
|
Header |
|
|---|---|
|
Library |
|
|
DLL |
|
See also
Show: