xref: /aosp_15_r20/external/skia/tests/sksl/shared/StructsInFunctions.asm.frag (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1               OpCapability Shader
2          %1 = OpExtInstImport "GLSL.std.450"
3               OpMemoryModel Logical GLSL450
4               OpEntryPoint Fragment %_entrypoint_v "_entrypoint" %sk_FragColor
5               OpExecutionMode %_entrypoint_v OriginUpperLeft
6               OpName %sk_FragColor "sk_FragColor"
7               OpName %_UniformBuffer "_UniformBuffer"
8               OpMemberName %_UniformBuffer 0 "colorRed"
9               OpMemberName %_UniformBuffer 1 "colorGreen"
10               OpName %_entrypoint_v "_entrypoint_v"
11               OpName %S "S"
12               OpMemberName %S 0 "x"
13               OpMemberName %S 1 "y"
14               OpName %returns_a_struct_S "returns_a_struct_S"
15               OpName %s "s"
16               OpName %constructs_a_struct_S "constructs_a_struct_S"
17               OpName %accepts_a_struct_fS "accepts_a_struct_fS"
18               OpName %modifies_a_struct_vS "modifies_a_struct_vS"
19               OpName %main "main"
20               OpName %s_0 "s"
21               OpName %x "x"
22               OpName %expected "expected"
23               OpName %Nested "Nested"
24               OpMemberName %Nested 0 "a"
25               OpMemberName %Nested 1 "b"
26               OpName %n1 "n1"
27               OpName %n2 "n2"
28               OpName %n3 "n3"
29               OpName %Compound "Compound"
30               OpMemberName %Compound 0 "f4"
31               OpMemberName %Compound 1 "i3"
32               OpName %c1 "c1"
33               OpName %c2 "c2"
34               OpName %c3 "c3"
35               OpName %valid "valid"
36               OpDecorate %sk_FragColor RelaxedPrecision
37               OpDecorate %sk_FragColor Location 0
38               OpDecorate %sk_FragColor Index 0
39               OpMemberDecorate %_UniformBuffer 0 Offset 0
40               OpMemberDecorate %_UniformBuffer 0 RelaxedPrecision
41               OpMemberDecorate %_UniformBuffer 1 Offset 16
42               OpMemberDecorate %_UniformBuffer 1 RelaxedPrecision
43               OpDecorate %_UniformBuffer Block
44               OpDecorate %11 Binding 0
45               OpDecorate %11 DescriptorSet 0
46               OpMemberDecorate %S 0 Offset 0
47               OpMemberDecorate %S 1 Offset 4
48               OpDecorate %38 RelaxedPrecision
49               OpMemberDecorate %Nested 0 Offset 0
50               OpMemberDecorate %Nested 0 RelaxedPrecision
51               OpMemberDecorate %Nested 1 Offset 16
52               OpMemberDecorate %Nested 1 RelaxedPrecision
53               OpDecorate %82 RelaxedPrecision
54               OpDecorate %84 RelaxedPrecision
55               OpDecorate %86 RelaxedPrecision
56               OpMemberDecorate %Compound 0 Offset 0
57               OpMemberDecorate %Compound 1 Offset 16
58               OpDecorate %105 RelaxedPrecision
59               OpDecorate %106 RelaxedPrecision
60               OpDecorate %111 RelaxedPrecision
61               OpDecorate %112 RelaxedPrecision
62               OpDecorate %135 RelaxedPrecision
63               OpDecorate %136 RelaxedPrecision
64               OpDecorate %147 RelaxedPrecision
65               OpDecorate %157 RelaxedPrecision
66               OpDecorate %169 RelaxedPrecision
67               OpDecorate %170 RelaxedPrecision
68               OpDecorate %193 RelaxedPrecision
69               OpDecorate %194 RelaxedPrecision
70               OpDecorate %217 RelaxedPrecision
71               OpDecorate %255 RelaxedPrecision
72               OpDecorate %257 RelaxedPrecision
73               OpDecorate %258 RelaxedPrecision
74      %float = OpTypeFloat 32
75    %v4float = OpTypeVector %float 4
76%_ptr_Output_v4float = OpTypePointer Output %v4float
77%sk_FragColor = OpVariable %_ptr_Output_v4float Output
78%_UniformBuffer = OpTypeStruct %v4float %v4float
79%_ptr_Uniform__UniformBuffer = OpTypePointer Uniform %_UniformBuffer
80         %11 = OpVariable %_ptr_Uniform__UniformBuffer Uniform
81       %void = OpTypeVoid
82         %16 = OpTypeFunction %void
83    %float_0 = OpConstant %float 0
84    %v2float = OpTypeVector %float 2
85         %20 = OpConstantComposite %v2float %float_0 %float_0
86%_ptr_Function_v2float = OpTypePointer Function %v2float
87        %int = OpTypeInt 32 1
88          %S = OpTypeStruct %float %int
89         %26 = OpTypeFunction %S
90%_ptr_Function_S = OpTypePointer Function %S
91    %float_1 = OpConstant %float 1
92      %int_0 = OpConstant %int 0
93%_ptr_Function_float = OpTypePointer Function %float
94      %int_2 = OpConstant %int 2
95      %int_1 = OpConstant %int 1
96%_ptr_Function_int = OpTypePointer Function %int
97    %float_2 = OpConstant %float 2
98      %int_3 = OpConstant %int 3
99         %43 = OpTypeFunction %float %_ptr_Function_S
100         %52 = OpTypeFunction %void %_ptr_Function_S
101         %61 = OpTypeFunction %v4float %_ptr_Function_v2float
102     %Nested = OpTypeStruct %S %S
103%_ptr_Function_Nested = OpTypePointer Function %Nested
104      %v3int = OpTypeVector %int 3
105   %Compound = OpTypeStruct %v4float %v3int
106%_ptr_Function_Compound = OpTypePointer Function %Compound
107    %float_3 = OpConstant %float 3
108    %float_4 = OpConstant %float 4
109         %96 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
110      %int_5 = OpConstant %int 5
111      %int_6 = OpConstant %int 6
112      %int_7 = OpConstant %int 7
113        %100 = OpConstantComposite %v3int %int_5 %int_6 %int_7
114%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
115       %bool = OpTypeBool
116%_ptr_Function_bool = OpTypePointer Function %bool
117      %false = OpConstantFalse %bool
118     %v4bool = OpTypeVector %bool 4
119       %true = OpConstantTrue %bool
120%_ptr_Function_v4float = OpTypePointer Function %v4float
121%_entrypoint_v = OpFunction %void None %16
122         %17 = OpLabel
123         %21 = OpVariable %_ptr_Function_v2float Function
124               OpStore %21 %20
125         %23 = OpFunctionCall %v4float %main %21
126               OpStore %sk_FragColor %23
127               OpReturn
128               OpFunctionEnd
129%returns_a_struct_S = OpFunction %S None %26
130         %27 = OpLabel
131          %s = OpVariable %_ptr_Function_S Function
132         %32 = OpAccessChain %_ptr_Function_float %s %int_0
133               OpStore %32 %float_1
134         %36 = OpAccessChain %_ptr_Function_int %s %int_1
135               OpStore %36 %int_2
136         %38 = OpLoad %S %s
137               OpReturnValue %38
138               OpFunctionEnd
139%constructs_a_struct_S = OpFunction %S None %26
140         %39 = OpLabel
141         %42 = OpCompositeConstruct %S %float_2 %int_3
142               OpReturnValue %42
143               OpFunctionEnd
144%accepts_a_struct_fS = OpFunction %float None %43
145         %44 = OpFunctionParameter %_ptr_Function_S
146         %45 = OpLabel
147         %46 = OpAccessChain %_ptr_Function_float %44 %int_0
148         %47 = OpLoad %float %46
149         %48 = OpAccessChain %_ptr_Function_int %44 %int_1
150         %49 = OpLoad %int %48
151         %50 = OpConvertSToF %float %49
152         %51 = OpFAdd %float %47 %50
153               OpReturnValue %51
154               OpFunctionEnd
155%modifies_a_struct_vS = OpFunction %void None %52
156         %53 = OpFunctionParameter %_ptr_Function_S
157         %54 = OpLabel
158         %55 = OpAccessChain %_ptr_Function_float %53 %int_0
159         %56 = OpLoad %float %55
160         %57 = OpFAdd %float %56 %float_1
161               OpStore %55 %57
162         %58 = OpAccessChain %_ptr_Function_int %53 %int_1
163         %59 = OpLoad %int %58
164         %60 = OpIAdd %int %59 %int_1
165               OpStore %58 %60
166               OpReturn
167               OpFunctionEnd
168       %main = OpFunction %v4float None %61
169         %62 = OpFunctionParameter %_ptr_Function_v2float
170         %63 = OpLabel
171        %s_0 = OpVariable %_ptr_Function_S Function
172          %x = OpVariable %_ptr_Function_float Function
173         %67 = OpVariable %_ptr_Function_S Function
174         %69 = OpVariable %_ptr_Function_S Function
175   %expected = OpVariable %_ptr_Function_S Function
176         %n1 = OpVariable %_ptr_Function_Nested Function
177         %n2 = OpVariable %_ptr_Function_Nested Function
178         %n3 = OpVariable %_ptr_Function_Nested Function
179         %87 = OpVariable %_ptr_Function_S Function
180         %c1 = OpVariable %_ptr_Function_Compound Function
181         %c2 = OpVariable %_ptr_Function_Compound Function
182         %c3 = OpVariable %_ptr_Function_Compound Function
183      %valid = OpVariable %_ptr_Function_bool Function
184        %249 = OpVariable %_ptr_Function_v4float Function
185         %65 = OpFunctionCall %S %returns_a_struct_S
186               OpStore %s_0 %65
187               OpStore %67 %65
188         %68 = OpFunctionCall %float %accepts_a_struct_fS %67
189               OpStore %x %68
190               OpStore %69 %65
191         %70 = OpFunctionCall %void %modifies_a_struct_vS %69
192         %71 = OpLoad %S %69
193               OpStore %s_0 %71
194         %73 = OpFunctionCall %S %constructs_a_struct_S
195               OpStore %expected %73
196         %79 = OpFunctionCall %S %returns_a_struct_S
197         %80 = OpAccessChain %_ptr_Function_S %n1 %int_0
198               OpStore %80 %79
199         %81 = OpAccessChain %_ptr_Function_S %n1 %int_0
200         %82 = OpLoad %S %81
201         %83 = OpAccessChain %_ptr_Function_S %n1 %int_1
202               OpStore %83 %82
203         %84 = OpLoad %Nested %n1
204               OpStore %n2 %84
205               OpStore %n3 %84
206         %85 = OpAccessChain %_ptr_Function_S %n3 %int_1
207         %86 = OpLoad %S %85
208               OpStore %87 %86
209         %88 = OpFunctionCall %void %modifies_a_struct_vS %87
210         %89 = OpLoad %S %87
211               OpStore %85 %89
212        %101 = OpCompositeConstruct %Compound %96 %100
213               OpStore %c1 %101
214        %103 = OpAccessChain %_ptr_Uniform_v4float %11 %int_1
215        %105 = OpLoad %v4float %103
216        %106 = OpCompositeExtract %float %105 1
217        %107 = OpCompositeConstruct %v4float %106 %float_2 %float_3 %float_4
218        %108 = OpCompositeConstruct %Compound %107 %100
219               OpStore %c2 %108
220        %110 = OpAccessChain %_ptr_Uniform_v4float %11 %int_1
221        %111 = OpLoad %v4float %110
222        %112 = OpCompositeExtract %float %111 0
223        %113 = OpCompositeConstruct %v4float %112 %float_2 %float_3 %float_4
224        %114 = OpCompositeConstruct %Compound %113 %100
225               OpStore %c3 %114
226        %119 = OpLoad %float %x
227        %120 = OpFOrdEqual %bool %119 %float_3
228               OpSelectionMerge %122 None
229               OpBranchConditional %120 %121 %122
230        %121 = OpLabel
231        %123 = OpAccessChain %_ptr_Function_float %s_0 %int_0
232        %124 = OpLoad %float %123
233        %125 = OpFOrdEqual %bool %124 %float_2
234               OpBranch %122
235        %122 = OpLabel
236        %126 = OpPhi %bool %false %63 %125 %121
237               OpSelectionMerge %128 None
238               OpBranchConditional %126 %127 %128
239        %127 = OpLabel
240        %129 = OpAccessChain %_ptr_Function_int %s_0 %int_1
241        %130 = OpLoad %int %129
242        %131 = OpIEqual %bool %130 %int_3
243               OpBranch %128
244        %128 = OpLabel
245        %132 = OpPhi %bool %false %122 %131 %127
246               OpSelectionMerge %134 None
247               OpBranchConditional %132 %133 %134
248        %133 = OpLabel
249        %135 = OpLoad %S %s_0
250        %136 = OpLoad %S %expected
251        %137 = OpCompositeExtract %float %135 0
252        %138 = OpCompositeExtract %float %136 0
253        %139 = OpFOrdEqual %bool %137 %138
254        %140 = OpCompositeExtract %int %135 1
255        %141 = OpCompositeExtract %int %136 1
256        %142 = OpIEqual %bool %140 %141
257        %143 = OpLogicalAnd %bool %142 %139
258               OpBranch %134
259        %134 = OpLabel
260        %144 = OpPhi %bool %false %128 %143 %133
261               OpSelectionMerge %146 None
262               OpBranchConditional %144 %145 %146
263        %145 = OpLabel
264        %147 = OpLoad %S %s_0
265        %148 = OpCompositeConstruct %S %float_2 %int_3
266        %149 = OpCompositeExtract %float %147 0
267        %150 = OpFOrdEqual %bool %149 %float_2
268        %151 = OpCompositeExtract %int %147 1
269        %152 = OpIEqual %bool %151 %int_3
270        %153 = OpLogicalAnd %bool %152 %150
271               OpBranch %146
272        %146 = OpLabel
273        %154 = OpPhi %bool %false %134 %153 %145
274               OpSelectionMerge %156 None
275               OpBranchConditional %154 %155 %156
276        %155 = OpLabel
277        %157 = OpLoad %S %s_0
278        %158 = OpFunctionCall %S %returns_a_struct_S
279        %159 = OpCompositeExtract %float %157 0
280        %160 = OpCompositeExtract %float %158 0
281        %161 = OpFUnordNotEqual %bool %159 %160
282        %162 = OpCompositeExtract %int %157 1
283        %163 = OpCompositeExtract %int %158 1
284        %164 = OpINotEqual %bool %162 %163
285        %165 = OpLogicalOr %bool %164 %161
286               OpBranch %156
287        %156 = OpLabel
288        %166 = OpPhi %bool %false %146 %165 %155
289               OpSelectionMerge %168 None
290               OpBranchConditional %166 %167 %168
291        %167 = OpLabel
292        %169 = OpLoad %Nested %n1
293        %170 = OpLoad %Nested %n2
294        %171 = OpCompositeExtract %S %169 0
295        %172 = OpCompositeExtract %S %170 0
296        %173 = OpCompositeExtract %float %171 0
297        %174 = OpCompositeExtract %float %172 0
298        %175 = OpFOrdEqual %bool %173 %174
299        %176 = OpCompositeExtract %int %171 1
300        %177 = OpCompositeExtract %int %172 1
301        %178 = OpIEqual %bool %176 %177
302        %179 = OpLogicalAnd %bool %178 %175
303        %180 = OpCompositeExtract %S %169 1
304        %181 = OpCompositeExtract %S %170 1
305        %182 = OpCompositeExtract %float %180 0
306        %183 = OpCompositeExtract %float %181 0
307        %184 = OpFOrdEqual %bool %182 %183
308        %185 = OpCompositeExtract %int %180 1
309        %186 = OpCompositeExtract %int %181 1
310        %187 = OpIEqual %bool %185 %186
311        %188 = OpLogicalAnd %bool %187 %184
312        %189 = OpLogicalAnd %bool %188 %179
313               OpBranch %168
314        %168 = OpLabel
315        %190 = OpPhi %bool %false %156 %189 %167
316               OpSelectionMerge %192 None
317               OpBranchConditional %190 %191 %192
318        %191 = OpLabel
319        %193 = OpLoad %Nested %n1
320        %194 = OpLoad %Nested %n3
321        %195 = OpCompositeExtract %S %193 0
322        %196 = OpCompositeExtract %S %194 0
323        %197 = OpCompositeExtract %float %195 0
324        %198 = OpCompositeExtract %float %196 0
325        %199 = OpFUnordNotEqual %bool %197 %198
326        %200 = OpCompositeExtract %int %195 1
327        %201 = OpCompositeExtract %int %196 1
328        %202 = OpINotEqual %bool %200 %201
329        %203 = OpLogicalOr %bool %202 %199
330        %204 = OpCompositeExtract %S %193 1
331        %205 = OpCompositeExtract %S %194 1
332        %206 = OpCompositeExtract %float %204 0
333        %207 = OpCompositeExtract %float %205 0
334        %208 = OpFUnordNotEqual %bool %206 %207
335        %209 = OpCompositeExtract %int %204 1
336        %210 = OpCompositeExtract %int %205 1
337        %211 = OpINotEqual %bool %209 %210
338        %212 = OpLogicalOr %bool %211 %208
339        %213 = OpLogicalOr %bool %212 %203
340               OpBranch %192
341        %192 = OpLabel
342        %214 = OpPhi %bool %false %168 %213 %191
343               OpSelectionMerge %216 None
344               OpBranchConditional %214 %215 %216
345        %215 = OpLabel
346        %217 = OpLoad %Nested %n3
347        %218 = OpCompositeConstruct %S %float_1 %int_2
348        %219 = OpCompositeConstruct %S %float_2 %int_3
349        %220 = OpCompositeConstruct %Nested %218 %219
350        %221 = OpCompositeExtract %S %217 0
351        %222 = OpCompositeExtract %float %221 0
352        %223 = OpFOrdEqual %bool %222 %float_1
353        %224 = OpCompositeExtract %int %221 1
354        %225 = OpIEqual %bool %224 %int_2
355        %226 = OpLogicalAnd %bool %225 %223
356        %227 = OpCompositeExtract %S %217 1
357        %228 = OpCompositeExtract %float %227 0
358        %229 = OpFOrdEqual %bool %228 %float_2
359        %230 = OpCompositeExtract %int %227 1
360        %231 = OpIEqual %bool %230 %int_3
361        %232 = OpLogicalAnd %bool %231 %229
362        %233 = OpLogicalAnd %bool %232 %226
363               OpBranch %216
364        %216 = OpLabel
365        %234 = OpPhi %bool %false %192 %233 %215
366               OpSelectionMerge %236 None
367               OpBranchConditional %234 %235 %236
368        %235 = OpLabel
369        %237 = OpFOrdEqual %v4bool %96 %107
370        %239 = OpAll %bool %237
371        %241 = OpLogicalAnd %bool %true %239
372               OpBranch %236
373        %236 = OpLabel
374        %242 = OpPhi %bool %false %216 %241 %235
375               OpSelectionMerge %244 None
376               OpBranchConditional %242 %243 %244
377        %243 = OpLabel
378        %245 = OpFUnordNotEqual %v4bool %107 %113
379        %246 = OpAny %bool %245
380        %247 = OpLogicalOr %bool %false %246
381               OpBranch %244
382        %244 = OpLabel
383        %248 = OpPhi %bool %false %236 %247 %243
384               OpStore %valid %248
385               OpSelectionMerge %253 None
386               OpBranchConditional %248 %251 %252
387        %251 = OpLabel
388        %254 = OpAccessChain %_ptr_Uniform_v4float %11 %int_1
389        %255 = OpLoad %v4float %254
390               OpStore %249 %255
391               OpBranch %253
392        %252 = OpLabel
393        %256 = OpAccessChain %_ptr_Uniform_v4float %11 %int_0
394        %257 = OpLoad %v4float %256
395               OpStore %249 %257
396               OpBranch %253
397        %253 = OpLabel
398        %258 = OpLoad %v4float %249
399               OpReturnValue %258
400               OpFunctionEnd
401