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.
This commit is contained in:
baldurk
2022-10-27 11:00:15 +01:00
parent 85118ed46c
commit d9d06c8390
+7 -7
View File
@@ -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 &&