Handle root signature ranges that bind a subset of a binding array

This commit is contained in:
baldurk
2024-05-10 10:29:42 +01:00
parent 3b2bb46d9a
commit e1283a7440
+10 -2
View File
@@ -2089,8 +2089,16 @@ void D3D12CommandData::AddUsageForBindInRootSig(const D3D12RenderState &state,
bool allInRange = (bind >= range.BaseShaderRegister && rangeSize <= range.NumDescriptors);
// move to the first descriptor in the range which is in the binding we want
desc += (bind - range.BaseShaderRegister);
// move to the first descriptor in the range which is in the binding we want, if the binding
// is later on in the range.
//
// It's also possible that the range is later on in the binding (e.g. if the binding is at
// base register 5 and is 1000000 in length, the range could start at register 10. In that
// case we just consume as much of the range as still fits in the bind
if(bind > range.BaseShaderRegister)
desc += (bind - range.BaseShaderRegister);
if(range.BaseShaderRegister > bind)
rangeSize -= (range.BaseShaderRegister - bind);
if(range.RangeType == D3D12_DESCRIPTOR_RANGE_TYPE_CBV)
{