xref: /aosp_15_r20/external/skia/tests/sksl/shared/SwitchWithFallthrough.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               OpName %_entrypoint_v "_entrypoint_v"
11               OpName %switch_fallthrough_twice_bi "switch_fallthrough_twice_bi"
12               OpName %ok "ok"
13               OpName %main "main"
14               OpName %x "x"
15               OpName %_0_ok "_0_ok"
16               OpDecorate %sk_FragColor RelaxedPrecision
17               OpDecorate %sk_FragColor Location 0
18               OpDecorate %sk_FragColor Index 0
19               OpMemberDecorate %_UniformBuffer 0 Offset 0
20               OpMemberDecorate %_UniformBuffer 0 RelaxedPrecision
21               OpMemberDecorate %_UniformBuffer 1 Offset 16
22               OpMemberDecorate %_UniformBuffer 1 RelaxedPrecision
23               OpDecorate %_UniformBuffer Block
24               OpDecorate %8 Binding 0
25               OpDecorate %8 DescriptorSet 0
26               OpDecorate %38 RelaxedPrecision
27               OpDecorate %46 RelaxedPrecision
28               OpDecorate %47 RelaxedPrecision
29               OpDecorate %55 RelaxedPrecision
30               OpDecorate %67 RelaxedPrecision
31               OpDecorate %70 RelaxedPrecision
32               OpDecorate %71 RelaxedPrecision
33      %float = OpTypeFloat 32
34    %v4float = OpTypeVector %float 4
35%_ptr_Output_v4float = OpTypePointer Output %v4float
36%sk_FragColor = OpVariable %_ptr_Output_v4float Output
37%_UniformBuffer = OpTypeStruct %v4float %v4float
38%_ptr_Uniform__UniformBuffer = OpTypePointer Uniform %_UniformBuffer
39          %8 = OpVariable %_ptr_Uniform__UniformBuffer Uniform
40       %void = OpTypeVoid
41         %13 = OpTypeFunction %void
42    %float_0 = OpConstant %float 0
43    %v2float = OpTypeVector %float 2
44         %17 = OpConstantComposite %v2float %float_0 %float_0
45%_ptr_Function_v2float = OpTypePointer Function %v2float
46       %bool = OpTypeBool
47        %int = OpTypeInt 32 1
48%_ptr_Function_int = OpTypePointer Function %int
49         %24 = OpTypeFunction %bool %_ptr_Function_int
50%_ptr_Function_bool = OpTypePointer Function %bool
51      %false = OpConstantFalse %bool
52       %true = OpConstantTrue %bool
53         %39 = OpTypeFunction %v4float %_ptr_Function_v2float
54%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
55      %int_0 = OpConstant %int 0
56%_ptr_Function_v4float = OpTypePointer Function %v4float
57      %int_1 = OpConstant %int 1
58%_entrypoint_v = OpFunction %void None %13
59         %14 = OpLabel
60         %18 = OpVariable %_ptr_Function_v2float Function
61               OpStore %18 %17
62         %20 = OpFunctionCall %v4float %main %18
63               OpStore %sk_FragColor %20
64               OpReturn
65               OpFunctionEnd
66%switch_fallthrough_twice_bi = OpFunction %bool None %24
67         %25 = OpFunctionParameter %_ptr_Function_int
68         %26 = OpLabel
69         %ok = OpVariable %_ptr_Function_bool Function
70               OpStore %ok %false
71         %30 = OpLoad %int %25
72               OpSelectionMerge %31 None
73               OpSwitch %30 %36 0 %32 1 %35 2 %35 3 %35
74         %32 = OpLabel
75               OpBranch %31
76         %35 = OpLabel
77               OpStore %ok %true
78               OpBranch %31
79         %36 = OpLabel
80               OpBranch %31
81         %31 = OpLabel
82         %38 = OpLoad %bool %ok
83               OpReturnValue %38
84               OpFunctionEnd
85       %main = OpFunction %v4float None %39
86         %40 = OpFunctionParameter %_ptr_Function_v2float
87         %41 = OpLabel
88          %x = OpVariable %_ptr_Function_int Function
89      %_0_ok = OpVariable %_ptr_Function_bool Function
90         %58 = OpVariable %_ptr_Function_int Function
91         %61 = OpVariable %_ptr_Function_v4float Function
92         %43 = OpAccessChain %_ptr_Uniform_v4float %8 %int_0
93         %46 = OpLoad %v4float %43
94         %47 = OpCompositeExtract %float %46 1
95         %48 = OpConvertFToS %int %47
96               OpStore %x %48
97               OpStore %_0_ok %false
98               OpSelectionMerge %50 None
99               OpSwitch %48 %54 2 %51 1 %53 0 %53
100         %51 = OpLabel
101               OpBranch %50
102         %53 = OpLabel
103               OpStore %_0_ok %true
104               OpBranch %50
105         %54 = OpLabel
106               OpBranch %50
107         %50 = OpLabel
108         %55 = OpLoad %bool %_0_ok
109               OpSelectionMerge %57 None
110               OpBranchConditional %55 %56 %57
111         %56 = OpLabel
112               OpStore %58 %48
113         %59 = OpFunctionCall %bool %switch_fallthrough_twice_bi %58
114               OpBranch %57
115         %57 = OpLabel
116         %60 = OpPhi %bool %false %50 %59 %56
117               OpSelectionMerge %65 None
118               OpBranchConditional %60 %63 %64
119         %63 = OpLabel
120         %66 = OpAccessChain %_ptr_Uniform_v4float %8 %int_0
121         %67 = OpLoad %v4float %66
122               OpStore %61 %67
123               OpBranch %65
124         %64 = OpLabel
125         %68 = OpAccessChain %_ptr_Uniform_v4float %8 %int_1
126         %70 = OpLoad %v4float %68
127               OpStore %61 %70
128               OpBranch %65
129         %65 = OpLabel
130         %71 = OpLoad %v4float %61
131               OpReturnValue %71
132               OpFunctionEnd
133