Force generateDebugInfo when non-semantic debug info is enabled

From the command line, the debug options "stack", with -gVS enabling all
of generateDebugInfo, emitNonSemanticShaderDebugInfo and
emitNonSemanticShaderDebugSource, however the programmatic interface
allows setting the latter options without the former. In this case, the
string corresponding to the source filename never gets emitted and some
debuginfo instructions end up with zero ID operands, resulting in
invalid SPIR-V.

Fixes #3240
This commit is contained in:
Arcady Goldmints-Orlov 2023-06-22 16:06:41 -04:00 committed by arcady-lunarg
parent 9575e33186
commit d89c0b1d13
14 changed files with 9392 additions and 8284 deletions

View file

@ -1,84 +1,96 @@
spv.debuginfo.const_params.glsl.comp
Validation failed
// Module Version 10000
// Generated by (magic number): 8000b
// Id's are bound by 64
// Id's are bound by 68
Capability Shader
Extension "SPV_KHR_non_semantic_info"
1: ExtInstImport "NonSemantic.Shader.DebugInfo.100"
2: ExtInstImport "GLSL.std.450"
2: ExtInstImport "NonSemantic.Shader.DebugInfo.100"
3: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint GLCompute 13 "main"
ExecutionMode 13 LocalSize 1 1 1
8: String "uint"
14: String "main"
17: String ""
24: String "float"
39: String "function"
45: String "f"
49: String "f2"
52: String "f3"
55: String "f4"
Name 13 "main"
Name 38 "function(f1;vf2;vf3;vf4;"
Name 34 "f"
Name 35 "f2"
Name 36 "f3"
Name 37 "f4"
3: TypeVoid
4: TypeFunction 3
6: TypeInt 32 0
9: 6(int) Constant 32
10: 6(int) Constant 6
11: 6(int) Constant 0
7: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 8 9 10 11
12: 6(int) Constant 3
5: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(DebugTypeFunction) 12 3
16: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 35(DebugSource) 0 17
19: 6(int) Constant 1
20: 6(int) Constant 4
21: 6(int) Constant 2
18: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(DebugCompilationUnit) 19 20 16 21
15: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 14 5 16 11 11 18 14 12 11
23: TypeFloat 32
25: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 24 9 12 11
26: TypeVector 23(float) 2
27: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 25 21
28: TypeVector 23(float) 3
29: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 25 12
30: TypeVector 23(float) 4
31: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 25 20
32: TypeFunction 3 23(float) 26(fvec2) 28(fvec3) 30(fvec4)
33: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(DebugTypeFunction) 12 3 25 27 29 31
40: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 39 33 16 11 11 18 39 12 11
44: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 45 25 16 11 11 40 20 19
47: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression)
48: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 49 27 16 11 11 40 20 21
51: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 52 29 16 11 11 40 20 12
54: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 55 31 16 11 11 40 20 20
59: 23(float) Constant 0
60: 26(fvec2) ConstantComposite 59 59
61: 28(fvec3) ConstantComposite 59 59 59
62: 30(fvec4) ConstantComposite 59 59 59 59
13(main): 3 Function None 4
22: Label
58: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 15 13(main)
63: 3 FunctionCall 38(function(f1;vf2;vf3;vf4;) 59 60 61 62
EntryPoint GLCompute 14 "main"
ExecutionMode 14 LocalSize 1 1 1
1: String ""
9: String "uint"
15: String "main"
18: 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
"
25: String "float"
40: String "function"
46: String "f"
50: String "f2"
53: String "f3"
56: String "f4"
Name 14 "main"
Name 39 "function(f1;vf2;vf3;vf4;"
Name 35 "f"
Name 36 "f2"
Name 37 "f3"
Name 38 "f4"
4: TypeVoid
5: TypeFunction 4
7: TypeInt 32 0
10: 7(int) Constant 32
11: 7(int) Constant 6
12: 7(int) Constant 0
8: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 9 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
24: TypeFloat 32
26: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 25 10 13 12
27: TypeVector 24(float) 2
28: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 26 22
29: TypeVector 24(float) 3
30: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 26 13
31: TypeVector 24(float) 4
32: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 26 21
33: TypeFunction 4 24(float) 27(fvec2) 29(fvec3) 31(fvec4)
34: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 8(DebugTypeFunction) 13 4 26 28 30 32
41: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 40 34 17 12 12 19 40 13 12
45: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 46 26 17 12 12 41 21 20
48: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression)
49: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 50 28 17 12 12 41 21 22
52: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 53 30 17 12 12 41 21 13
55: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 56 32 17 12 12 41 21 21
62: 7(int) Constant 13
63: 24(float) Constant 0
64: 27(fvec2) ConstantComposite 63 63
65: 29(fvec3) ConstantComposite 63 63 63
66: 31(fvec4) ConstantComposite 63 63 63 63
Line 1 11 11
14(main): 4 Function None 5
23: Label
59: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 16 14(main)
60: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 16
61: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 17 62 62 12 12
67: 4 FunctionCall 39(function(f1;vf2;vf3;vf4;) 63 64 65 66
Return
FunctionEnd
38(function(f1;vf2;vf3;vf4;): 3 Function None 32
34(f): 23(float) FunctionParameter
35(f2): 26(fvec2) FunctionParameter
36(f3): 28(fvec3) FunctionParameter
37(f4): 30(fvec4) FunctionParameter
41: Label
42: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 40
43: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 16 11 11 11 11
46: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 44 34(f) 47
50: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 48 35(f2) 47
53: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 51 36(f3) 47
56: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 54 37(f4) 47
57: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 40 38(function(f1;vf2;vf3;vf4;)
Line 1 7 18
39(function(f1;vf2;vf3;vf4;): 4 Function None 33
35(f): 24(float) FunctionParameter
36(f2): 27(fvec2) FunctionParameter
37(f3): 29(fvec3) FunctionParameter
38(f4): 31(fvec4) FunctionParameter
42: Label
43: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 41
44: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 17 12 12 12 12
47: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 45 35(f) 48
51: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 49 36(f2) 48
54: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 52 37(f3) 48
57: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 55 38(f4) 48
58: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 41 39(function(f1;vf2;vf3;vf4;)
Return
FunctionEnd