Clean up the debug line info tracking and generation.

- Correctly populate the field `currentFileId` with the presence of include directive
- Support lazy OpLine/OpDebugLine generation only when a real instruction is added instead of a debug location is set
- Improve the debug location tracking to per-block instead of just per-builder
- A few bug fixes related to debug source info
This commit is contained in:
Qingyuan Zheng 2024-02-09 10:27:40 -08:00 committed by GitHub
parent b1f7affe94
commit 30661abd9c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 8844 additions and 8834 deletions

View file

@ -1,19 +1,19 @@
spv.debuginfo.bufferref.glsl.frag
// Module Version 10000
// Generated by (magic number): 8000b
// Id's are bound by 143
// Id's are bound by 142
Capability Shader
Capability PhysicalStorageBufferAddressesEXT
Extension "SPV_KHR_non_semantic_info"
Extension "SPV_KHR_physical_storage_buffer"
Extension "SPV_KHR_storage_buffer_storage_class"
2: ExtInstImport "NonSemantic.Shader.DebugInfo.100"
1: ExtInstImport "NonSemantic.Shader.DebugInfo.100"
3: ExtInstImport "GLSL.std.450"
MemoryModel PhysicalStorageBuffer64EXT GLSL450
EntryPoint Fragment 14 "main" 75 134
EntryPoint Fragment 14 "main" 76 131
ExecutionMode 14 OriginUpperLeft
1: String ""
2: String ""
8: String "uint"
16: String "main"
19: String "// OpModuleProcessed auto-map-locations
@ -24,45 +24,45 @@ spv.debuginfo.bufferref.glsl.frag
// OpModuleProcessed entry-point main
#line 1
"
32: String "Mesh"
31: String "Mesh"
34: String "float"
40: String "data"
44: String "MeshVertexPositions"
50: String "meshData"
62: String "PerPass_meshes"
68: String "perPass_meshes"
70: String "int"
77: String "tri_idx0"
95: String "vertex_pos0"
136: String "out_fragColor"
63: String "PerPass_meshes"
69: String "perPass_meshes"
71: String "int"
78: String "tri_idx0"
94: String "vertex_pos0"
133: String "out_fragColor"
SourceExtension "GL_EXT_buffer_reference"
Name 14 "main"
Name 30 "Mesh"
MemberName 30(Mesh) 0 "positions"
Name 29 "Mesh"
MemberName 29(Mesh) 0 "positions"
Name 38 "MeshVertexPositions"
MemberName 38(MeshVertexPositions) 0 "data"
Name 48 "meshData"
Name 53 "Mesh"
MemberName 53(Mesh) 0 "positions"
Name 57 "PerPass_meshes"
MemberName 57(PerPass_meshes) 0 "data"
Name 66 "perPass_meshes"
Name 75 "tri_idx0"
Name 93 "vertex_pos0"
Name 134 "out_fragColor"
Name 54 "Mesh"
MemberName 54(Mesh) 0 "positions"
Name 58 "PerPass_meshes"
MemberName 58(PerPass_meshes) 0 "data"
Name 67 "perPass_meshes"
Name 76 "tri_idx0"
Name 92 "vertex_pos0"
Name 131 "out_fragColor"
Decorate 36 ArrayStride 4
MemberDecorate 38(MeshVertexPositions) 0 Offset 0
Decorate 38(MeshVertexPositions) Block
MemberDecorate 53(Mesh) 0 Offset 0
Decorate 55 ArrayStride 8
MemberDecorate 57(PerPass_meshes) 0 NonWritable
MemberDecorate 57(PerPass_meshes) 0 Offset 0
Decorate 57(PerPass_meshes) Block
Decorate 66(perPass_meshes) DescriptorSet 0
Decorate 66(perPass_meshes) Binding 0
Decorate 75(tri_idx0) Flat
Decorate 75(tri_idx0) Location 0
Decorate 134(out_fragColor) Location 0
MemberDecorate 54(Mesh) 0 Offset 0
Decorate 56 ArrayStride 8
MemberDecorate 58(PerPass_meshes) 0 NonWritable
MemberDecorate 58(PerPass_meshes) 0 Offset 0
Decorate 58(PerPass_meshes) Block
Decorate 67(perPass_meshes) DescriptorSet 0
Decorate 67(perPass_meshes) Binding 0
Decorate 76(tri_idx0) Flat
Decorate 76(tri_idx0) Location 0
Decorate 131(out_fragColor) Location 0
Decorate 48(meshData) DecorationAliasedPointerEXT
4: TypeVoid
5: TypeFunction 4
@ -70,129 +70,127 @@ spv.debuginfo.bufferref.glsl.frag
10: 7(int) Constant 32
11: 7(int) Constant 6
12: 7(int) Constant 0
9: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 8 10 11 12
9: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 8 10 11 12
13: 7(int) Constant 3
6: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 8(DebugTypeFunction) 13 4
18: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 35(DebugSource) 1 19
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 20
22: 7(int) Constant 1
23: 7(int) Constant 4
24: 7(int) Constant 2
21: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 1(DebugCompilationUnit) 22 23 18 24
17: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 16 6 18 20 12 21 16 13 20
28: 7(int) Constant 21
TypeForwardPointer 29 PhysicalStorageBufferEXT
30(Mesh): TypeStruct 29
31: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 32 22 18 28 12 21 32 12 13
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
TypeForwardPointer 28 PhysicalStorageBufferEXT
29(Mesh): TypeStruct 28
32: 7(int) Constant 21
30: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 31 22 18 32 12 21 31 12 13
33: TypeFloat 32
35: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 34 10 13 12
35: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 34 10 13 12
36: TypeRuntimeArray 33(float)
37: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 35 12
37: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 35 12
38(MeshVertexPositions): TypeStruct 36
41: 7(int) Constant 5
42: 7(int) Constant 9
39: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 40 37 18 41 42 12 12 13
43: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 44 22 18 28 12 21 44 12 13 39
29: TypePointer PhysicalStorageBufferEXT 38(MeshVertexPositions)
45: TypePointer Function 30(Mesh)
39: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 40 37 18 41 42 12 12 13
43: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 44 22 18 32 12 21 44 12 13 39
28: TypePointer PhysicalStorageBufferEXT 38(MeshVertexPositions)
45: TypePointer Function 29(Mesh)
46: 7(int) Constant 7
47: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 31 46 12
49: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 50 31 18 28 12 17 23
52: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression)
53(Mesh): TypeStruct 29(ptr)
54: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 32 22 18 28 12 21 32 12 13
55: TypeRuntimeArray 53(Mesh)
56: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 54 12
57(PerPass_meshes): TypeStruct 55
59: 7(int) Constant 13
60: 7(int) Constant 8
58: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 40 56 18 59 60 12 12 13
61: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 62 22 18 28 12 21 62 12 13 58
63: TypePointer StorageBuffer 57(PerPass_meshes)
64: 7(int) Constant 12
65: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 61 64 12
66(perPass_meshes): 63(ptr) Variable StorageBuffer
67: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 68 61 18 28 12 21 68 66(perPass_meshes) 60
69: TypeInt 32 1
71: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 70 10 23 12
72: 69(int) Constant 0
73: TypePointer Input 7(int)
74: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 9 22 12
75(tri_idx0): 73(ptr) Variable Input
76: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 77 9 18 28 12 21 77 75(tri_idx0) 60
79: TypePointer StorageBuffer 53(Mesh)
80: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 54 64 12
84: TypePointer Function 29(ptr)
85: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 0(DebugInfoNone)
88: 7(int) Constant 23
89: TypeVector 33(float) 3
90: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 35 13
91: TypePointer Function 89(fvec3)
92: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 90 46 12
94: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 95 90 18 88 12 17 23
98: 7(int) Constant 25
104: TypePointer PhysicalStorageBufferEXT 33(float)
105: 7(int) Constant 5349
106: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 35 105 12
110: 7(int) Constant 24
129: 7(int) Constant 27
130: TypeVector 33(float) 4
131: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 35 23
132: TypePointer Output 130(fvec4)
133: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 131 13 12
134(out_fragColor): 132(ptr) Variable Output
135: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 136 131 18 129 12 21 136 134(out_fragColor) 60
138: 33(float) Constant 1065353216
Line 1 20 11
47: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 30 46 12
49: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 50 30 18 32 12 17 23
52: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression)
54(Mesh): TypeStruct 28(ptr)
55: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 31 22 18 32 12 21 31 12 13
56: TypeRuntimeArray 54(Mesh)
57: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 55 12
58(PerPass_meshes): TypeStruct 56
60: 7(int) Constant 13
61: 7(int) Constant 8
59: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 40 57 18 60 61 12 12 13
62: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 63 22 18 32 12 21 63 12 13 59
64: TypePointer StorageBuffer 58(PerPass_meshes)
65: 7(int) Constant 12
66: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 62 65 12
67(perPass_meshes): 64(ptr) Variable StorageBuffer
68: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 69 62 18 32 12 21 69 67(perPass_meshes) 61
70: TypeInt 32 1
72: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 71 10 23 12
73: 70(int) Constant 0
74: TypePointer Input 7(int)
75: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 9 22 12
76(tri_idx0): 74(ptr) Variable Input
77: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 78 9 18 32 12 21 78 76(tri_idx0) 61
80: TypePointer StorageBuffer 54(Mesh)
81: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 55 65 12
85: TypePointer Function 28(ptr)
86: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 0(DebugInfoNone)
88: TypeVector 33(float) 3
89: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 35 13
90: TypePointer Function 88(fvec3)
91: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 89 46 12
95: 7(int) Constant 23
93: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 94 89 18 95 12 17 23
102: TypePointer PhysicalStorageBufferEXT 33(float)
103: 7(int) Constant 5349
104: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 35 103 12
109: 7(int) Constant 24
118: 7(int) Constant 25
127: TypeVector 33(float) 4
128: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 35 23
129: TypePointer Output 127(fvec4)
130: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 128 13 12
131(out_fragColor): 129(ptr) Variable Output
134: 7(int) Constant 27
132: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 133 128 18 134 12 21 133 131(out_fragColor) 61
137: 33(float) Constant 1065353216
14(main): 4 Function None 5
15: Label
48(meshData): 45(ptr) Variable Function
93(vertex_pos0): 91(ptr) Variable Function
25: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 17 14(main)
26: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17
27: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 28 28 12 12
51: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 49 48(meshData) 52
78: 7(int) Load 75(tri_idx0)
81: 79(ptr) AccessChain 66(perPass_meshes) 72 78
82: 53(Mesh) Load 81
83: 29(ptr) CompositeExtract 82 0
86: 84(ptr) AccessChain 48(meshData) 72
Store 86 83
87: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 88 88 12 12
96: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 94 93(vertex_pos0) 52
97: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 98 98 12 12
99: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 88 88 12 12
100: 84(ptr) AccessChain 48(meshData) 72
101: 29(ptr) Load 100
102: 7(int) Load 75(tri_idx0)
103: 7(int) IMul 13 102
107: 104(ptr) AccessChain 101 72 103
108: 33(float) Load 107 Aligned 4
109: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 110 110 12 12
111: 84(ptr) AccessChain 48(meshData) 72
112: 29(ptr) Load 111
113: 7(int) Load 75(tri_idx0)
114: 7(int) IMul 13 113
115: 7(int) IAdd 114 22
116: 104(ptr) AccessChain 112 72 115
117: 33(float) Load 116 Aligned 4
118: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 98 98 12 12
119: 84(ptr) AccessChain 48(meshData) 72
120: 29(ptr) Load 119
121: 7(int) Load 75(tri_idx0)
122: 7(int) IMul 13 121
123: 7(int) IAdd 122 24
124: 104(ptr) AccessChain 120 72 123
125: 33(float) Load 124 Aligned 4
126: 89(fvec3) CompositeConstruct 108 117 125
127: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 88 88 12 12
Store 93(vertex_pos0) 126
128: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 129 129 12 12
137: 89(fvec3) Load 93(vertex_pos0)
139: 33(float) CompositeExtract 137 0
140: 33(float) CompositeExtract 137 1
141: 33(float) CompositeExtract 137 2
142: 130(fvec4) CompositeConstruct 139 140 141 138
Store 134(out_fragColor) 142
92(vertex_pos0): 90(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)
53: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 32 32 12 12
51: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 49 48(meshData) 52
79: 7(int) Load 76(tri_idx0)
82: 80(ptr) AccessChain 67(perPass_meshes) 73 79
83: 54(Mesh) Load 82
84: 28(ptr) CompositeExtract 83 0
87: 85(ptr) AccessChain 48(meshData) 73
Store 87 84
97: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 95 95 12 12
96: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 93 92(vertex_pos0) 52
98: 85(ptr) AccessChain 48(meshData) 73
99: 28(ptr) Load 98
100: 7(int) Load 76(tri_idx0)
101: 7(int) IMul 13 100
105: 102(ptr) AccessChain 99 73 101
106: 33(float) Load 105 Aligned 4
108: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 109 109 12 12
107: 85(ptr) AccessChain 48(meshData) 73
110: 28(ptr) Load 107
111: 7(int) Load 76(tri_idx0)
112: 7(int) IMul 13 111
113: 7(int) IAdd 112 22
114: 102(ptr) AccessChain 110 73 113
115: 33(float) Load 114 Aligned 4
117: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 118 118 12 12
116: 85(ptr) AccessChain 48(meshData) 73
119: 28(ptr) Load 116
120: 7(int) Load 76(tri_idx0)
121: 7(int) IMul 13 120
122: 7(int) IAdd 121 24
123: 102(ptr) AccessChain 119 73 122
124: 33(float) Load 123 Aligned 4
125: 88(fvec3) CompositeConstruct 106 115 124
126: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 95 95 12 12
Store 92(vertex_pos0) 125
136: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 134 134 12 12
135: 88(fvec3) Load 92(vertex_pos0)
138: 33(float) CompositeExtract 135 0
139: 33(float) CompositeExtract 135 1
140: 33(float) CompositeExtract 135 2
141: 127(fvec4) CompositeConstruct 138 139 140 137
Store 131(out_fragColor) 141
Return
FunctionEnd