Handle OpAccessChain only for a global resource array index

* If we have an OpAccessChain which only looks up a resource index and not
  anything else, we need to ensure that both we don't consume the first index
  next time, AND that we preserve the resource index for future access chains.
This commit is contained in:
baldurk
2022-09-12 13:54:06 +01:00
parent 0a6368f777
commit 53c529fdaf
@@ -1981,9 +1981,14 @@ ShaderVariable Debugger::MakeCompositePointer(const ShaderVariable &base, Id id,
bool isArray = false;
// if this is an arrayed opaque binding, the first index is a 'virtual' array index into the
// binding.
// We only take this if this is the FIRST dereference from the global pointer.
// If the SPIR-V does something like structType *_1234 =
if((leaf->type == VarType::ReadWriteResource || leaf->type == VarType::ReadOnlyResource ||
leaf->type == VarType::Sampler) &&
checkPointerFlags(*leaf, PointerFlags::GlobalArrayBinding))
checkPointerFlags(*leaf, PointerFlags::GlobalArrayBinding) &&
getBufferTypeId(base) == rdcspv::Id())
{
isArray = true;
}
@@ -2015,6 +2020,10 @@ ShaderVariable Debugger::MakeCompositePointer(const ShaderVariable &base, Id id,
setBindArrayIndex(ret, indices[i++]);
type = &dataTypes[type->InnerType()];
}
else
{
setBindArrayIndex(ret, getBindArrayIndex(base));
}
Decorations curDecorations = decorations[type->id];