Improve SSA variable name and accessed resource name for resource arrays

For a dynamic index resolve the name to the actual array index i.e. res2[1] instead of res2[_70 - 7]
This commit is contained in:
Jake Turner
2025-03-16 15:23:53 +00:00
parent 03b5c94144
commit 25e0612a50
+3 -2
View File
@@ -2333,11 +2333,13 @@ bool ThreadState::ExecuteInstruction(DebugAPIWrapper *apiWrapper,
ShaderVariable arg;
RDCASSERT(GetShaderVariable(inst.args[resIndexArgId], opCode, dxOpCode, arg));
uint32_t arrayIndex = arg.value.u32v[0];
RDCASSERT(arrayIndex >= resRef->resourceBase.regBase);
arrayIndex -= resRef->resourceBase.regBase;
bool isSRV = (resRef->resourceBase.resClass == ResourceClass::SRV);
DescriptorCategory category = isSRV ? DescriptorCategory::ReadOnlyResource
: DescriptorCategory::ReadWriteResource;
result.SetBindIndex(ShaderBindIndex(category, resRef->resourceIndex, arrayIndex));
result.name = baseResource;
result.name = resRef->resourceBase.name + StringFormat::Fmt("[%u]", arrayIndex);
result.type = isSRV ? VarType::ReadOnlyResource : VarType::ReadWriteResource;
// Default to unannotated handle
ClearAnnotatedHandle(result);
@@ -6120,7 +6122,6 @@ ResourceReferenceInfo ThreadState::GetResource(Id handleId, bool &annotatedHandl
const ResourceReference *resRef = m_Program.GetResourceReference(handleId);
if(resRef)
{
alias = m_Program.GetHandleAlias(resRef->handleID);
resRefInfo.Create(resRef, bindIndex.arrayElement);
}
else