Add correct line number to OpDebugFunction and OpDebugScope for function:

1. Pull OpDebugFunction, OpDebugScope and OpDebugVariable for params out
   of makeFunctionEntry.
2. Put above in a separate function called setupDebugFunctionEntry,
   which also accept line number and set it correctly in builder.
3. Call setupDebugFunctionEntry in makeFunction. Also special case
   handle entry function since it's created ealier elsewhere.
This commit is contained in:
Chao Chen 2023-10-12 05:42:55 +01:00
parent a2fb1ba2ad
commit 979423d84f
19 changed files with 9076 additions and 9016 deletions

View file

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