Use DebugDeclare for local variables

Previously we had decided to issue DebugValue directly in glslang.
However, this was incorrect and causing issues with RenderDoc.
This commit is contained in:
Jeremy Hayes 2022-09-23 09:17:44 -06:00
parent c0cf8ad876
commit ee442785dd
13 changed files with 5235 additions and 5347 deletions

View file

@ -1146,19 +1146,6 @@ Id Builder::makeDebugDeclare(Id const debugLocalVariable, Id const localVariable
return inst->getResultId();
}
Id Builder::makeDebugValue(Id const debugLocalVariable, Id const value)
{
Instruction* inst = new Instruction(getUniqueId(), makeVoidType(), OpExtInst);
inst->addIdOperand(nonSemanticShaderDebugInfo);
inst->addImmediateOperand(NonSemanticShaderDebugInfo100DebugValue);
inst->addIdOperand(debugLocalVariable); // debug local variable id
inst->addIdOperand(value); // value id
inst->addIdOperand(makeDebugExpression()); // expression id
buildPoint->addInstruction(std::unique_ptr<Instruction>(inst));
return inst->getResultId();
}
#ifndef GLSLANG_WEB
Id Builder::makeAccelerationStructureType()
{
@ -2248,8 +2235,7 @@ Id Builder::createVariable(Decoration precision, StorageClass storageClass, Id t
auto const debugLocalVariableId = createDebugLocalVariable(debugId[type], name);
debugId[inst->getResultId()] = debugLocalVariableId;
// TODO: Remove?
// makeDebugDeclare(debugLocalVariableId, inst->getResultId());
makeDebugDeclare(debugLocalVariableId, inst->getResultId());
}
break;
@ -2322,15 +2308,6 @@ void Builder::createStore(Id rValue, Id lValue, spv::MemoryAccessMask memoryAcce
}
buildPoint->addInstruction(std::unique_ptr<Instruction>(store));
if (emitNonSemanticShaderDebugInfo && !isGlobalVariable(lValue))
{
if(debugId.find(lValue) != debugId.end())
{
auto const debugLocalVariableId = debugId[lValue];
makeDebugValue(debugLocalVariableId, rValue);
}
}
}
// Comments in header