From 89831fe55336b74217aa6b81eafe87f0ed7d1ebf Mon Sep 17 00:00:00 2001 From: Haydn Trigg Date: Wed, 12 Oct 2022 04:24:40 +0100 Subject: [PATCH] Fallback layer avoid calling SetComputeRoot32BitConstants with no data If AccelerationStructuresEntries is empty, don't call SetComputeRoot32BitConstants --- .../src/UberShaderRayTracingProgram.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Libraries/D3D12RaytracingFallback/src/UberShaderRayTracingProgram.cpp b/Libraries/D3D12RaytracingFallback/src/UberShaderRayTracingProgram.cpp index 012990bc3..93cf24b6c 100644 --- a/Libraries/D3D12RaytracingFallback/src/UberShaderRayTracingProgram.cpp +++ b/Libraries/D3D12RaytracingFallback/src/UberShaderRayTracingProgram.cpp @@ -258,8 +258,11 @@ namespace FallbackLayer AccelerationStructuresEntries[entriesAdded++] = entry.second; } - pCommandList->SetComputeRoot32BitConstants( - m_patchRootSignatureParameterStart + AccelerationStructuresList, (UINT)(AccelerationStructuresEntries.size() * (SizeOfInUint32(*AccelerationStructuresEntries.data()))), AccelerationStructuresEntries.data(), 0); + if (!AccelerationStructuresEntries.empty()) + { + pCommandList->SetComputeRoot32BitConstants( + m_patchRootSignatureParameterStart + AccelerationStructuresList, (UINT)(AccelerationStructuresEntries.size() * (SizeOfInUint32(*AccelerationStructuresEntries.data()))), AccelerationStructuresEntries.data(), 0); + } #ifdef DEBUG m_pPredispatchCallback(pCommandList, m_patchRootSignatureParameterStart);