xref: /aosp_15_r20/external/skia/tests/sksl/compute/Raytrace.asm.comp (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1               OpCapability ImageQuery
2               OpCapability Shader
3          %1 = OpExtInstImport "GLSL.std.450"
4               OpMemoryModel Logical GLSL450
5               OpEntryPoint GLCompute %main "main" %sk_GlobalInvocationID
6               OpExecutionMode %main LocalSize 16 16 1
7               OpName %sk_GlobalInvocationID "sk_GlobalInvocationID"
8               OpName %dest "dest"
9               OpName %main "main"
10               OpName %pixel "pixel"
11               OpName %max_x "max_x"
12               OpName %max_y "max_y"
13               OpName %x "x"
14               OpName %y "y"
15               OpName %ray_origin "ray_origin"
16               OpName %ray_target "ray_target"
17               OpName %sphere_center "sphere_center"
18               OpName %sphere_radius "sphere_radius"
19               OpName %t_minus_c "t_minus_c"
20               OpName %b "b"
21               OpName %c "c"
22               OpName %bsqmc "bsqmc"
23               OpDecorate %sk_GlobalInvocationID BuiltIn GlobalInvocationId
24               OpDecorate %dest Binding 0
25               OpDecorate %dest DescriptorSet 0
26               OpDecorate %pixel RelaxedPrecision
27               OpDecorate %32 RelaxedPrecision
28               OpDecorate %37 RelaxedPrecision
29               OpDecorate %46 RelaxedPrecision
30               OpDecorate %51 RelaxedPrecision
31               OpDecorate %85 RelaxedPrecision
32               OpDecorate %88 RelaxedPrecision
33       %uint = OpTypeInt 32 0
34     %v3uint = OpTypeVector %uint 3
35%_ptr_Input_v3uint = OpTypePointer Input %v3uint
36%sk_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
37      %float = OpTypeFloat 32
38          %9 = OpTypeImage %float 2D 0 0 0 2 Rgba32f
39%_ptr_UniformConstant_9 = OpTypePointer UniformConstant %9
40       %dest = OpVariable %_ptr_UniformConstant_9 UniformConstant
41       %void = OpTypeVoid
42         %12 = OpTypeFunction %void
43    %v4float = OpTypeVector %float 4
44%_ptr_Function_v4float = OpTypePointer Function %v4float
45    %float_0 = OpConstant %float 0
46    %float_1 = OpConstant %float 1
47         %19 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
48%_ptr_Function_float = OpTypePointer Function %float
49    %float_5 = OpConstant %float 5
50     %uint_2 = OpConstant %uint 2
51     %v2uint = OpTypeVector %uint 2
52    %v3float = OpTypeVector %float 3
53%_ptr_Function_v3float = OpTypePointer Function %v3float
54   %float_n1 = OpConstant %float -1
55         %58 = OpConstantComposite %v3float %float_0 %float_0 %float_n1
56  %float_n10 = OpConstant %float -10
57         %65 = OpConstantComposite %v3float %float_0 %float_0 %float_n10
58       %bool = OpTypeBool
59%float_0_400000006 = OpConstant %float 0.400000006
60         %83 = OpConstantComposite %v4float %float_0_400000006 %float_0_400000006 %float_1 %float_1
61       %main = OpFunction %void None %12
62         %13 = OpLabel
63      %pixel = OpVariable %_ptr_Function_v4float Function
64      %max_x = OpVariable %_ptr_Function_float Function
65      %max_y = OpVariable %_ptr_Function_float Function
66          %x = OpVariable %_ptr_Function_float Function
67          %y = OpVariable %_ptr_Function_float Function
68 %ray_origin = OpVariable %_ptr_Function_v3float Function
69 %ray_target = OpVariable %_ptr_Function_v3float Function
70%sphere_center = OpVariable %_ptr_Function_v3float Function
71%sphere_radius = OpVariable %_ptr_Function_float Function
72  %t_minus_c = OpVariable %_ptr_Function_v3float Function
73          %b = OpVariable %_ptr_Function_float Function
74          %c = OpVariable %_ptr_Function_float Function
75      %bsqmc = OpVariable %_ptr_Function_float Function
76               OpStore %pixel %19
77               OpStore %max_x %float_5
78               OpStore %max_y %float_5
79         %25 = OpLoad %v3uint %sk_GlobalInvocationID
80         %26 = OpCompositeExtract %uint %25 0
81         %28 = OpIMul %uint %26 %uint_2
82         %32 = OpLoad %9 %dest
83         %31 = OpImageQuerySize %v2uint %32
84         %29 = OpCompositeExtract %uint %31 0
85         %33 = OpISub %uint %28 %29
86         %34 = OpConvertUToF %float %33
87         %37 = OpLoad %9 %dest
88         %36 = OpImageQuerySize %v2uint %37
89         %35 = OpCompositeExtract %uint %36 0
90         %38 = OpConvertUToF %float %35
91         %39 = OpFDiv %float %34 %38
92               OpStore %x %39
93         %41 = OpLoad %v3uint %sk_GlobalInvocationID
94         %42 = OpCompositeExtract %uint %41 1
95         %43 = OpIMul %uint %42 %uint_2
96         %46 = OpLoad %9 %dest
97         %45 = OpImageQuerySize %v2uint %46
98         %44 = OpCompositeExtract %uint %45 1
99         %47 = OpISub %uint %43 %44
100         %48 = OpConvertUToF %float %47
101         %51 = OpLoad %9 %dest
102         %50 = OpImageQuerySize %v2uint %51
103         %49 = OpCompositeExtract %uint %50 1
104         %52 = OpConvertUToF %float %49
105         %53 = OpFDiv %float %48 %52
106               OpStore %y %53
107               OpStore %ray_origin %58
108         %60 = OpFMul %float %39 %float_5
109         %61 = OpFMul %float %53 %float_5
110         %62 = OpCompositeConstruct %v3float %60 %61 %float_0
111               OpStore %ray_target %62
112               OpStore %sphere_center %65
113               OpStore %sphere_radius %float_1
114         %68 = OpFSub %v3float %62 %65
115               OpStore %t_minus_c %68
116         %70 = OpDot %float %58 %68
117               OpStore %b %70
118         %72 = OpDot %float %68 %68
119         %73 = OpFMul %float %float_1 %float_1
120         %74 = OpFSub %float %72 %73
121               OpStore %c %74
122         %76 = OpFMul %float %70 %70
123         %77 = OpFSub %float %76 %74
124               OpStore %bsqmc %77
125         %78 = OpFOrdGreaterThanEqual %bool %77 %float_0
126               OpSelectionMerge %81 None
127               OpBranchConditional %78 %80 %81
128         %80 = OpLabel
129               OpStore %pixel %83
130               OpBranch %81
131         %81 = OpLabel
132         %85 = OpLoad %9 %dest
133         %86 = OpLoad %v3uint %sk_GlobalInvocationID
134         %87 = OpVectorShuffle %v2uint %86 %86 0 1
135         %88 = OpLoad %v4float %pixel
136               OpImageWrite %85 %87 %88
137               OpReturn
138               OpFunctionEnd
139