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 &&