xref: /aosp_15_r20/external/skia/tests/sksl/intrinsics/PackSnorm2x16.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 "testInputs"
11               OpName %_entrypoint_v "_entrypoint_v"
12               OpName %main "main"
13               OpName %xy "xy"
14               OpName %zw "zw"
15               OpDecorate %sk_FragColor RelaxedPrecision
16               OpDecorate %sk_FragColor Location 0
17               OpDecorate %sk_FragColor Index 0
18               OpMemberDecorate %_UniformBuffer 0 Offset 0
19               OpMemberDecorate %_UniformBuffer 0 RelaxedPrecision
20               OpMemberDecorate %_UniformBuffer 1 Offset 16
21               OpMemberDecorate %_UniformBuffer 1 RelaxedPrecision
22               OpMemberDecorate %_UniformBuffer 2 Offset 32
23               OpDecorate %_UniformBuffer Block
24               OpDecorate %7 Binding 0
25               OpDecorate %7 DescriptorSet 0
26               OpDecorate %68 RelaxedPrecision
27               OpDecorate %71 RelaxedPrecision
28               OpDecorate %72 RelaxedPrecision
29      %float = OpTypeFloat 32
30    %v4float = OpTypeVector %float 4
31%_ptr_Output_v4float = OpTypePointer Output %v4float
32%sk_FragColor = OpVariable %_ptr_Output_v4float Output
33%_UniformBuffer = OpTypeStruct %v4float %v4float %v4float
34%_ptr_Uniform__UniformBuffer = OpTypePointer Uniform %_UniformBuffer
35          %7 = OpVariable %_ptr_Uniform__UniformBuffer Uniform
36       %void = OpTypeVoid
37         %12 = OpTypeFunction %void
38    %float_0 = OpConstant %float 0
39    %v2float = OpTypeVector %float 2
40         %16 = OpConstantComposite %v2float %float_0 %float_0
41%_ptr_Function_v2float = OpTypePointer Function %v2float
42         %20 = OpTypeFunction %v4float %_ptr_Function_v2float
43       %uint = OpTypeInt 32 0
44%_ptr_Function_uint = OpTypePointer Function %uint
45%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
46        %int = OpTypeInt 32 1
47      %int_2 = OpConstant %int 2
48       %bool = OpTypeBool
49      %false = OpConstantFalse %bool
50   %float_n1 = OpConstant %float -1
51         %45 = OpConstantComposite %v2float %float_n1 %float_0
52%float_0_015625 = OpConstant %float 0.015625
53         %48 = OpConstantComposite %v2float %float_0_015625 %float_0_015625
54     %v2bool = OpTypeVector %bool 2
55 %float_0_75 = OpConstant %float 0.75
56    %float_1 = OpConstant %float 1
57         %58 = OpConstantComposite %v2float %float_0_75 %float_1
58%_ptr_Function_v4float = OpTypePointer Function %v4float
59      %int_0 = OpConstant %int 0
60      %int_1 = OpConstant %int 1
61%_entrypoint_v = OpFunction %void None %12
62         %13 = OpLabel
63         %17 = OpVariable %_ptr_Function_v2float Function
64               OpStore %17 %16
65         %19 = OpFunctionCall %v4float %main %17
66               OpStore %sk_FragColor %19
67               OpReturn
68               OpFunctionEnd
69       %main = OpFunction %v4float None %20
70         %21 = OpFunctionParameter %_ptr_Function_v2float
71         %22 = OpLabel
72         %xy = OpVariable %_ptr_Function_uint Function
73         %zw = OpVariable %_ptr_Function_uint Function
74         %61 = OpVariable %_ptr_Function_v4float Function
75         %27 = OpAccessChain %_ptr_Uniform_v4float %7 %int_2
76         %31 = OpLoad %v4float %27
77         %32 = OpVectorShuffle %v2float %31 %31 0 1
78         %26 = OpExtInst %uint %1 PackSnorm2x16 %32
79               OpStore %xy %26
80         %35 = OpAccessChain %_ptr_Uniform_v4float %7 %int_2
81         %36 = OpLoad %v4float %35
82         %37 = OpVectorShuffle %v2float %36 %36 2 3
83         %34 = OpExtInst %uint %1 PackSnorm2x16 %37
84               OpStore %zw %34
85         %43 = OpExtInst %v2float %1 UnpackSnorm2x16 %26
86         %46 = OpFSub %v2float %43 %45
87         %42 = OpExtInst %v2float %1 FAbs %46
88         %41 = OpFOrdLessThan %v2bool %42 %48
89         %40 = OpAll %bool %41
90               OpSelectionMerge %51 None
91               OpBranchConditional %40 %50 %51
92         %50 = OpLabel
93         %55 = OpExtInst %v2float %1 UnpackSnorm2x16 %34
94         %59 = OpFSub %v2float %55 %58
95         %54 = OpExtInst %v2float %1 FAbs %59
96         %53 = OpFOrdLessThan %v2bool %54 %48
97         %52 = OpAll %bool %53
98               OpBranch %51
99         %51 = OpLabel
100         %60 = OpPhi %bool %false %22 %52 %50
101               OpSelectionMerge %65 None
102               OpBranchConditional %60 %63 %64
103         %63 = OpLabel
104         %66 = OpAccessChain %_ptr_Uniform_v4float %7 %int_0
105         %68 = OpLoad %v4float %66
106               OpStore %61 %68
107               OpBranch %65
108         %64 = OpLabel
109         %69 = OpAccessChain %_ptr_Uniform_v4float %7 %int_1
110         %71 = OpLoad %v4float %69
111               OpStore %61 %71
112               OpBranch %65
113         %65 = OpLabel
114         %72 = OpLoad %v4float %61
115               OpReturnValue %72
116               OpFunctionEnd
117