Emit debug info for accelerationStructure and rayQuery variables. (#3502)

* Add debug info for accelerationStructure and rayQuery variables.
* Add test case for accelerationStructure and rayQuery
This commit is contained in:
Sajjad Mirza 2024-02-14 16:43:02 -08:00 committed by GitHub
parent 114dae9114
commit 7a2a1623d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 200 additions and 14 deletions

View file

@ -1176,6 +1176,10 @@ Id Builder::makeAccelerationStructureType()
groupedTypes[OpTypeAccelerationStructureKHR].push_back(type);
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
module.mapInstruction(type);
if (emitNonSemanticShaderDebugInfo) {
spv::Id debugType = makeCompositeDebugType({}, "accelerationStructure", NonSemanticShaderDebugInfo100Structure, true);
debugId[type->getResultId()] = debugType;
}
} else {
type = groupedTypes[OpTypeAccelerationStructureKHR].back();
}
@ -1191,6 +1195,10 @@ Id Builder::makeRayQueryType()
groupedTypes[OpTypeRayQueryKHR].push_back(type);
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
module.mapInstruction(type);
if (emitNonSemanticShaderDebugInfo) {
spv::Id debugType = makeCompositeDebugType({}, "rayQuery", NonSemanticShaderDebugInfo100Structure, true);
debugId[type->getResultId()] = debugType;
}
} else {
type = groupedTypes[OpTypeRayQueryKHR].back();
}
@ -1476,17 +1484,6 @@ bool Builder::isSpecConstantOpCode(Op opcode) const
}
}
bool Builder::isRayTracingOpCode(Op opcode) const
{
switch (opcode) {
case OpTypeAccelerationStructureKHR:
case OpTypeRayQueryKHR:
return true;
default:
return false;
}
}
Id Builder::makeNullConstant(Id typeId)
{
Instruction* constant;
@ -2368,7 +2365,7 @@ Id Builder::createVariable(Decoration precision, StorageClass storageClass, Id t
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(inst));
module.mapInstruction(inst);
if (emitNonSemanticShaderDebugInfo && !isRayTracingOpCode(getOpCode(type)))
if (emitNonSemanticShaderDebugInfo)
{
auto const debugResultId = createDebugGlobalVariable(debugId[type], name, inst->getResultId());
debugId[inst->getResultId()] = debugResultId;