Add includer to gtest for include file tests.
Turn on debug info flag for non-semantic debug test.
This commit is contained in:
parent
a92c61f845
commit
d8f5681ec0
9 changed files with 338 additions and 552 deletions
|
|
@ -1,422 +0,0 @@
|
||||||
spv.debugInfo.frag
|
|
||||||
// Module Version 10300
|
|
||||||
// Generated by (magic number): 8000b
|
|
||||||
// Id's are bound by 187
|
|
||||||
|
|
||||||
Capability Shader
|
|
||||||
2: ExtInstImport "GLSL.std.450"
|
|
||||||
MemoryModel Logical GLSL450
|
|
||||||
EntryPoint Fragment 5 "main" 30 104
|
|
||||||
ExecutionMode 5 OriginUpperLeft
|
|
||||||
1: String "spv.debugInfo.frag"
|
|
||||||
Source GLSL 450 1 "#version 450
|
|
||||||
|
|
||||||
struct S {
|
|
||||||
int a;
|
|
||||||
};
|
|
||||||
|
|
||||||
uniform ubuf {
|
|
||||||
S s;
|
|
||||||
};
|
|
||||||
|
|
||||||
uniform sampler2D s2d;
|
|
||||||
|
|
||||||
layout(location = 0) in vec4 inv;
|
|
||||||
layout(location = 0) out vec4 outv;
|
|
||||||
|
|
||||||
vec4 foo(S s)
|
|
||||||
{
|
|
||||||
vec4 r = s.a * inv;
|
|
||||||
++r;
|
|
||||||
if (r.x > 3.0)
|
|
||||||
--r;
|
|
||||||
else
|
|
||||||
r *= 2;
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
float testBranch(float x, float y)
|
|
||||||
{
|
|
||||||
float result = 0;
|
|
||||||
bool b = x > 0;
|
|
||||||
|
|
||||||
// branch with load
|
|
||||||
if (b) {
|
|
||||||
result += 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
result -= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// branch with expression
|
|
||||||
if (x > y) {
|
|
||||||
result += x - y;
|
|
||||||
}
|
|
||||||
|
|
||||||
// selection with load
|
|
||||||
result += b ?
|
|
||||||
1 : -1;
|
|
||||||
|
|
||||||
// selection with expression
|
|
||||||
result += x < y ?
|
|
||||||
y :
|
|
||||||
float(b);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
outv = foo(s);
|
|
||||||
outv += testBranch(inv.x, inv.y);
|
|
||||||
outv += texture(s2d, vec2(0.5));
|
|
||||||
|
|
||||||
switch (s.a) {
|
|
||||||
case 10:
|
|
||||||
++outv;
|
|
||||||
break;
|
|
||||||
case 20:
|
|
||||||
outv = 2 * outv;
|
|
||||||
++outv;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
--outv;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < 10; ++i)
|
|
||||||
outv *= 3.0;
|
|
||||||
|
|
||||||
outv.x < 10.0 ?
|
|
||||||
outv = sin(outv) :
|
|
||||||
outv = cos(outv);
|
|
||||||
}"
|
|
||||||
Name 5 "main"
|
|
||||||
Name 8 "S"
|
|
||||||
MemberName 8(S) 0 "a"
|
|
||||||
Name 14 "foo(struct-S-i11;"
|
|
||||||
Name 13 "s"
|
|
||||||
Name 20 "testBranch(f1;f1;"
|
|
||||||
Name 18 "x"
|
|
||||||
Name 19 "y"
|
|
||||||
Name 23 "r"
|
|
||||||
Name 30 "inv"
|
|
||||||
Name 56 "result"
|
|
||||||
Name 59 "b"
|
|
||||||
Name 104 "outv"
|
|
||||||
Name 105 "S"
|
|
||||||
MemberName 105(S) 0 "a"
|
|
||||||
Name 106 "ubuf"
|
|
||||||
MemberName 106(ubuf) 0 "s"
|
|
||||||
Name 108 ""
|
|
||||||
Name 109 "param"
|
|
||||||
Name 116 "param"
|
|
||||||
Name 120 "param"
|
|
||||||
Name 131 "s2d"
|
|
||||||
Name 161 "i"
|
|
||||||
ModuleProcessed "no-storage-format"
|
|
||||||
ModuleProcessed "resource-set-binding 3"
|
|
||||||
ModuleProcessed "auto-map-bindings"
|
|
||||||
ModuleProcessed "auto-map-locations"
|
|
||||||
ModuleProcessed "client vulkan100"
|
|
||||||
ModuleProcessed "target-env spirv1.3"
|
|
||||||
ModuleProcessed "target-env vulkan1.1"
|
|
||||||
ModuleProcessed "relaxed-errors"
|
|
||||||
ModuleProcessed "suppress-warnings"
|
|
||||||
ModuleProcessed "hlsl-offsets"
|
|
||||||
ModuleProcessed "entry-point main"
|
|
||||||
Decorate 30(inv) Location 0
|
|
||||||
Decorate 104(outv) Location 0
|
|
||||||
MemberDecorate 105(S) 0 Offset 0
|
|
||||||
MemberDecorate 106(ubuf) 0 Offset 0
|
|
||||||
Decorate 106(ubuf) Block
|
|
||||||
Decorate 108 DescriptorSet 3
|
|
||||||
Decorate 108 Binding 0
|
|
||||||
Decorate 131(s2d) DescriptorSet 3
|
|
||||||
Decorate 131(s2d) Binding 1
|
|
||||||
3: TypeVoid
|
|
||||||
4: TypeFunction 3
|
|
||||||
7: TypeInt 32 1
|
|
||||||
8(S): TypeStruct 7(int)
|
|
||||||
9: TypePointer Function 8(S)
|
|
||||||
10: TypeFloat 32
|
|
||||||
11: TypeVector 10(float) 4
|
|
||||||
12: TypeFunction 11(fvec4) 9(ptr)
|
|
||||||
16: TypePointer Function 10(float)
|
|
||||||
17: TypeFunction 10(float) 16(ptr) 16(ptr)
|
|
||||||
22: TypePointer Function 11(fvec4)
|
|
||||||
24: 7(int) Constant 0
|
|
||||||
25: TypePointer Function 7(int)
|
|
||||||
29: TypePointer Input 11(fvec4)
|
|
||||||
30(inv): 29(ptr) Variable Input
|
|
||||||
34: 10(float) Constant 1065353216
|
|
||||||
37: TypeInt 32 0
|
|
||||||
38: 37(int) Constant 0
|
|
||||||
41: 10(float) Constant 1077936128
|
|
||||||
42: TypeBool
|
|
||||||
50: 10(float) Constant 1073741824
|
|
||||||
57: 10(float) Constant 0
|
|
||||||
58: TypePointer Function 42(bool)
|
|
||||||
81: 7(int) Constant 1
|
|
||||||
82: 7(int) Constant 4294967295
|
|
||||||
103: TypePointer Output 11(fvec4)
|
|
||||||
104(outv): 103(ptr) Variable Output
|
|
||||||
105(S): TypeStruct 7(int)
|
|
||||||
106(ubuf): TypeStruct 105(S)
|
|
||||||
107: TypePointer Uniform 106(ubuf)
|
|
||||||
108: 107(ptr) Variable Uniform
|
|
||||||
110: TypePointer Uniform 105(S)
|
|
||||||
117: TypePointer Input 10(float)
|
|
||||||
121: 37(int) Constant 1
|
|
||||||
128: TypeImage 10(float) 2D sampled format:Unknown
|
|
||||||
129: TypeSampledImage 128
|
|
||||||
130: TypePointer UniformConstant 129
|
|
||||||
131(s2d): 130(ptr) Variable UniformConstant
|
|
||||||
133: TypeVector 10(float) 2
|
|
||||||
134: 10(float) Constant 1056964608
|
|
||||||
135: 133(fvec2) ConstantComposite 134 134
|
|
||||||
139: TypePointer Uniform 7(int)
|
|
||||||
168: 7(int) Constant 10
|
|
||||||
174: TypePointer Output 10(float)
|
|
||||||
177: 10(float) Constant 1092616192
|
|
||||||
Line 1 58 11
|
|
||||||
5(main): 3 Function None 4
|
|
||||||
6: Label
|
|
||||||
109(param): 9(ptr) Variable Function
|
|
||||||
116(param): 16(ptr) Variable Function
|
|
||||||
120(param): 16(ptr) Variable Function
|
|
||||||
161(i): 25(ptr) Variable Function
|
|
||||||
179: 22(ptr) Variable Function
|
|
||||||
Line 1 60 0
|
|
||||||
111: 110(ptr) AccessChain 108 24
|
|
||||||
112: 105(S) Load 111
|
|
||||||
113: 7(int) CompositeExtract 112 0
|
|
||||||
114: 25(ptr) AccessChain 109(param) 24
|
|
||||||
Store 114 113
|
|
||||||
115: 11(fvec4) FunctionCall 14(foo(struct-S-i11;) 109(param)
|
|
||||||
Store 104(outv) 115
|
|
||||||
Line 1 61 0
|
|
||||||
118: 117(ptr) AccessChain 30(inv) 38
|
|
||||||
119: 10(float) Load 118
|
|
||||||
Store 116(param) 119
|
|
||||||
122: 117(ptr) AccessChain 30(inv) 121
|
|
||||||
123: 10(float) Load 122
|
|
||||||
Store 120(param) 123
|
|
||||||
124: 10(float) FunctionCall 20(testBranch(f1;f1;) 116(param) 120(param)
|
|
||||||
125: 11(fvec4) Load 104(outv)
|
|
||||||
126: 11(fvec4) CompositeConstruct 124 124 124 124
|
|
||||||
127: 11(fvec4) FAdd 125 126
|
|
||||||
Store 104(outv) 127
|
|
||||||
Line 1 62 0
|
|
||||||
132: 129 Load 131(s2d)
|
|
||||||
136: 11(fvec4) ImageSampleImplicitLod 132 135
|
|
||||||
137: 11(fvec4) Load 104(outv)
|
|
||||||
138: 11(fvec4) FAdd 137 136
|
|
||||||
Store 104(outv) 138
|
|
||||||
Line 1 64 0
|
|
||||||
140: 139(ptr) AccessChain 108 24 24
|
|
||||||
141: 7(int) Load 140
|
|
||||||
SelectionMerge 145 None
|
|
||||||
Switch 141 144
|
|
||||||
case 10: 142
|
|
||||||
case 20: 143
|
|
||||||
144: Label
|
|
||||||
Line 1 73 0
|
|
||||||
156: 11(fvec4) Load 104(outv)
|
|
||||||
157: 11(fvec4) CompositeConstruct 34 34 34 34
|
|
||||||
158: 11(fvec4) FSub 156 157
|
|
||||||
Store 104(outv) 158
|
|
||||||
Line 1 74 0
|
|
||||||
Branch 145
|
|
||||||
142: Label
|
|
||||||
Line 1 66 0
|
|
||||||
146: 11(fvec4) Load 104(outv)
|
|
||||||
147: 11(fvec4) CompositeConstruct 34 34 34 34
|
|
||||||
148: 11(fvec4) FAdd 146 147
|
|
||||||
Store 104(outv) 148
|
|
||||||
Line 1 67 0
|
|
||||||
Branch 145
|
|
||||||
143: Label
|
|
||||||
Line 1 69 0
|
|
||||||
150: 11(fvec4) Load 104(outv)
|
|
||||||
151: 11(fvec4) VectorTimesScalar 150 50
|
|
||||||
Store 104(outv) 151
|
|
||||||
Line 1 70 0
|
|
||||||
152: 11(fvec4) Load 104(outv)
|
|
||||||
153: 11(fvec4) CompositeConstruct 34 34 34 34
|
|
||||||
154: 11(fvec4) FAdd 152 153
|
|
||||||
Store 104(outv) 154
|
|
||||||
Line 1 71 0
|
|
||||||
Branch 145
|
|
||||||
145: Label
|
|
||||||
Line 1 77 0
|
|
||||||
Store 161(i) 24
|
|
||||||
Branch 162
|
|
||||||
162: Label
|
|
||||||
Line 1 77 0
|
|
||||||
LoopMerge 164 165 None
|
|
||||||
Branch 166
|
|
||||||
166: Label
|
|
||||||
Line 1 77 0
|
|
||||||
167: 7(int) Load 161(i)
|
|
||||||
169: 42(bool) SLessThan 167 168
|
|
||||||
BranchConditional 169 163 164
|
|
||||||
163: Label
|
|
||||||
Line 1 78 0
|
|
||||||
170: 11(fvec4) Load 104(outv)
|
|
||||||
171: 11(fvec4) VectorTimesScalar 170 41
|
|
||||||
Store 104(outv) 171
|
|
||||||
Branch 165
|
|
||||||
165: Label
|
|
||||||
Line 1 77 0
|
|
||||||
172: 7(int) Load 161(i)
|
|
||||||
173: 7(int) IAdd 172 81
|
|
||||||
Store 161(i) 173
|
|
||||||
Branch 162
|
|
||||||
164: Label
|
|
||||||
Line 1 80 0
|
|
||||||
175: 174(ptr) AccessChain 104(outv) 38
|
|
||||||
176: 10(float) Load 175
|
|
||||||
178: 42(bool) FOrdLessThan 176 177
|
|
||||||
SelectionMerge 181 None
|
|
||||||
BranchConditional 178 180 184
|
|
||||||
180: Label
|
|
||||||
Line 1 81 0
|
|
||||||
182: 11(fvec4) Load 104(outv)
|
|
||||||
183: 11(fvec4) ExtInst 2(GLSL.std.450) 13(Sin) 182
|
|
||||||
Store 104(outv) 183
|
|
||||||
Store 179 183
|
|
||||||
Branch 181
|
|
||||||
184: Label
|
|
||||||
Line 1 82 0
|
|
||||||
185: 11(fvec4) Load 104(outv)
|
|
||||||
186: 11(fvec4) ExtInst 2(GLSL.std.450) 14(Cos) 185
|
|
||||||
Store 104(outv) 186
|
|
||||||
Store 179 186
|
|
||||||
Branch 181
|
|
||||||
181: Label
|
|
||||||
Return
|
|
||||||
FunctionEnd
|
|
||||||
Line 1 16 13
|
|
||||||
14(foo(struct-S-i11;): 11(fvec4) Function None 12
|
|
||||||
13(s): 9(ptr) FunctionParameter
|
|
||||||
15: Label
|
|
||||||
23(r): 22(ptr) Variable Function
|
|
||||||
Line 1 18 0
|
|
||||||
26: 25(ptr) AccessChain 13(s) 24
|
|
||||||
27: 7(int) Load 26
|
|
||||||
28: 10(float) ConvertSToF 27
|
|
||||||
31: 11(fvec4) Load 30(inv)
|
|
||||||
32: 11(fvec4) VectorTimesScalar 31 28
|
|
||||||
Store 23(r) 32
|
|
||||||
Line 1 19 0
|
|
||||||
33: 11(fvec4) Load 23(r)
|
|
||||||
35: 11(fvec4) CompositeConstruct 34 34 34 34
|
|
||||||
36: 11(fvec4) FAdd 33 35
|
|
||||||
Store 23(r) 36
|
|
||||||
Line 1 20 0
|
|
||||||
39: 16(ptr) AccessChain 23(r) 38
|
|
||||||
40: 10(float) Load 39
|
|
||||||
43: 42(bool) FOrdGreaterThan 40 41
|
|
||||||
SelectionMerge 45 None
|
|
||||||
BranchConditional 43 44 49
|
|
||||||
44: Label
|
|
||||||
Line 1 21 0
|
|
||||||
46: 11(fvec4) Load 23(r)
|
|
||||||
47: 11(fvec4) CompositeConstruct 34 34 34 34
|
|
||||||
48: 11(fvec4) FSub 46 47
|
|
||||||
Store 23(r) 48
|
|
||||||
Branch 45
|
|
||||||
49: Label
|
|
||||||
Line 1 23 0
|
|
||||||
51: 11(fvec4) Load 23(r)
|
|
||||||
52: 11(fvec4) VectorTimesScalar 51 50
|
|
||||||
Store 23(r) 52
|
|
||||||
Branch 45
|
|
||||||
45: Label
|
|
||||||
Line 1 25 0
|
|
||||||
53: 11(fvec4) Load 23(r)
|
|
||||||
ReturnValue 53
|
|
||||||
FunctionEnd
|
|
||||||
Line 1 28 34
|
|
||||||
20(testBranch(f1;f1;): 10(float) Function None 17
|
|
||||||
18(x): 16(ptr) FunctionParameter
|
|
||||||
19(y): 16(ptr) FunctionParameter
|
|
||||||
21: Label
|
|
||||||
56(result): 16(ptr) Variable Function
|
|
||||||
59(b): 58(ptr) Variable Function
|
|
||||||
90: 16(ptr) Variable Function
|
|
||||||
Line 1 30 0
|
|
||||||
Store 56(result) 57
|
|
||||||
Line 1 31 0
|
|
||||||
60: 10(float) Load 18(x)
|
|
||||||
61: 42(bool) FOrdGreaterThan 60 57
|
|
||||||
Store 59(b) 61
|
|
||||||
Line 1 34 0
|
|
||||||
62: 42(bool) Load 59(b)
|
|
||||||
SelectionMerge 64 None
|
|
||||||
BranchConditional 62 63 67
|
|
||||||
63: Label
|
|
||||||
Line 1 35 0
|
|
||||||
65: 10(float) Load 56(result)
|
|
||||||
66: 10(float) FAdd 65 34
|
|
||||||
Store 56(result) 66
|
|
||||||
Branch 64
|
|
||||||
67: Label
|
|
||||||
Line 1 38 0
|
|
||||||
68: 10(float) Load 56(result)
|
|
||||||
69: 10(float) FSub 68 34
|
|
||||||
Store 56(result) 69
|
|
||||||
Branch 64
|
|
||||||
64: Label
|
|
||||||
Line 1 42 0
|
|
||||||
70: 10(float) Load 18(x)
|
|
||||||
71: 10(float) Load 19(y)
|
|
||||||
72: 42(bool) FOrdGreaterThan 70 71
|
|
||||||
SelectionMerge 74 None
|
|
||||||
BranchConditional 72 73 74
|
|
||||||
73: Label
|
|
||||||
Line 1 43 0
|
|
||||||
75: 10(float) Load 18(x)
|
|
||||||
76: 10(float) Load 19(y)
|
|
||||||
77: 10(float) FSub 75 76
|
|
||||||
78: 10(float) Load 56(result)
|
|
||||||
79: 10(float) FAdd 78 77
|
|
||||||
Store 56(result) 79
|
|
||||||
Branch 74
|
|
||||||
74: Label
|
|
||||||
Line 1 47 0
|
|
||||||
80: 42(bool) Load 59(b)
|
|
||||||
83: 7(int) Select 80 81 82
|
|
||||||
84: 10(float) ConvertSToF 83
|
|
||||||
85: 10(float) Load 56(result)
|
|
||||||
86: 10(float) FAdd 85 84
|
|
||||||
Store 56(result) 86
|
|
||||||
Line 1 51 0
|
|
||||||
87: 10(float) Load 18(x)
|
|
||||||
88: 10(float) Load 19(y)
|
|
||||||
89: 42(bool) FOrdLessThan 87 88
|
|
||||||
SelectionMerge 92 None
|
|
||||||
BranchConditional 89 91 94
|
|
||||||
91: Label
|
|
||||||
Line 1 52 0
|
|
||||||
93: 10(float) Load 19(y)
|
|
||||||
Store 90 93
|
|
||||||
Branch 92
|
|
||||||
94: Label
|
|
||||||
Line 1 53 0
|
|
||||||
95: 42(bool) Load 59(b)
|
|
||||||
96: 10(float) Select 95 34 57
|
|
||||||
Store 90 96
|
|
||||||
Branch 92
|
|
||||||
92: Label
|
|
||||||
97: 10(float) Load 90
|
|
||||||
Line 1 51 0
|
|
||||||
98: 10(float) Load 56(result)
|
|
||||||
99: 10(float) FAdd 98 97
|
|
||||||
Store 56(result) 99
|
|
||||||
Line 1 55 0
|
|
||||||
100: 10(float) Load 56(result)
|
|
||||||
ReturnValue 100
|
|
||||||
FunctionEnd
|
|
||||||
|
|
@ -7,17 +7,13 @@ spv.debugInfo.frag
|
||||||
2: ExtInstImport "GLSL.std.450"
|
2: ExtInstImport "GLSL.std.450"
|
||||||
MemoryModel Logical GLSL450
|
MemoryModel Logical GLSL450
|
||||||
EntryPoint Fragment 5 "main" 30 104
|
EntryPoint Fragment 5 "main" 30 104
|
||||||
ExecutionMode 5 OriginLowerLeft
|
ExecutionMode 5 OriginUpperLeft
|
||||||
1: String "spv.debugInfo.frag"
|
1: String "spv.debugInfo.frag"
|
||||||
Source GLSL 450 1 "// OpModuleProcessed no-storage-format
|
Source GLSL 450 1 "// OpModuleProcessed auto-map-locations
|
||||||
// OpModuleProcessed resource-set-binding 3
|
|
||||||
// OpModuleProcessed auto-map-bindings
|
// OpModuleProcessed auto-map-bindings
|
||||||
// OpModuleProcessed auto-map-locations
|
// OpModuleProcessed client vulkan100
|
||||||
// OpModuleProcessed client opengl100
|
// OpModuleProcessed target-env vulkan1.0
|
||||||
// OpModuleProcessed target-env opengl
|
// OpModuleProcessed keep-uncalled
|
||||||
// OpModuleProcessed relaxed-errors
|
|
||||||
// OpModuleProcessed suppress-warnings
|
|
||||||
// OpModuleProcessed hlsl-offsets
|
|
||||||
// OpModuleProcessed entry-point main
|
// OpModuleProcessed entry-point main
|
||||||
#line 1
|
#line 1
|
||||||
#version 450
|
#version 450
|
||||||
|
|
@ -131,10 +127,9 @@ void main()
|
||||||
MemberDecorate 105(S) 0 Offset 0
|
MemberDecorate 105(S) 0 Offset 0
|
||||||
MemberDecorate 106(ubuf) 0 Offset 0
|
MemberDecorate 106(ubuf) 0 Offset 0
|
||||||
Decorate 106(ubuf) Block
|
Decorate 106(ubuf) Block
|
||||||
Decorate 108 DescriptorSet 3
|
Decorate 108 DescriptorSet 0
|
||||||
Decorate 108 Binding 0
|
Decorate 108 Binding 0
|
||||||
Decorate 131(s2d) Location 0
|
Decorate 131(s2d) DescriptorSet 0
|
||||||
Decorate 131(s2d) DescriptorSet 3
|
|
||||||
Decorate 131(s2d) Binding 1
|
Decorate 131(s2d) Binding 1
|
||||||
3: TypeVoid
|
3: TypeVoid
|
||||||
4: TypeFunction 3
|
4: TypeFunction 3
|
||||||
|
|
|
||||||
166
Test/baseResults/spv.debuginfo.include.glsl.frag.out
Normal file
166
Test/baseResults/spv.debuginfo.include.glsl.frag.out
Normal file
|
|
@ -0,0 +1,166 @@
|
||||||
|
spv.debuginfo.include.glsl.frag
|
||||||
|
// Module Version 10000
|
||||||
|
// Generated by (magic number): 8000b
|
||||||
|
// Id's are bound by 109
|
||||||
|
|
||||||
|
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" 81
|
||||||
|
ExecutionMode 15 OriginUpperLeft
|
||||||
|
2: String "spv.debuginfo.include.glsl.frag"
|
||||||
|
3: String "spv.debuginfo.include.glsl.h"
|
||||||
|
9: String "uint"
|
||||||
|
18: String "float"
|
||||||
|
31: String "headerFunction"
|
||||||
|
34: 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
|
||||||
|
#version 450
|
||||||
|
|
||||||
|
#extension GL_GOOGLE_include_directive : require
|
||||||
|
#include "spv.debuginfo.include.glsl.h"
|
||||||
|
|
||||||
|
vec4 mainFileFunction(vec4 v) {
|
||||||
|
return -v;
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
headerOut = headerFunction(mainFileFunction(headerUboItem));
|
||||||
|
}"
|
||||||
|
40: String "a"
|
||||||
|
48: String "mainFileFunction"
|
||||||
|
51: String "v"
|
||||||
|
54: String "main"
|
||||||
|
60: String "
|
||||||
|
out vec4 headerOut;
|
||||||
|
|
||||||
|
uniform UBO {
|
||||||
|
vec4 headerUboItem;
|
||||||
|
};
|
||||||
|
|
||||||
|
vec4 headerFunction(vec4 a) {
|
||||||
|
return -a;
|
||||||
|
}"
|
||||||
|
83: String "headerOut"
|
||||||
|
87: String "headerUboItem"
|
||||||
|
90: String "UBO"
|
||||||
|
95: String ""
|
||||||
|
97: String "int"
|
||||||
|
SourceExtension "GL_GOOGLE_cpp_style_line_directive"
|
||||||
|
SourceExtension "GL_GOOGLE_include_directive"
|
||||||
|
Name 15 "main"
|
||||||
|
Name 29 "headerFunction(vf4;"
|
||||||
|
Name 28 "a"
|
||||||
|
Name 46 "mainFileFunction(vf4;"
|
||||||
|
Name 45 "v"
|
||||||
|
Name 81 "headerOut"
|
||||||
|
Name 85 "UBO"
|
||||||
|
MemberName 85(UBO) 0 "headerUboItem"
|
||||||
|
Name 93 ""
|
||||||
|
Name 100 "param"
|
||||||
|
Name 107 "param"
|
||||||
|
Decorate 81(headerOut) Location 0
|
||||||
|
MemberDecorate 85(UBO) 0 Offset 0
|
||||||
|
Decorate 85(UBO) Block
|
||||||
|
Decorate 93 DescriptorSet 0
|
||||||
|
Decorate 93 Binding 0
|
||||||
|
5: TypeVoid
|
||||||
|
6: TypeFunction 5
|
||||||
|
8: TypeInt 32 0
|
||||||
|
11: 8(int) Constant 32
|
||||||
|
12: 8(int) Constant 6
|
||||||
|
13: 8(int) Constant 0
|
||||||
|
10: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 9 11 12 13
|
||||||
|
14: 8(int) Constant 3
|
||||||
|
7: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(DebugTypeFunction) 14 5
|
||||||
|
17: TypeFloat 32
|
||||||
|
19: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 18 11 14 13
|
||||||
|
20: TypeVector 17(float) 4
|
||||||
|
21: 8(int) Constant 4
|
||||||
|
22: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 19 21
|
||||||
|
23: TypePointer Function 20(fvec4)
|
||||||
|
24: 8(int) Constant 7
|
||||||
|
25: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 22 24 13
|
||||||
|
26: TypeFunction 20(fvec4) 23(ptr)
|
||||||
|
27: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(DebugTypeFunction) 14 22 22
|
||||||
|
33: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 35(DebugSource) 2 34
|
||||||
|
35: 8(int) Constant 8
|
||||||
|
37: 8(int) Constant 1
|
||||||
|
38: 8(int) Constant 2
|
||||||
|
36: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(DebugCompilationUnit) 37 21 33 38
|
||||||
|
32: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 31 27 33 35 13 36 31 14 35
|
||||||
|
39: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 40 22 33 35 13 32 21 37
|
||||||
|
42: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression)
|
||||||
|
49: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 48 27 33 12 13 36 48 14 12
|
||||||
|
50: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 51 22 33 12 13 49 21 37
|
||||||
|
56: 8(int) Constant 10
|
||||||
|
55: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 54 7 33 56 13 36 54 14 56
|
||||||
|
59: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 35(DebugSource) 3 60
|
||||||
|
63: 8(int) Constant 9
|
||||||
|
79: TypePointer Output 20(fvec4)
|
||||||
|
80: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 22 14 13
|
||||||
|
81(headerOut): 79(ptr) Variable Output
|
||||||
|
84: 8(int) Constant 11
|
||||||
|
82: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 83 22 33 84 13 36 83 81(headerOut) 35
|
||||||
|
85(UBO): TypeStruct 20(fvec4)
|
||||||
|
88: 8(int) Constant 5
|
||||||
|
86: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 87 22 33 88 24 13 13 14
|
||||||
|
89: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 90 37 33 84 13 36 90 13 14 86
|
||||||
|
91: TypePointer Uniform 85(UBO)
|
||||||
|
92: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 89 38 13
|
||||||
|
93: 91(ptr) Variable Uniform
|
||||||
|
94: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 95 89 33 84 13 36 95 93 35
|
||||||
|
96: TypeInt 32 1
|
||||||
|
98: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 97 11 21 13
|
||||||
|
99: 96(int) Constant 0
|
||||||
|
101: TypePointer Uniform 20(fvec4)
|
||||||
|
102: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 22 38 13
|
||||||
|
15(main): 5 Function None 6
|
||||||
|
16: Label
|
||||||
|
100(param): 23(ptr) Variable Function
|
||||||
|
107(param): 23(ptr) Variable Function
|
||||||
|
77: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55
|
||||||
|
78: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 56 56 13 13
|
||||||
|
76: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 55 15(main)
|
||||||
|
104: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 84 84 13 13
|
||||||
|
103: 101(ptr) AccessChain 93 99
|
||||||
|
105: 20(fvec4) Load 103
|
||||||
|
Store 100(param) 105
|
||||||
|
106: 20(fvec4) FunctionCall 46(mainFileFunction(vf4;) 100(param)
|
||||||
|
Store 107(param) 106
|
||||||
|
108: 20(fvec4) FunctionCall 29(headerFunction(vf4;) 107(param)
|
||||||
|
Store 81(headerOut) 108
|
||||||
|
Return
|
||||||
|
FunctionEnd
|
||||||
|
29(headerFunction(vf4;): 20(fvec4) Function None 26
|
||||||
|
28(a): 23(ptr) FunctionParameter
|
||||||
|
30: Label
|
||||||
|
43: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 32
|
||||||
|
44: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 35 35 13 13
|
||||||
|
41: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 39 28(a) 42
|
||||||
|
58: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 59 35 35 13 13
|
||||||
|
57: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 32 29(headerFunction(vf4;)
|
||||||
|
62: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 59 63 63 13 13
|
||||||
|
61: 20(fvec4) Load 28(a)
|
||||||
|
64: 20(fvec4) FNegate 61
|
||||||
|
ReturnValue 64
|
||||||
|
FunctionEnd
|
||||||
|
46(mainFileFunction(vf4;): 20(fvec4) Function None 26
|
||||||
|
45(v): 23(ptr) FunctionParameter
|
||||||
|
47: Label
|
||||||
|
53: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 49
|
||||||
|
52: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 50 45(v) 42
|
||||||
|
69: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 12 12 13 13
|
||||||
|
68: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 49 46(mainFileFunction(vf4;)
|
||||||
|
71: 5 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 33 24 24 13 13
|
||||||
|
70: 20(fvec4) Load 45(v)
|
||||||
|
72: 20(fvec4) FNegate 70
|
||||||
|
ReturnValue 72
|
||||||
|
FunctionEnd
|
||||||
|
|
@ -169,12 +169,6 @@ diff -b $BASEDIR/spv.looseUniformNoLoc.vert.out "$TARGETDIR/spv.looseUniformNoLo
|
||||||
# Testing debug information
|
# Testing debug information
|
||||||
#
|
#
|
||||||
echo Testing SPV Debug Information
|
echo Testing SPV Debug Information
|
||||||
run -g --relaxed-errors --suppress-warnings --aml --amb --hlsl-offsets --nsf --spirv-val \
|
|
||||||
-G -H spv.debugInfo.frag --rsb frag 3 > "$TARGETDIR/spv.debugInfo.frag.out"
|
|
||||||
diff -b $BASEDIR/spv.debugInfo.frag.out "$TARGETDIR/spv.debugInfo.frag.out" || HASERROR=1
|
|
||||||
run -g -Od --target-env vulkan1.1 --relaxed-errors --suppress-warnings --aml --amb --hlsl-offsets --nsf --spirv-val \
|
|
||||||
-V -H spv.debugInfo.frag --rsb frag 3 > "$TARGETDIR/spv.debugInfo.1.1.frag.out"
|
|
||||||
diff -b $BASEDIR/spv.debugInfo.1.1.frag.out "$TARGETDIR/spv.debugInfo.1.1.frag.out" || HASERROR=1
|
|
||||||
run -g -D -Od -e newMain -g --amb --aml --fua --hlsl-iomap --nsf --spirv-val --sib 1 --ssb 2 --sbb 3 --stb 4 --suavb 5 --sub 6 \
|
run -g -D -Od -e newMain -g --amb --aml --fua --hlsl-iomap --nsf --spirv-val --sib 1 --ssb 2 --sbb 3 --stb 4 --suavb 5 --sub 6 \
|
||||||
--sep origMain -H -Od spv.hlslDebugInfo.vert --rsb vert t0 0 0 > "$TARGETDIR/spv.hlslDebugInfo.frag.out"
|
--sep origMain -H -Od spv.hlslDebugInfo.vert --rsb vert t0 0 0 > "$TARGETDIR/spv.hlslDebugInfo.frag.out"
|
||||||
diff -b $BASEDIR/spv.hlslDebugInfo.frag.out "$TARGETDIR/spv.hlslDebugInfo.frag.out" || HASERROR=1
|
diff -b $BASEDIR/spv.hlslDebugInfo.frag.out "$TARGETDIR/spv.hlslDebugInfo.frag.out" || HASERROR=1
|
||||||
|
|
|
||||||
|
|
@ -1,83 +1,83 @@
|
||||||
#version 450
|
#version 450
|
||||||
|
|
||||||
struct S {
|
struct S {
|
||||||
int a;
|
int a;
|
||||||
};
|
};
|
||||||
|
|
||||||
uniform ubuf {
|
uniform ubuf {
|
||||||
S s;
|
S s;
|
||||||
};
|
};
|
||||||
|
|
||||||
uniform sampler2D s2d;
|
uniform sampler2D s2d;
|
||||||
|
|
||||||
layout(location = 0) in vec4 inv;
|
layout(location = 0) in vec4 inv;
|
||||||
layout(location = 0) out vec4 outv;
|
layout(location = 0) out vec4 outv;
|
||||||
|
|
||||||
vec4 foo(S s)
|
vec4 foo(S s)
|
||||||
{
|
{
|
||||||
vec4 r = s.a * inv;
|
vec4 r = s.a * inv;
|
||||||
++r;
|
++r;
|
||||||
if (r.x > 3.0)
|
if (r.x > 3.0)
|
||||||
--r;
|
--r;
|
||||||
else
|
else
|
||||||
r *= 2;
|
r *= 2;
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
float testBranch(float x, float y)
|
float testBranch(float x, float y)
|
||||||
{
|
{
|
||||||
float result = 0;
|
float result = 0;
|
||||||
bool b = x > 0;
|
bool b = x > 0;
|
||||||
|
|
||||||
// branch with load
|
// branch with load
|
||||||
if (b) {
|
if (b) {
|
||||||
result += 1;
|
result += 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result -= 1;
|
result -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// branch with expression
|
// branch with expression
|
||||||
if (x > y) {
|
if (x > y) {
|
||||||
result += x - y;
|
result += x - y;
|
||||||
}
|
}
|
||||||
|
|
||||||
// selection with load
|
// selection with load
|
||||||
result += b ?
|
result += b ?
|
||||||
1 : -1;
|
1 : -1;
|
||||||
|
|
||||||
// selection with expression
|
// selection with expression
|
||||||
result += x < y ?
|
result += x < y ?
|
||||||
y :
|
y :
|
||||||
float(b);
|
float(b);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
outv = foo(s);
|
outv = foo(s);
|
||||||
outv += testBranch(inv.x, inv.y);
|
outv += testBranch(inv.x, inv.y);
|
||||||
outv += texture(s2d, vec2(0.5));
|
outv += texture(s2d, vec2(0.5));
|
||||||
|
|
||||||
switch (s.a) {
|
switch (s.a) {
|
||||||
case 10:
|
case 10:
|
||||||
++outv;
|
++outv;
|
||||||
break;
|
break;
|
||||||
case 20:
|
case 20:
|
||||||
outv = 2 * outv;
|
outv = 2 * outv;
|
||||||
++outv;
|
++outv;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
--outv;
|
--outv;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 10; ++i)
|
for (int i = 0; i < 10; ++i)
|
||||||
outv *= 3.0;
|
outv *= 3.0;
|
||||||
|
|
||||||
outv.x < 10.0 ?
|
outv.x < 10.0 ?
|
||||||
outv = sin(outv) :
|
outv = sin(outv) :
|
||||||
outv = cos(outv);
|
outv = cos(outv);
|
||||||
}
|
}
|
||||||
12
Test/spv.debuginfo.include.glsl.frag
Normal file
12
Test/spv.debuginfo.include.glsl.frag
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
#version 450
|
||||||
|
|
||||||
|
#extension GL_GOOGLE_include_directive : require
|
||||||
|
#include "spv.debuginfo.include.glsl.h"
|
||||||
|
|
||||||
|
vec4 mainFileFunction(vec4 v) {
|
||||||
|
return -v;
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
headerOut = headerFunction(mainFileFunction(headerUboItem));
|
||||||
|
}
|
||||||
10
Test/spv.debuginfo.include.glsl.h
Normal file
10
Test/spv.debuginfo.include.glsl.h
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
|
||||||
|
out vec4 headerOut;
|
||||||
|
|
||||||
|
uniform UBO {
|
||||||
|
vec4 headerUboItem;
|
||||||
|
};
|
||||||
|
|
||||||
|
vec4 headerFunction(vec4 a) {
|
||||||
|
return -a;
|
||||||
|
}
|
||||||
|
|
@ -67,7 +67,6 @@ std::string FileNameAsCustomTestSuffixIoMap(
|
||||||
using CompileVulkanToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
|
using CompileVulkanToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||||
using CompileVulkanToSpirvTestNoLink = GlslangTest<::testing::TestWithParam<std::string>>;
|
using CompileVulkanToSpirvTestNoLink = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||||
using CompileVulkanToSpirvDeadCodeElimTest = GlslangTest<::testing::TestWithParam<std::string>>;
|
using CompileVulkanToSpirvDeadCodeElimTest = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||||
using CompileVulkanToDebugSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
|
|
||||||
using CompileVulkan1_1ToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
|
using CompileVulkan1_1ToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||||
using CompileToSpirv14Test = GlslangTest<::testing::TestWithParam<std::string>>;
|
using CompileToSpirv14Test = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||||
using CompileToSpirv16Test = GlslangTest<::testing::TestWithParam<std::string>>;
|
using CompileToSpirv16Test = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||||
|
|
@ -82,7 +81,8 @@ using CompileVulkanToSpirvTestAMD = GlslangTest<::testing::TestWithParam<std::st
|
||||||
using CompileVulkanToSpirvTestNV = GlslangTest<::testing::TestWithParam<std::string>>;
|
using CompileVulkanToSpirvTestNV = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||||
using CompileVulkanToSpirv14TestNV = GlslangTest<::testing::TestWithParam<std::string>>;
|
using CompileVulkanToSpirv14TestNV = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||||
using CompileUpgradeTextureToSampledTextureAndDropSamplersTest = GlslangTest<::testing::TestWithParam<std::string>>;
|
using CompileUpgradeTextureToSampledTextureAndDropSamplersTest = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||||
using CompileVulkanToNonSemanticShaderDebugInfoTest = GlslangTest<::testing::TestWithParam<std::string>>;
|
using GlslSpirvDebugInfoTest = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||||
|
using GlslNonSemanticShaderDebugInfoTest = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||||
|
|
||||||
// Compiling GLSL to SPIR-V under Vulkan semantics. Expected to successfully
|
// Compiling GLSL to SPIR-V under Vulkan semantics. Expected to successfully
|
||||||
// generate SPIR-V.
|
// generate SPIR-V.
|
||||||
|
|
@ -110,17 +110,6 @@ TEST_P(CompileVulkanToSpirvDeadCodeElimTest, FromFile)
|
||||||
Target::Spv);
|
Target::Spv);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compiling GLSL to SPIR-V with debug info under Vulkan semantics. Expected
|
|
||||||
// to successfully generate SPIR-V.
|
|
||||||
TEST_P(CompileVulkanToDebugSpirvTest, FromFile)
|
|
||||||
{
|
|
||||||
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
|
|
||||||
Source::GLSL, Semantics::Vulkan,
|
|
||||||
glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
|
||||||
Target::Spv, true, "",
|
|
||||||
"/baseResults/", false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
TEST_P(CompileVulkan1_1ToSpirvTest, FromFile)
|
TEST_P(CompileVulkan1_1ToSpirvTest, FromFile)
|
||||||
{
|
{
|
||||||
|
|
@ -251,11 +240,18 @@ TEST_P(CompileUpgradeTextureToSampledTextureAndDropSamplersTest, FromFile)
|
||||||
Target::Spv);
|
Target::Spv);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(CompileVulkanToNonSemanticShaderDebugInfoTest, FromFile)
|
TEST_P(GlslSpirvDebugInfoTest, FromFile)
|
||||||
{
|
{
|
||||||
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
|
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(), Source::GLSL, Semantics::Vulkan,
|
||||||
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0, Target::Spv, true, "",
|
||||||
Target::Spv, true, "", "/baseResults/", false, true, true);
|
"/baseResults/", false, true, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_P(GlslNonSemanticShaderDebugInfoTest, FromFile)
|
||||||
|
{
|
||||||
|
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(), Source::GLSL, Semantics::Vulkan,
|
||||||
|
glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0, Target::Spv, true, "",
|
||||||
|
"/baseResults/", false, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
|
|
@ -584,15 +580,6 @@ INSTANTIATE_TEST_SUITE_P(
|
||||||
FileNameAsCustomTestSuffix
|
FileNameAsCustomTestSuffix
|
||||||
);
|
);
|
||||||
|
|
||||||
// clang-format off
|
|
||||||
INSTANTIATE_TEST_SUITE_P(
|
|
||||||
Glsl, CompileVulkanToDebugSpirvTest,
|
|
||||||
::testing::ValuesIn(std::vector<std::string>({
|
|
||||||
"spv.pp.line.frag",
|
|
||||||
})),
|
|
||||||
FileNameAsCustomTestSuffix
|
|
||||||
);
|
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
INSTANTIATE_TEST_SUITE_P(
|
INSTANTIATE_TEST_SUITE_P(
|
||||||
Glsl, CompileVulkan1_1ToSpirvTest,
|
Glsl, CompileVulkan1_1ToSpirvTest,
|
||||||
|
|
@ -945,7 +932,16 @@ INSTANTIATE_TEST_SUITE_P(
|
||||||
);
|
);
|
||||||
|
|
||||||
INSTANTIATE_TEST_SUITE_P(
|
INSTANTIATE_TEST_SUITE_P(
|
||||||
Glsl, CompileVulkanToNonSemanticShaderDebugInfoTest,
|
Glsl, GlslSpirvDebugInfoTest,
|
||||||
|
::testing::ValuesIn(std::vector<std::string>({
|
||||||
|
"spv.pp.line.frag",
|
||||||
|
"spv.debugInfo.frag",
|
||||||
|
})),
|
||||||
|
FileNameAsCustomTestSuffix
|
||||||
|
);
|
||||||
|
|
||||||
|
INSTANTIATE_TEST_SUITE_P(
|
||||||
|
Glsl, GlslNonSemanticShaderDebugInfoTest,
|
||||||
::testing::ValuesIn(std::vector<std::string>({
|
::testing::ValuesIn(std::vector<std::string>({
|
||||||
"spv.debuginfo.glsl.vert",
|
"spv.debuginfo.glsl.vert",
|
||||||
"spv.debuginfo.glsl.frag",
|
"spv.debuginfo.glsl.frag",
|
||||||
|
|
@ -957,6 +953,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||||
"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",
|
"spv.debuginfo.rt_types.glsl.rgen",
|
||||||
|
"spv.debuginfo.include.glsl.frag",
|
||||||
})),
|
})),
|
||||||
FileNameAsCustomTestSuffix
|
FileNameAsCustomTestSuffix
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@
|
||||||
#ifndef GLSLANG_GTESTS_TEST_FIXTURE_H
|
#ifndef GLSLANG_GTESTS_TEST_FIXTURE_H
|
||||||
#define GLSLANG_GTESTS_TEST_FIXTURE_H
|
#define GLSLANG_GTESTS_TEST_FIXTURE_H
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
@ -199,9 +200,42 @@ public:
|
||||||
} else
|
} else
|
||||||
shader->setStringsWithLengths(&shaderStrings, &shaderLengths, 1);
|
shader->setStringsWithLengths(&shaderStrings, &shaderLengths, 1);
|
||||||
if (!entryPointName.empty()) shader->setEntryPoint(entryPointName.c_str());
|
if (!entryPointName.empty()) shader->setEntryPoint(entryPointName.c_str());
|
||||||
return shader->parse(
|
|
||||||
(resources ? resources : GetDefaultResources()),
|
// A includer that always assumes header name is a relative path to the test folder.
|
||||||
defaultVersion, isForwardCompatible, controls);
|
class GlslangTestIncluder : public glslang::TShader::Includer {
|
||||||
|
public:
|
||||||
|
virtual IncludeResult* includeLocal(const char* headerName, const char* /*includerName*/,
|
||||||
|
size_t /*inclusionDepth*/) override
|
||||||
|
{
|
||||||
|
std::string path = GLSLANG_TEST_DIRECTORY;
|
||||||
|
path += '/';
|
||||||
|
path += headerName;
|
||||||
|
std::replace(path.begin(), path.end(), '\\', '/');
|
||||||
|
|
||||||
|
auto [success, fileContent] = ReadFile(path);
|
||||||
|
if (success) {
|
||||||
|
auto buffer = new char[fileContent.size() + 1];
|
||||||
|
std::copy(fileContent.begin(), fileContent.end(), buffer);
|
||||||
|
buffer[fileContent.size()] = '\0';
|
||||||
|
|
||||||
|
return new IncludeResult(headerName, buffer, fileContent.size(), buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void releaseInclude(IncludeResult* result) override
|
||||||
|
{
|
||||||
|
if (result != nullptr) {
|
||||||
|
delete[] static_cast<char*>(result->userData);
|
||||||
|
delete result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
GlslangTestIncluder includer;
|
||||||
|
return shader->parse((resources ? resources : GetDefaultResources()), defaultVersion, isForwardCompatible,
|
||||||
|
controls, includer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compiles and links the given source |code| of the given shader
|
// Compiles and links the given source |code| of the given shader
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue