From 171ac1cf6e29170ea6c92dd72df383ecafe9cefc Mon Sep 17 00:00:00 2001 From: assiduous Date: Tue, 5 Jan 2021 10:05:24 -0800 Subject: D3D12 backend: do not create draw mesh indirect cmd signature if mesh shaders are not supported --- Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'Graphics/GraphicsEngineD3D12') diff --git a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp index 5d36402e..ec14d2f5 100644 --- a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp @@ -122,10 +122,13 @@ DeviceContextD3D12Impl::DeviceContextD3D12Impl(IReferenceCounters* pRef CHECK_D3D_RESULT_THROW(hr, "Failed to create dispatch indirect command signature"); #ifdef D3D12_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"); + if (pDeviceD3D12Impl->GetDeviceCaps().Features.MeshShaders == DEVICE_FEATURE_STATE_ENABLED) + { + 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 } -- cgit v1.2.3