xref: /aosp_15_r20/external/angle/third_party/glslang/src/Test/baseResults/spv.debugInfo.1.1.frag.out (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
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                              Decorate 106(ubuf) Block
133                              MemberDecorate 106(ubuf) 0 Offset 0
134                              Decorate 108 Binding 0
135                              Decorate 108 DescriptorSet 3
136                              Decorate 131(s2d) Binding 1
137                              Decorate 131(s2d) DescriptorSet 3
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                              Line 1 83 0
300                              Return
301                              FunctionEnd
302                              Line 1 16 13
30314(foo(struct-S-i11;):   11(fvec4) Function None 12
304           13(s):      9(ptr) FunctionParameter
305              15:             Label
306           23(r):     22(ptr) Variable Function
307                              Line 1 18 0
308              26:     25(ptr) AccessChain 13(s) 24
309              27:      7(int) Load 26
310              28:   10(float) ConvertSToF 27
311              31:   11(fvec4) Load 30(inv)
312              32:   11(fvec4) VectorTimesScalar 31 28
313                              Store 23(r) 32
314                              Line 1 19 0
315              33:   11(fvec4) Load 23(r)
316              35:   11(fvec4) CompositeConstruct 34 34 34 34
317              36:   11(fvec4) FAdd 33 35
318                              Store 23(r) 36
319                              Line 1 20 0
320              39:     16(ptr) AccessChain 23(r) 38
321              40:   10(float) Load 39
322              43:    42(bool) FOrdGreaterThan 40 41
323                              SelectionMerge 45 None
324                              BranchConditional 43 44 49
325              44:               Label
326                                Line 1 21 0
327              46:   11(fvec4)   Load 23(r)
328              47:   11(fvec4)   CompositeConstruct 34 34 34 34
329              48:   11(fvec4)   FSub 46 47
330                                Store 23(r) 48
331                                Branch 45
332              49:               Label
333                                Line 1 23 0
334              51:   11(fvec4)   Load 23(r)
335              52:   11(fvec4)   VectorTimesScalar 51 50
336                                Store 23(r) 52
337                                Branch 45
338              45:             Label
339                              Line 1 25 0
340              53:   11(fvec4) Load 23(r)
341                              ReturnValue 53
342                              FunctionEnd
343                              Line 1 28 34
34420(testBranch(f1;f1;):   10(float) Function None 17
345           18(x):     16(ptr) FunctionParameter
346           19(y):     16(ptr) FunctionParameter
347              21:             Label
348      56(result):     16(ptr) Variable Function
349           59(b):     58(ptr) Variable Function
350              90:     16(ptr) Variable Function
351                              Line 1 30 0
352                              Store 56(result) 57
353                              Line 1 31 0
354              60:   10(float) Load 18(x)
355              61:    42(bool) FOrdGreaterThan 60 57
356                              Store 59(b) 61
357                              Line 1 34 0
358              62:    42(bool) Load 59(b)
359                              SelectionMerge 64 None
360                              BranchConditional 62 63 67
361              63:               Label
362                                Line 1 35 0
363              65:   10(float)   Load 56(result)
364              66:   10(float)   FAdd 65 34
365                                Store 56(result) 66
366                                Branch 64
367              67:               Label
368                                Line 1 38 0
369              68:   10(float)   Load 56(result)
370              69:   10(float)   FSub 68 34
371                                Store 56(result) 69
372                                Branch 64
373              64:             Label
374                              Line 1 42 0
375              70:   10(float) Load 18(x)
376              71:   10(float) Load 19(y)
377              72:    42(bool) FOrdGreaterThan 70 71
378                              SelectionMerge 74 None
379                              BranchConditional 72 73 74
380              73:               Label
381                                Line 1 43 0
382              75:   10(float)   Load 18(x)
383              76:   10(float)   Load 19(y)
384              77:   10(float)   FSub 75 76
385              78:   10(float)   Load 56(result)
386              79:   10(float)   FAdd 78 77
387                                Store 56(result) 79
388                                Branch 74
389              74:             Label
390                              Line 1 47 0
391              80:    42(bool) Load 59(b)
392              83:      7(int) Select 80 81 82
393              84:   10(float) ConvertSToF 83
394              85:   10(float) Load 56(result)
395              86:   10(float) FAdd 85 84
396                              Store 56(result) 86
397                              Line 1 51 0
398              87:   10(float) Load 18(x)
399              88:   10(float) Load 19(y)
400              89:    42(bool) FOrdLessThan 87 88
401                              SelectionMerge 92 None
402                              BranchConditional 89 91 94
403              91:               Label
404                                Line 1 52 0
405              93:   10(float)   Load 19(y)
406                                Store 90 93
407                                Branch 92
408              94:               Label
409                                Line 1 53 0
410              95:    42(bool)   Load 59(b)
411              96:   10(float)   Select 95 34 57
412                                Store 90 96
413                                Branch 92
414              92:             Label
415                              Line 1 53 0
416              97:   10(float) Load 90
417                              Line 1 51 0
418              98:   10(float) Load 56(result)
419              99:   10(float) FAdd 98 97
420                              Store 56(result) 99
421                              Line 1 55 0
422             100:   10(float) Load 56(result)
423                              ReturnValue 100
424                              FunctionEnd
425