Sanitize debug source location tracking for implicit branch and return

This patch tries to attach debug location of a branch/return instruction to its predecessor or the closing brace. If none could be found, no debug info should be emitted.
This commit is contained in:
Qingyuan Zheng 2024-08-26 03:53:07 +00:00 committed by arcady-lunarg
parent b1fac200c4
commit a496a34b43
30 changed files with 4713 additions and 4253 deletions

View file

@ -1,14 +1,14 @@
spv.debuginfo.include.glsl.frag
// Module Version 10000
// Generated by (magic number): 8000b
// Id's are bound by 108
// Id's are bound by 112
Capability Shader
Extension "SPV_KHR_non_semantic_info"
1: ExtInstImport "NonSemantic.Shader.DebugInfo.100"
4: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 15 "main" 80
EntryPoint Fragment 15 "main" 82
ExecutionMode 15 OriginUpperLeft
2: String "spv.debuginfo.include.glsl.frag"
3: String "spv.debuginfo.include.glsl.h"
@ -48,11 +48,11 @@ void main() {
50: String "mainFileFunction"
53: String "v"
57: String "main"
82: String "headerOut"
86: String "headerUboItem"
89: String "UBO"
94: String ""
96: String "int"
84: String "headerOut"
88: String "headerUboItem"
91: String "UBO"
96: String ""
98: String "int"
SourceExtension "GL_GOOGLE_cpp_style_line_directive"
SourceExtension "GL_GOOGLE_include_directive"
Name 15 "main"
@ -60,17 +60,17 @@ void main() {
Name 28 "a"
Name 48 "mainFileFunction(vf4;"
Name 47 "v"
Name 80 "headerOut"
Name 84 "UBO"
MemberName 84(UBO) 0 "headerUboItem"
Name 92 ""
Name 99 "param"
Name 106 "param"
Decorate 80(headerOut) Location 0
Decorate 84(UBO) Block
MemberDecorate 84(UBO) 0 Offset 0
Decorate 92 Binding 0
Decorate 92 DescriptorSet 0
Name 82 "headerOut"
Name 86 "UBO"
MemberName 86(UBO) 0 "headerUboItem"
Name 94 ""
Name 101 "param"
Name 108 "param"
Decorate 82(headerOut) Location 0
Decorate 86(UBO) Block
MemberDecorate 86(UBO) 0 Offset 0
Decorate 94 Binding 0
Decorate 94 DescriptorSet 0
5: TypeVoid
6: TypeFunction 5
8: TypeInt 32 0
@ -104,39 +104,41 @@ void main() {
59: 8(int) Constant 10
58: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 57 7 38 59 13 36 57 14 59
63: 8(int) Constant 9
78: TypePointer Output 20(fvec4)
79: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 22 14 13
80(headerOut): 78(ptr) Variable Output
83: 8(int) Constant 11
81: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 82 22 38 83 13 36 82 80(headerOut) 35
84(UBO): TypeStruct 20(fvec4)
87: 8(int) Constant 5
85: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 86 22 38 87 24 13 13 14
88: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 89 37 38 83 13 36 89 13 14 85
90: TypePointer Uniform 84(UBO)
91: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 88 40 13
92: 90(ptr) Variable Uniform
93: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 94 88 38 83 13 36 94 92 35
95: TypeInt 32 1
97: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 96 11 21 13
98: 95(int) Constant 0
100: TypePointer Uniform 20(fvec4)
101: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 22 40 13
80: TypePointer Output 20(fvec4)
81: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 22 14 13
82(headerOut): 80(ptr) Variable Output
85: 8(int) Constant 11
83: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 84 22 38 85 13 36 84 82(headerOut) 35
86(UBO): TypeStruct 20(fvec4)
89: 8(int) Constant 5
87: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 88 22 38 89 24 13 13 14
90: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 91 37 38 85 13 36 91 13 14 87
92: TypePointer Uniform 86(UBO)
93: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 90 40 13
94: 92(ptr) Variable Uniform
95: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 96 90 38 85 13 36 96 94 35
97: TypeInt 32 1
99: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 98 11 21 13
100: 97(int) Constant 0
102: TypePointer Uniform 20(fvec4)
103: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 22 40 13
111: 8(int) Constant 12
15(main): 5 Function None 6
16: Label
99(param): 23(ptr) Variable Function
106(param): 23(ptr) Variable Function
76: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 58
77: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 38 59 59 13 13
75: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 58 15(main)
103: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 38 83 83 13 13
102: 100(ptr) AccessChain 92 98
104: 20(fvec4) Load 102
Store 99(param) 104
105: 20(fvec4) FunctionCall 48(mainFileFunction(vf4;) 99(param)
Store 106(param) 105
107: 20(fvec4) FunctionCall 29(headerFunction(vf4;) 106(param)
Store 80(headerOut) 107
101(param): 23(ptr) Variable Function
108(param): 23(ptr) Variable Function
78: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 58
79: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 38 59 59 13 13
77: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 58 15(main)
105: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 38 85 85 13 13
104: 102(ptr) AccessChain 94 100
106: 20(fvec4) Load 104
Store 101(param) 106
107: 20(fvec4) FunctionCall 48(mainFileFunction(vf4;) 101(param)
Store 108(param) 107
109: 20(fvec4) FunctionCall 29(headerFunction(vf4;) 108(param)
Store 82(headerOut) 109
110: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 38 111 111 13 13
Return
FunctionEnd
29(headerFunction(vf4;): 20(fvec4) Function None 26
@ -157,9 +159,9 @@ void main() {
55: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 51
56: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 38 12 12 13 13
54: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 52 47(v) 44
68: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 51 48(mainFileFunction(vf4;)
70: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 38 24 24 13 13
69: 20(fvec4) Load 47(v)
71: 20(fvec4) FNegate 69
ReturnValue 71
69: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 51 48(mainFileFunction(vf4;)
71: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 38 24 24 13 13
70: 20(fvec4) Load 47(v)
72: 20(fvec4) FNegate 70
ReturnValue 72
FunctionEnd