xref: /aosp_15_r20/external/skia/tests/sksl/shared/MatrixIndexLookup.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 "colorGreen"
9               OpMemberName %_UniformBuffer 1 "colorRed"
10               OpMemberName %_UniformBuffer 2 "testMatrix3x3"
11               OpMemberName %_UniformBuffer 3 "testMatrix4x4"
12               OpName %_entrypoint_v "_entrypoint_v"
13               OpName %test3x3_b "test3x3_b"
14               OpName %matrix "matrix"
15               OpName %expected "expected"
16               OpName %index "index"
17               OpName %test4x4_b "test4x4_b"
18               OpName %matrix_0 "matrix"
19               OpName %expected_0 "expected"
20               OpName %index_0 "index"
21               OpName %main "main"
22               OpDecorate %sk_FragColor RelaxedPrecision
23               OpDecorate %sk_FragColor Location 0
24               OpDecorate %sk_FragColor Index 0
25               OpMemberDecorate %_UniformBuffer 0 Offset 0
26               OpMemberDecorate %_UniformBuffer 0 RelaxedPrecision
27               OpMemberDecorate %_UniformBuffer 1 Offset 16
28               OpMemberDecorate %_UniformBuffer 1 RelaxedPrecision
29               OpMemberDecorate %_UniformBuffer 2 Offset 32
30               OpMemberDecorate %_UniformBuffer 2 ColMajor
31               OpMemberDecorate %_UniformBuffer 2 MatrixStride 16
32               OpMemberDecorate %_UniformBuffer 3 Offset 80
33               OpMemberDecorate %_UniformBuffer 3 ColMajor
34               OpMemberDecorate %_UniformBuffer 3 MatrixStride 16
35               OpDecorate %_UniformBuffer Block
36               OpDecorate %9 Binding 0
37               OpDecorate %9 DescriptorSet 0
38               OpDecorate %116 RelaxedPrecision
39               OpDecorate %118 RelaxedPrecision
40               OpDecorate %119 RelaxedPrecision
41      %float = OpTypeFloat 32
42    %v4float = OpTypeVector %float 4
43%_ptr_Output_v4float = OpTypePointer Output %v4float
44%sk_FragColor = OpVariable %_ptr_Output_v4float Output
45    %v3float = OpTypeVector %float 3
46%mat3v3float = OpTypeMatrix %v3float 3
47%mat4v4float = OpTypeMatrix %v4float 4
48%_UniformBuffer = OpTypeStruct %v4float %v4float %mat3v3float %mat4v4float
49%_ptr_Uniform__UniformBuffer = OpTypePointer Uniform %_UniformBuffer
50          %9 = OpVariable %_ptr_Uniform__UniformBuffer Uniform
51       %void = OpTypeVoid
52         %17 = OpTypeFunction %void
53    %float_0 = OpConstant %float 0
54    %v2float = OpTypeVector %float 2
55         %21 = OpConstantComposite %v2float %float_0 %float_0
56%_ptr_Function_v2float = OpTypePointer Function %v2float
57       %bool = OpTypeBool
58         %26 = OpTypeFunction %bool
59%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float
60%_ptr_Uniform_mat3v3float = OpTypePointer Uniform %mat3v3float
61        %int = OpTypeInt 32 1
62      %int_2 = OpConstant %int 2
63%_ptr_Function_v3float = OpTypePointer Function %v3float
64    %float_1 = OpConstant %float 1
65    %float_2 = OpConstant %float 2
66    %float_3 = OpConstant %float 3
67         %40 = OpConstantComposite %v3float %float_1 %float_2 %float_3
68%_ptr_Function_int = OpTypePointer Function %int
69      %int_0 = OpConstant %int 0
70      %int_3 = OpConstant %int 3
71     %v3bool = OpTypeVector %bool 3
72      %false = OpConstantFalse %bool
73         %63 = OpConstantComposite %v3float %float_3 %float_3 %float_3
74      %int_1 = OpConstant %int 1
75       %true = OpConstantTrue %bool
76%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float
77%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float
78%_ptr_Function_v4float = OpTypePointer Function %v4float
79    %float_4 = OpConstant %float 4
80         %78 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
81      %int_4 = OpConstant %int 4
82     %v4bool = OpTypeVector %bool 4
83         %98 = OpConstantComposite %v4float %float_4 %float_4 %float_4 %float_4
84        %102 = OpTypeFunction %v4float %_ptr_Function_v2float
85%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
86%_entrypoint_v = OpFunction %void None %17
87         %18 = OpLabel
88         %22 = OpVariable %_ptr_Function_v2float Function
89               OpStore %22 %21
90         %24 = OpFunctionCall %v4float %main %22
91               OpStore %sk_FragColor %24
92               OpReturn
93               OpFunctionEnd
94  %test3x3_b = OpFunction %bool None %26
95         %27 = OpLabel
96     %matrix = OpVariable %_ptr_Function_mat3v3float Function
97   %expected = OpVariable %_ptr_Function_v3float Function
98      %index = OpVariable %_ptr_Function_int Function
99         %30 = OpAccessChain %_ptr_Uniform_mat3v3float %9 %int_2
100         %34 = OpLoad %mat3v3float %30
101               OpStore %matrix %34
102               OpStore %expected %40
103               OpStore %index %int_0
104               OpBranch %44
105         %44 = OpLabel
106               OpLoopMerge %48 %47 None
107               OpBranch %45
108         %45 = OpLabel
109         %49 = OpLoad %int %index
110         %51 = OpSLessThan %bool %49 %int_3
111               OpBranchConditional %51 %46 %48
112         %46 = OpLabel
113         %52 = OpLoad %int %index
114         %53 = OpAccessChain %_ptr_Function_v3float %matrix %52
115         %54 = OpLoad %v3float %53
116         %55 = OpLoad %v3float %expected
117         %56 = OpFUnordNotEqual %v3bool %54 %55
118         %58 = OpAny %bool %56
119               OpSelectionMerge %60 None
120               OpBranchConditional %58 %59 %60
121         %59 = OpLabel
122               OpReturnValue %false
123         %60 = OpLabel
124         %62 = OpLoad %v3float %expected
125         %64 = OpFAdd %v3float %62 %63
126               OpStore %expected %64
127               OpBranch %47
128         %47 = OpLabel
129         %66 = OpLoad %int %index
130         %67 = OpIAdd %int %66 %int_1
131               OpStore %index %67
132               OpBranch %44
133         %48 = OpLabel
134               OpReturnValue %true
135               OpFunctionEnd
136  %test4x4_b = OpFunction %bool None %26
137         %69 = OpLabel
138   %matrix_0 = OpVariable %_ptr_Function_mat4v4float Function
139 %expected_0 = OpVariable %_ptr_Function_v4float Function
140    %index_0 = OpVariable %_ptr_Function_int Function
141         %72 = OpAccessChain %_ptr_Uniform_mat4v4float %9 %int_3
142         %74 = OpLoad %mat4v4float %72
143               OpStore %matrix_0 %74
144               OpStore %expected_0 %78
145               OpStore %index_0 %int_0
146               OpBranch %80
147         %80 = OpLabel
148               OpLoopMerge %84 %83 None
149               OpBranch %81
150         %81 = OpLabel
151         %85 = OpLoad %int %index_0
152         %87 = OpSLessThan %bool %85 %int_4
153               OpBranchConditional %87 %82 %84
154         %82 = OpLabel
155         %88 = OpLoad %int %index_0
156         %89 = OpAccessChain %_ptr_Function_v4float %matrix_0 %88
157         %90 = OpLoad %v4float %89
158         %91 = OpLoad %v4float %expected_0
159         %92 = OpFUnordNotEqual %v4bool %90 %91
160         %94 = OpAny %bool %92
161               OpSelectionMerge %96 None
162               OpBranchConditional %94 %95 %96
163         %95 = OpLabel
164               OpReturnValue %false
165         %96 = OpLabel
166         %97 = OpLoad %v4float %expected_0
167         %99 = OpFAdd %v4float %97 %98
168               OpStore %expected_0 %99
169               OpBranch %83
170         %83 = OpLabel
171        %100 = OpLoad %int %index_0
172        %101 = OpIAdd %int %100 %int_1
173               OpStore %index_0 %101
174               OpBranch %80
175         %84 = OpLabel
176               OpReturnValue %true
177               OpFunctionEnd
178       %main = OpFunction %v4float None %102
179        %103 = OpFunctionParameter %_ptr_Function_v2float
180        %104 = OpLabel
181        %110 = OpVariable %_ptr_Function_v4float Function
182        %105 = OpFunctionCall %bool %test3x3_b
183               OpSelectionMerge %107 None
184               OpBranchConditional %105 %106 %107
185        %106 = OpLabel
186        %108 = OpFunctionCall %bool %test4x4_b
187               OpBranch %107
188        %107 = OpLabel
189        %109 = OpPhi %bool %false %104 %108 %106
190               OpSelectionMerge %113 None
191               OpBranchConditional %109 %111 %112
192        %111 = OpLabel
193        %114 = OpAccessChain %_ptr_Uniform_v4float %9 %int_0
194        %116 = OpLoad %v4float %114
195               OpStore %110 %116
196               OpBranch %113
197        %112 = OpLabel
198        %117 = OpAccessChain %_ptr_Uniform_v4float %9 %int_1
199        %118 = OpLoad %v4float %117
200               OpStore %110 %118
201               OpBranch %113
202        %113 = OpLabel
203        %119 = OpLoad %v4float %110
204               OpReturnValue %119
205               OpFunctionEnd
206