From d9d06c83900080a380e3a4334262ab5bee8d55e0 Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 27 Oct 2022 11:00:15 +0100 Subject: [PATCH] Fix handling of RANGE_OFFSET_APPEND in multi-type tables in D3D12 * Previously we would only process ranges we were interested in when looking for a descriptor, but we need to process all ranges in a table to properly track the offset for APPEND. --- renderdoc/driver/d3d12/d3d12_shaderdebug.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/renderdoc/driver/d3d12/d3d12_shaderdebug.cpp b/renderdoc/driver/d3d12/d3d12_shaderdebug.cpp index 2f6e7fd24..c846c7c5b 100644 --- a/renderdoc/driver/d3d12/d3d12_shaderdebug.cpp +++ b/renderdoc/driver/d3d12/d3d12_shaderdebug.cpp @@ -693,9 +693,6 @@ D3D12Descriptor D3D12DebugAPIWrapper::FindDescriptor(DXBCBytecode::OperandType t { const D3D12_DESCRIPTOR_RANGE1 &range = param.ranges[r]; - if(range.RangeType != searchRangeType) - continue; - // For every range, check the number of descriptors so that we are accessing the // correct data for append descriptor tables, even if the range type doesn't match // what we need to fetch @@ -703,10 +700,6 @@ D3D12Descriptor D3D12DebugAPIWrapper::FindDescriptor(DXBCBytecode::OperandType t if(range.OffsetInDescriptorsFromTableStart == D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND) offset = prevTableOffset; - D3D12Descriptor *desc = (D3D12Descriptor *)heap->GetCPUDescriptorHandleForHeapStart().ptr; - desc += element.offset; - desc += offset; - UINT numDescriptors = range.NumDescriptors; if(numDescriptors == UINT_MAX) { @@ -719,6 +712,13 @@ D3D12Descriptor D3D12DebugAPIWrapper::FindDescriptor(DXBCBytecode::OperandType t prevTableOffset = offset + numDescriptors; + if(range.RangeType != searchRangeType) + continue; + + D3D12Descriptor *desc = (D3D12Descriptor *)heap->GetCPUDescriptorHandleForHeapStart().ptr; + desc += element.offset; + desc += offset; + // Check if the slot we want is contained if(slot.shaderRegister >= range.BaseShaderRegister && slot.shaderRegister < range.BaseShaderRegister + numDescriptors &&