• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1spv.debugInfo.frag
2// Module Version 10300
3// Generated by (magic number): 8000b
4// Id's are bound by 187
5
6                              Capability Shader
7               2:             ExtInstImport  "GLSL.std.450"
8                              MemoryModel Logical GLSL450
9                              EntryPoint Fragment 5  "main" 30 104
10                              ExecutionMode 5 OriginUpperLeft
11               1:             String  "spv.debugInfo.frag"
12                              Source GLSL 450 1  "#version 450
13
14struct S {
15    int a;
16};
17
18uniform ubuf {
19    S s;
20};
21
22uniform sampler2D s2d;
23
24layout(location = 0) in vec4 inv;
25layout(location = 0) out vec4 outv;
26
27vec4 foo(S s)
28{
29    vec4 r = s.a * inv;
30    ++r;
31    if (r.x > 3.0)
32        --r;
33    else
34        r *= 2;
35
36    return r;
37}
38
39float testBranch(float x, float y)
40{
41    float result = 0;
42    bool b = x > 0;
43
44    // branch with load
45    if (b) {
46        result += 1;
47    }
48    else {
49        result -= 1;
50    }
51
52    // branch with expression
53    if (x > y) {
54        result += x - y;
55    }
56
57    // selection with load
58    result += b ?
59        1 : -1;
60
61    // selection with expression
62    result += x < y ?
63        y :
64        float(b);
65
66    return result;
67}
68
69void main()
70{
71    outv = foo(s);
72    outv += testBranch(inv.x, inv.y);
73    outv += texture(s2d, vec2(0.5));
74
75    switch (s.a) {
76    case 10:
77        ++outv;
78        break;
79    case 20:
80        outv = 2 * outv;
81        ++outv;
82        break;
83    default:
84        --outv;
85        break;
86    }
87
88    for (int i = 0; i < 10; ++i)
89        outv *= 3.0;
90
91    outv.x < 10.0 ?
92        outv = sin(outv) :
93        outv = cos(outv);
94}"
95                              Name 5  "main"
96                              Name 8  "S"
97                              MemberName 8(S) 0  "a"
98                              Name 14  "foo(struct-S-i11;"
99                              Name 13  "s"
100                              Name 20  "testBranch(f1;f1;"
101                              Name 18  "x"
102                              Name 19  "y"
103                              Name 23  "r"
104                              Name 30  "inv"
105                              Name 56  "result"
106                              Name 59  "b"
107                              Name 104  "outv"
108                              Name 105  "S"
109                              MemberName 105(S) 0  "a"
110                              Name 106  "ubuf"
111                              MemberName 106(ubuf) 0  "s"
112                              Name 108  ""
113                              Name 109  "param"
114                              Name 116  "param"
115                              Name 120  "param"
116                              Name 131  "s2d"
117                              Name 161  "i"
118                              ModuleProcessed  "no-storage-format"
119                              ModuleProcessed  "resource-set-binding 3"
120                              ModuleProcessed  "auto-map-bindings"
121                              ModuleProcessed  "auto-map-locations"
122                              ModuleProcessed  "client vulkan100"
123                              ModuleProcessed  "target-env spirv1.3"
124                              ModuleProcessed  "target-env vulkan1.1"
125                              ModuleProcessed  "relaxed-errors"
126                              ModuleProcessed  "suppress-warnings"
127                              ModuleProcessed  "hlsl-offsets"
128                              ModuleProcessed  "entry-point main"
129                              Decorate 30(inv) Location 0
130                              Decorate 104(outv) Location 0
131                              MemberDecorate 105(S) 0 Offset 0
132                              MemberDecorate 106(ubuf) 0 Offset 0
133                              Decorate 106(ubuf) Block
134                              Decorate 108 DescriptorSet 3
135                              Decorate 108 Binding 0
136                              Decorate 131(s2d) DescriptorSet 3
137                              Decorate 131(s2d) Binding 1
138               3:             TypeVoid
139               4:             TypeFunction 3
140               7:             TypeInt 32 1
141            8(S):             TypeStruct 7(int)
142               9:             TypePointer Function 8(S)
143              10:             TypeFloat 32
144              11:             TypeVector 10(float) 4
145              12:             TypeFunction 11(fvec4) 9(ptr)
146              16:             TypePointer Function 10(float)
147              17:             TypeFunction 10(float) 16(ptr) 16(ptr)
148              22:             TypePointer Function 11(fvec4)
149              24:      7(int) Constant 0
150              25:             TypePointer Function 7(int)
151              29:             TypePointer Input 11(fvec4)
152         30(inv):     29(ptr) Variable Input
153              34:   10(float) Constant 1065353216
154              37:             TypeInt 32 0
155              38:     37(int) Constant 0
156              41:   10(float) Constant 1077936128
157              42:             TypeBool
158              50:   10(float) Constant 1073741824
159              57:   10(float) Constant 0
160              58:             TypePointer Function 42(bool)
161              81:      7(int) Constant 1
162              82:      7(int) Constant 4294967295
163             103:             TypePointer Output 11(fvec4)
164       104(outv):    103(ptr) Variable Output
165          105(S):             TypeStruct 7(int)
166       106(ubuf):             TypeStruct 105(S)
167             107:             TypePointer Uniform 106(ubuf)
168             108:    107(ptr) Variable Uniform
169             110:             TypePointer Uniform 105(S)
170             117:             TypePointer Input 10(float)
171             121:     37(int) Constant 1
172             128:             TypeImage 10(float) 2D sampled format:Unknown
173             129:             TypeSampledImage 128
174             130:             TypePointer UniformConstant 129
175        131(s2d):    130(ptr) Variable UniformConstant
176             133:             TypeVector 10(float) 2
177             134:   10(float) Constant 1056964608
178             135:  133(fvec2) ConstantComposite 134 134
179             139:             TypePointer Uniform 7(int)
180             168:      7(int) Constant 10
181             174:             TypePointer Output 10(float)
182             177:   10(float) Constant 1092616192
183                              Line 1 58 11
184         5(main):           3 Function None 4
185               6:             Label
186      109(param):      9(ptr) Variable Function
187      116(param):     16(ptr) Variable Function
188      120(param):     16(ptr) Variable Function
189          161(i):     25(ptr) Variable Function
190             179:     22(ptr) Variable Function
191                              Line 1 60 0
192             111:    110(ptr) AccessChain 108 24
193             112:      105(S) Load 111
194             113:      7(int) CompositeExtract 112 0
195             114:     25(ptr) AccessChain 109(param) 24
196                              Store 114 113
197             115:   11(fvec4) FunctionCall 14(foo(struct-S-i11;) 109(param)
198                              Store 104(outv) 115
199                              Line 1 61 0
200             118:    117(ptr) AccessChain 30(inv) 38
201             119:   10(float) Load 118
202                              Store 116(param) 119
203             122:    117(ptr) AccessChain 30(inv) 121
204             123:   10(float) Load 122
205                              Store 120(param) 123
206             124:   10(float) FunctionCall 20(testBranch(f1;f1;) 116(param) 120(param)
207             125:   11(fvec4) Load 104(outv)
208             126:   11(fvec4) CompositeConstruct 124 124 124 124
209             127:   11(fvec4) FAdd 125 126
210                              Store 104(outv) 127
211                              Line 1 62 0
212             132:         129 Load 131(s2d)
213             136:   11(fvec4) ImageSampleImplicitLod 132 135
214             137:   11(fvec4) Load 104(outv)
215             138:   11(fvec4) FAdd 137 136
216                              Store 104(outv) 138
217                              Line 1 64 0
218             140:    139(ptr) AccessChain 108 24 24
219             141:      7(int) Load 140
220                              SelectionMerge 145 None
221                              Switch 141 144
222                                     case 10: 142
223                                     case 20: 143
224             144:               Label
225                                Line 1 73 0
226             156:   11(fvec4)   Load 104(outv)
227             157:   11(fvec4)   CompositeConstruct 34 34 34 34
228             158:   11(fvec4)   FSub 156 157
229                                Store 104(outv) 158
230                                Line 1 74 0
231                                Branch 145
232             142:               Label
233                                Line 1 66 0
234             146:   11(fvec4)   Load 104(outv)
235             147:   11(fvec4)   CompositeConstruct 34 34 34 34
236             148:   11(fvec4)   FAdd 146 147
237                                Store 104(outv) 148
238                                Line 1 67 0
239                                Branch 145
240             143:               Label
241                                Line 1 69 0
242             150:   11(fvec4)   Load 104(outv)
243             151:   11(fvec4)   VectorTimesScalar 150 50
244                                Store 104(outv) 151
245                                Line 1 70 0
246             152:   11(fvec4)   Load 104(outv)
247             153:   11(fvec4)   CompositeConstruct 34 34 34 34
248             154:   11(fvec4)   FAdd 152 153
249                                Store 104(outv) 154
250                                Line 1 71 0
251                                Branch 145
252             145:             Label
253                              Line 1 77 0
254                              Store 161(i) 24
255                              Branch 162
256             162:             Label
257                              Line 1 77 0
258                              LoopMerge 164 165 None
259                              Branch 166
260             166:             Label
261                              Line 1 77 0
262             167:      7(int) Load 161(i)
263             169:    42(bool) SLessThan 167 168
264                              BranchConditional 169 163 164
265             163:               Label
266                                Line 1 78 0
267             170:   11(fvec4)   Load 104(outv)
268             171:   11(fvec4)   VectorTimesScalar 170 41
269                                Store 104(outv) 171
270                                Branch 165
271             165:               Label
272                                Line 1 77 0
273             172:      7(int)   Load 161(i)
274             173:      7(int)   IAdd 172 81
275                                Store 161(i) 173
276                                Branch 162
277             164:             Label
278                              Line 1 80 0
279             175:    174(ptr) AccessChain 104(outv) 38
280             176:   10(float) Load 175
281             178:    42(bool) FOrdLessThan 176 177
282                              SelectionMerge 181 None
283                              BranchConditional 178 180 184
284             180:               Label
285                                Line 1 81 0
286             182:   11(fvec4)   Load 104(outv)
287             183:   11(fvec4)   ExtInst 2(GLSL.std.450) 13(Sin) 182
288                                Store 104(outv) 183
289                                Store 179 183
290                                Branch 181
291             184:               Label
292                                Line 1 82 0
293             185:   11(fvec4)   Load 104(outv)
294             186:   11(fvec4)   ExtInst 2(GLSL.std.450) 14(Cos) 185
295                                Store 104(outv) 186
296                                Store 179 186
297                                Branch 181
298             181:             Label
299                              Return
300                              FunctionEnd
301                              Line 1 16 13
30214(foo(struct-S-i11;):   11(fvec4) Function None 12
303           13(s):      9(ptr) FunctionParameter
304              15:             Label
305           23(r):     22(ptr) Variable Function
306                              Line 1 18 0
307              26:     25(ptr) AccessChain 13(s) 24
308              27:      7(int) Load 26
309              28:   10(float) ConvertSToF 27
310              31:   11(fvec4) Load 30(inv)
311              32:   11(fvec4) VectorTimesScalar 31 28
312                              Store 23(r) 32
313                              Line 1 19 0
314              33:   11(fvec4) Load 23(r)
315              35:   11(fvec4) CompositeConstruct 34 34 34 34
316              36:   11(fvec4) FAdd 33 35
317                              Store 23(r) 36
318                              Line 1 20 0
319              39:     16(ptr) AccessChain 23(r) 38
320              40:   10(float) Load 39
321              43:    42(bool) FOrdGreaterThan 40 41
322                              SelectionMerge 45 None
323                              BranchConditional 43 44 49
324              44:               Label
325                                Line 1 21 0
326              46:   11(fvec4)   Load 23(r)
327              47:   11(fvec4)   CompositeConstruct 34 34 34 34
328              48:   11(fvec4)   FSub 46 47
329                                Store 23(r) 48
330                                Branch 45
331              49:               Label
332                                Line 1 23 0
333              51:   11(fvec4)   Load 23(r)
334              52:   11(fvec4)   VectorTimesScalar 51 50
335                                Store 23(r) 52
336                                Branch 45
337              45:             Label
338                              Line 1 25 0
339              53:   11(fvec4) Load 23(r)
340                              ReturnValue 53
341                              FunctionEnd
342                              Line 1 28 34
34320(testBranch(f1;f1;):   10(float) Function None 17
344           18(x):     16(ptr) FunctionParameter
345           19(y):     16(ptr) FunctionParameter
346              21:             Label
347      56(result):     16(ptr) Variable Function
348           59(b):     58(ptr) Variable Function
349              90:     16(ptr) Variable Function
350                              Line 1 30 0
351                              Store 56(result) 57
352                              Line 1 31 0
353              60:   10(float) Load 18(x)
354              61:    42(bool) FOrdGreaterThan 60 57
355                              Store 59(b) 61
356                              Line 1 34 0
357              62:    42(bool) Load 59(b)
358                              SelectionMerge 64 None
359                              BranchConditional 62 63 67
360              63:               Label
361                                Line 1 35 0
362              65:   10(float)   Load 56(result)
363              66:   10(float)   FAdd 65 34
364                                Store 56(result) 66
365                                Branch 64
366              67:               Label
367                                Line 1 38 0
368              68:   10(float)   Load 56(result)
369              69:   10(float)   FSub 68 34
370                                Store 56(result) 69
371                                Branch 64
372              64:             Label
373                              Line 1 42 0
374              70:   10(float) Load 18(x)
375              71:   10(float) Load 19(y)
376              72:    42(bool) FOrdGreaterThan 70 71
377                              SelectionMerge 74 None
378                              BranchConditional 72 73 74
379              73:               Label
380                                Line 1 43 0
381              75:   10(float)   Load 18(x)
382              76:   10(float)   Load 19(y)
383              77:   10(float)   FSub 75 76
384              78:   10(float)   Load 56(result)
385              79:   10(float)   FAdd 78 77
386                                Store 56(result) 79
387                                Branch 74
388              74:             Label
389                              Line 1 47 0
390              80:    42(bool) Load 59(b)
391              83:      7(int) Select 80 81 82
392              84:   10(float) ConvertSToF 83
393              85:   10(float) Load 56(result)
394              86:   10(float) FAdd 85 84
395                              Store 56(result) 86
396                              Line 1 51 0
397              87:   10(float) Load 18(x)
398              88:   10(float) Load 19(y)
399              89:    42(bool) FOrdLessThan 87 88
400                              SelectionMerge 92 None
401                              BranchConditional 89 91 94
402              91:               Label
403                                Line 1 52 0
404              93:   10(float)   Load 19(y)
405                                Store 90 93
406                                Branch 92
407              94:               Label
408                                Line 1 53 0
409              95:    42(bool)   Load 59(b)
410              96:   10(float)   Select 95 34 57
411                                Store 90 96
412                                Branch 92
413              92:             Label
414              97:   10(float) Load 90
415                              Line 1 51 0
416              98:   10(float) Load 56(result)
417              99:   10(float) FAdd 98 97
418                              Store 56(result) 99
419                              Line 1 55 0
420             100:   10(float) Load 56(result)
421                              ReturnValue 100
422                              FunctionEnd
423