From 24598081aa13231ab80bf7e62476855bf4e177cd Mon Sep 17 00:00:00 2001 From: azhirnov Date: Wed, 19 Aug 2020 19:04:49 +0300 Subject: Added root signature for DrawMeshIndirect, added some checks --- .../GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'Graphics/GraphicsEngineD3D12') diff --git a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp index e6e24fa0..19c02a0d 100644 --- a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp @@ -119,6 +119,13 @@ DeviceContextD3D12Impl::DeviceContextD3D12Impl(IReferenceCounters* pRef IndirectArg.Type = D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH; hr = pd3d12Device->CreateCommandSignature(&CmdSignatureDesc, nullptr, __uuidof(m_pDispatchIndirectSignature), reinterpret_cast(static_cast(&m_pDispatchIndirectSignature))); CHECK_D3D_RESULT_THROW(hr, "Failed to create dispatch indirect command signature"); + +#ifdef D12_H_HAS_MESH_SHADER + CmdSignatureDesc.ByteStride = sizeof(UINT) * 3; + IndirectArg.Type = D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH_MESH; + hr = pd3d12Device->CreateCommandSignature(&CmdSignatureDesc, nullptr, __uuidof(m_pDrawMeshIndirectSignature), reinterpret_cast(static_cast(&m_pDrawMeshIndirectSignature))); + CHECK_D3D_RESULT_THROW(hr, "Failed to create draw mesh indirect command signature"); +#endif } DeviceContextD3D12Impl::~DeviceContextD3D12Impl() @@ -223,8 +230,11 @@ void DeviceContextD3D12Impl::SetPipelineState(IPipelineState* pPipelineState) auto& GraphicsCtx = CmdCtx.AsGraphicsContext(); GraphicsCtx.SetPipelineState(pd3d12PSO); - auto D3D12Topology = TopologyToD3D12Topology(PSODesc.GraphicsPipeline.PrimitiveTopology); - GraphicsCtx.SetPrimitiveTopology(D3D12Topology); + if (PSODesc.PipelineType == PIPELINE_TYPE_GRAPHICS) + { + auto D3D12Topology = TopologyToD3D12Topology(PSODesc.GraphicsPipeline.PrimitiveTopology); + GraphicsCtx.SetPrimitiveTopology(D3D12Topology); + } if (CommitStates) { -- cgit v1.2.3