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:
parent
114dae9114
commit
7a2a1623d8
5 changed files with 200 additions and 14 deletions
|
|
@ -1176,6 +1176,10 @@ Id Builder::makeAccelerationStructureType()
|
||||||
groupedTypes[OpTypeAccelerationStructureKHR].push_back(type);
|
groupedTypes[OpTypeAccelerationStructureKHR].push_back(type);
|
||||||
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
|
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
|
||||||
module.mapInstruction(type);
|
module.mapInstruction(type);
|
||||||
|
if (emitNonSemanticShaderDebugInfo) {
|
||||||
|
spv::Id debugType = makeCompositeDebugType({}, "accelerationStructure", NonSemanticShaderDebugInfo100Structure, true);
|
||||||
|
debugId[type->getResultId()] = debugType;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
type = groupedTypes[OpTypeAccelerationStructureKHR].back();
|
type = groupedTypes[OpTypeAccelerationStructureKHR].back();
|
||||||
}
|
}
|
||||||
|
|
@ -1191,6 +1195,10 @@ Id Builder::makeRayQueryType()
|
||||||
groupedTypes[OpTypeRayQueryKHR].push_back(type);
|
groupedTypes[OpTypeRayQueryKHR].push_back(type);
|
||||||
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
|
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
|
||||||
module.mapInstruction(type);
|
module.mapInstruction(type);
|
||||||
|
if (emitNonSemanticShaderDebugInfo) {
|
||||||
|
spv::Id debugType = makeCompositeDebugType({}, "rayQuery", NonSemanticShaderDebugInfo100Structure, true);
|
||||||
|
debugId[type->getResultId()] = debugType;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
type = groupedTypes[OpTypeRayQueryKHR].back();
|
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)
|
Id Builder::makeNullConstant(Id typeId)
|
||||||
{
|
{
|
||||||
Instruction* constant;
|
Instruction* constant;
|
||||||
|
|
@ -2368,7 +2365,7 @@ Id Builder::createVariable(Decoration precision, StorageClass storageClass, Id t
|
||||||
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(inst));
|
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(inst));
|
||||||
module.mapInstruction(inst);
|
module.mapInstruction(inst);
|
||||||
|
|
||||||
if (emitNonSemanticShaderDebugInfo && !isRayTracingOpCode(getOpCode(type)))
|
if (emitNonSemanticShaderDebugInfo)
|
||||||
{
|
{
|
||||||
auto const debugResultId = createDebugGlobalVariable(debugId[type], name, inst->getResultId());
|
auto const debugResultId = createDebugGlobalVariable(debugId[type], name, inst->getResultId());
|
||||||
debugId[inst->getResultId()] = debugResultId;
|
debugId[inst->getResultId()] = debugResultId;
|
||||||
|
|
|
||||||
|
|
@ -326,8 +326,6 @@ public:
|
||||||
// See if a resultId is valid for use as an initializer.
|
// See if a resultId is valid for use as an initializer.
|
||||||
bool isValidInitializer(Id resultId) const { return isConstant(resultId) || isGlobalVariable(resultId); }
|
bool isValidInitializer(Id resultId) const { return isConstant(resultId) || isGlobalVariable(resultId); }
|
||||||
|
|
||||||
bool isRayTracingOpCode(Op opcode) const;
|
|
||||||
|
|
||||||
int getScalarTypeWidth(Id typeId) const
|
int getScalarTypeWidth(Id typeId) const
|
||||||
{
|
{
|
||||||
Id scalarTypeId = getScalarTypeId(typeId);
|
Id scalarTypeId = getScalarTypeId(typeId);
|
||||||
|
|
|
||||||
167
Test/baseResults/spv.debuginfo.rt_types.glsl.rgen.out
Normal file
167
Test/baseResults/spv.debuginfo.rt_types.glsl.rgen.out
Normal file
|
|
@ -0,0 +1,167 @@
|
||||||
|
spv.debuginfo.rt_types.glsl.rgen
|
||||||
|
// Module Version 10000
|
||||||
|
// Generated by (magic number): 8000b
|
||||||
|
// Id's are bound by 122
|
||||||
|
|
||||||
|
Capability RayQueryKHR
|
||||||
|
Capability RayTracingNV
|
||||||
|
Extension "SPV_KHR_non_semantic_info"
|
||||||
|
Extension "SPV_KHR_ray_query"
|
||||||
|
Extension "SPV_NV_ray_tracing"
|
||||||
|
1: ExtInstImport "NonSemantic.Shader.DebugInfo.100"
|
||||||
|
3: ExtInstImport "GLSL.std.450"
|
||||||
|
MemoryModel Logical GLSL450
|
||||||
|
EntryPoint RayGenerationKHR 14 "main"
|
||||||
|
2: String ""
|
||||||
|
8: String "uint"
|
||||||
|
16: String "main"
|
||||||
|
19: String "// OpModuleProcessed auto-map-locations
|
||||||
|
// OpModuleProcessed auto-map-bindings
|
||||||
|
// OpModuleProcessed client vulkan100
|
||||||
|
// OpModuleProcessed target-env vulkan1.0
|
||||||
|
// OpModuleProcessed keep-uncalled
|
||||||
|
// OpModuleProcessed entry-point main
|
||||||
|
#line 1
|
||||||
|
"
|
||||||
|
33: String "rayFlags"
|
||||||
|
40: String "float"
|
||||||
|
46: String "tMin"
|
||||||
|
53: String "tMax"
|
||||||
|
60: String "rayQuery"
|
||||||
|
62: String "@rayQuery"
|
||||||
|
68: String "localRayQuery"
|
||||||
|
72: String "accelerationStructure"
|
||||||
|
73: String "@accelerationStructure"
|
||||||
|
78: String "acc0"
|
||||||
|
87: String "origin"
|
||||||
|
90: String "block"
|
||||||
|
97: String "int"
|
||||||
|
110: String "bool"
|
||||||
|
SourceExtension "GL_EXT_ray_query"
|
||||||
|
SourceExtension "GL_NV_ray_tracing"
|
||||||
|
Name 14 "main"
|
||||||
|
Name 31 "rayFlags"
|
||||||
|
Name 44 "tMin"
|
||||||
|
Name 51 "tMax"
|
||||||
|
Name 66 "localRayQuery"
|
||||||
|
Name 76 "acc0"
|
||||||
|
Name 85 "block"
|
||||||
|
MemberName 85(block) 0 "dir"
|
||||||
|
MemberName 85(block) 1 "origin"
|
||||||
|
Name 94 ""
|
||||||
|
Decorate 76(acc0) DescriptorSet 0
|
||||||
|
Decorate 76(acc0) Binding 0
|
||||||
|
MemberDecorate 85(block) 0 Offset 0
|
||||||
|
MemberDecorate 85(block) 1 Offset 16
|
||||||
|
Decorate 85(block) BufferBlock
|
||||||
|
4: TypeVoid
|
||||||
|
5: TypeFunction 4
|
||||||
|
7: TypeInt 32 0
|
||||||
|
10: 7(int) Constant 32
|
||||||
|
11: 7(int) Constant 6
|
||||||
|
12: 7(int) Constant 0
|
||||||
|
9: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 8 10 11 12
|
||||||
|
13: 7(int) Constant 3
|
||||||
|
6: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(DebugTypeFunction) 13 4
|
||||||
|
18: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 35(DebugSource) 2 19
|
||||||
|
20: 7(int) Constant 12
|
||||||
|
22: 7(int) Constant 1
|
||||||
|
23: 7(int) Constant 4
|
||||||
|
24: 7(int) Constant 2
|
||||||
|
21: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(DebugCompilationUnit) 22 23 18 24
|
||||||
|
17: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 16 6 18 20 12 21 16 13 20
|
||||||
|
28: TypePointer Function 7(int)
|
||||||
|
29: 7(int) Constant 7
|
||||||
|
30: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 9 29 12
|
||||||
|
34: 7(int) Constant 15
|
||||||
|
32: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 33 9 18 34 12 17 23
|
||||||
|
36: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression)
|
||||||
|
38: 7(int) Constant 9
|
||||||
|
39: TypeFloat 32
|
||||||
|
41: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 40 10 13 12
|
||||||
|
42: TypePointer Function 39(float)
|
||||||
|
43: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 41 29 12
|
||||||
|
47: 7(int) Constant 16
|
||||||
|
45: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 46 41 18 47 12 17 23
|
||||||
|
50: 39(float) Constant 0
|
||||||
|
54: 7(int) Constant 17
|
||||||
|
52: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 53 41 18 54 12 17 23
|
||||||
|
57: 39(float) Constant 1148846080
|
||||||
|
58: TypeRayQueryKHR
|
||||||
|
61: 7(int) Constant 18
|
||||||
|
63: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 0(DebugInfoNone)
|
||||||
|
59: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 60 22 18 61 12 21 62 63 13
|
||||||
|
64: TypePointer Private 58
|
||||||
|
65: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 59 11 12
|
||||||
|
66(localRayQuery): 64(ptr) Variable Private
|
||||||
|
69: 7(int) Constant 8
|
||||||
|
67: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 68 59 18 61 12 21 68 66(localRayQuery) 69
|
||||||
|
70: TypeAccelerationStructureKHR
|
||||||
|
71: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 72 22 18 61 12 21 73 63 13
|
||||||
|
74: TypePointer UniformConstant 70
|
||||||
|
75: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 71 12 12
|
||||||
|
76(acc0): 74(ptr) Variable UniformConstant
|
||||||
|
77: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 78 71 18 61 12 21 78 76(acc0) 69
|
||||||
|
82: 7(int) Constant 255
|
||||||
|
83: TypeVector 39(float) 3
|
||||||
|
84: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 41 13
|
||||||
|
85(block): TypeStruct 83(fvec3) 83(fvec3)
|
||||||
|
86: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 87 84 18 38 29 12 12 13
|
||||||
|
88: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 87 84 18 38 29 12 12 13
|
||||||
|
89: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 90 22 18 61 12 21 90 12 13 86 88
|
||||||
|
91: TypePointer ShaderRecordBufferKHR 85(block)
|
||||||
|
92: 7(int) Constant 5343
|
||||||
|
93: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 89 92 12
|
||||||
|
94: 91(ptr) Variable ShaderRecordBufferKHR
|
||||||
|
95: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 2 89 18 61 12 21 2 94 69
|
||||||
|
96: TypeInt 32 1
|
||||||
|
98: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 97 10 23 12
|
||||||
|
99: 96(int) Constant 1
|
||||||
|
100: TypePointer ShaderRecordBufferKHR 83(fvec3)
|
||||||
|
101: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 84 92 12
|
||||||
|
105: 96(int) Constant 0
|
||||||
|
109: TypeBool
|
||||||
|
111: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 110 10 24 12
|
||||||
|
114: 7(int) Constant 19
|
||||||
|
120: 7(int) Constant 21
|
||||||
|
14(main): 4 Function None 5
|
||||||
|
15: Label
|
||||||
|
31(rayFlags): 28(ptr) Variable Function
|
||||||
|
44(tMin): 42(ptr) Variable Function
|
||||||
|
51(tMax): 42(ptr) Variable Function
|
||||||
|
26: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17
|
||||||
|
27: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 20 20 12 12
|
||||||
|
25: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 17 14(main)
|
||||||
|
37: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 34 34 12 12
|
||||||
|
35: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 32 31(rayFlags) 36
|
||||||
|
Store 31(rayFlags) 38
|
||||||
|
49: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 47 47 12 12
|
||||||
|
48: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 45 44(tMin) 36
|
||||||
|
Store 44(tMin) 50
|
||||||
|
56: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 54 54 12 12
|
||||||
|
55: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 52 51(tMax) 36
|
||||||
|
Store 51(tMax) 57
|
||||||
|
80: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 61 61 12 12
|
||||||
|
79: 70 Load 76(acc0)
|
||||||
|
81: 7(int) Load 31(rayFlags)
|
||||||
|
102: 100(ptr) AccessChain 94 99
|
||||||
|
103: 83(fvec3) Load 102
|
||||||
|
104: 39(float) Load 44(tMin)
|
||||||
|
106: 100(ptr) AccessChain 94 105
|
||||||
|
107: 83(fvec3) Load 106
|
||||||
|
108: 39(float) Load 51(tMax)
|
||||||
|
RayQueryInitializeKHR 66(localRayQuery) 79 81 82 103 104 107 108
|
||||||
|
113: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 114 114 12 12
|
||||||
|
112: 109(bool) RayQueryProceedKHR 66(localRayQuery)
|
||||||
|
115: 109(bool) LogicalNot 112
|
||||||
|
SelectionMerge 117 None
|
||||||
|
BranchConditional 115 116 117
|
||||||
|
116: Label
|
||||||
|
118: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17
|
||||||
|
119: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 120 120 12 12
|
||||||
|
RayQueryTerminateKHR 66(localRayQuery)
|
||||||
|
Branch 117
|
||||||
|
117: Label
|
||||||
|
121: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17
|
||||||
|
Return
|
||||||
|
FunctionEnd
|
||||||
23
Test/spv.debuginfo.rt_types.glsl.rgen
Normal file
23
Test/spv.debuginfo.rt_types.glsl.rgen
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
#version 460
|
||||||
|
#extension GL_NV_ray_tracing : enable
|
||||||
|
#extension GL_EXT_ray_query : enable
|
||||||
|
layout(binding = 0, set = 0) uniform accelerationStructureEXT acc0;
|
||||||
|
|
||||||
|
layout(shaderRecordNV) buffer block
|
||||||
|
{
|
||||||
|
vec3 dir;
|
||||||
|
vec3 origin;
|
||||||
|
};
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
rayQueryEXT localRayQuery;
|
||||||
|
uint rayFlags = gl_RayFlagsOpaqueEXT | gl_RayFlagsSkipClosestHitShaderEXT;
|
||||||
|
float tMin = 0.f;
|
||||||
|
float tMax = 1000.f;
|
||||||
|
rayQueryInitializeEXT(localRayQuery, acc0, rayFlags, 0xFF , origin, tMin, dir, tMax);
|
||||||
|
if (!rayQueryProceedEXT(localRayQuery))
|
||||||
|
{
|
||||||
|
rayQueryTerminateEXT(localRayQuery);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -946,6 +946,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||||
"spv.debuginfo.bufferref.glsl.frag",
|
"spv.debuginfo.bufferref.glsl.frag",
|
||||||
"spv.debuginfo.const_params.glsl.comp",
|
"spv.debuginfo.const_params.glsl.comp",
|
||||||
"spv.debuginfo.scalar_types.glsl.frag",
|
"spv.debuginfo.scalar_types.glsl.frag",
|
||||||
|
"spv.debuginfo.rt_types.glsl.rgen",
|
||||||
})),
|
})),
|
||||||
FileNameAsCustomTestSuffix
|
FileNameAsCustomTestSuffix
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue