xref: /aosp_15_r20/external/skia/tests/sksl/compute/AtomicOperationsOverArrayAndStruct.asm.comp (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1               OpCapability Shader
2          %1 = OpExtInstImport "GLSL.std.450"
3               OpMemoryModel Logical GLSL450
4               OpEntryPoint GLCompute %main "main" %sk_LocalInvocationID
5               OpExecutionMode %main LocalSize 256 1 1
6               OpName %GlobalCounts "GlobalCounts"
7               OpMemberName %GlobalCounts 0 "firstHalfCount"
8               OpMemberName %GlobalCounts 1 "secondHalfCount"
9               OpName %ssbo "ssbo"
10               OpMemberName %ssbo 0 "globalCounts"
11               OpName %sk_LocalInvocationID "sk_LocalInvocationID"
12               OpName %localCounts "localCounts"
13               OpName %main "main"
14               OpName %idx "idx"
15               OpMemberDecorate %GlobalCounts 0 Offset 0
16               OpMemberDecorate %GlobalCounts 0 RelaxedPrecision
17               OpMemberDecorate %GlobalCounts 1 Offset 4
18               OpMemberDecorate %GlobalCounts 1 RelaxedPrecision
19               OpMemberDecorate %ssbo 0 Offset 0
20               OpMemberDecorate %ssbo 0 RelaxedPrecision
21               OpDecorate %ssbo BufferBlock
22               OpDecorate %3 Binding 0
23               OpDecorate %3 DescriptorSet 0
24               OpDecorate %sk_LocalInvocationID BuiltIn LocalInvocationId
25               OpDecorate %_arr_uint_int_2 ArrayStride 16
26       %uint = OpTypeInt 32 0
27%GlobalCounts = OpTypeStruct %uint %uint
28       %ssbo = OpTypeStruct %GlobalCounts
29%_ptr_Uniform_ssbo = OpTypePointer Uniform %ssbo
30          %3 = OpVariable %_ptr_Uniform_ssbo Uniform
31     %v3uint = OpTypeVector %uint 3
32%_ptr_Input_v3uint = OpTypePointer Input %v3uint
33%sk_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input
34        %int = OpTypeInt 32 1
35      %int_2 = OpConstant %int 2
36%_arr_uint_int_2 = OpTypeArray %uint %int_2
37%_ptr_Workgroup__arr_uint_int_2 = OpTypePointer Workgroup %_arr_uint_int_2
38%localCounts = OpVariable %_ptr_Workgroup__arr_uint_int_2 Workgroup
39       %void = OpTypeVoid
40         %17 = OpTypeFunction %void
41     %uint_0 = OpConstant %uint 0
42       %bool = OpTypeBool
43      %int_0 = OpConstant %int 0
44%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
45     %uint_2 = OpConstant %uint 2
46      %int_1 = OpConstant %int 1
47   %uint_264 = OpConstant %uint 264
48%_ptr_Function_uint = OpTypePointer Function %uint
49   %uint_128 = OpConstant %uint 128
50     %uint_1 = OpConstant %uint 1
51%_ptr_Uniform_uint = OpTypePointer Uniform %uint
52       %main = OpFunction %void None %17
53         %18 = OpLabel
54        %idx = OpVariable %_ptr_Function_uint Function
55         %19 = OpLoad %v3uint %sk_LocalInvocationID
56         %20 = OpCompositeExtract %uint %19 0
57         %22 = OpIEqual %bool %20 %uint_0
58               OpSelectionMerge %25 None
59               OpBranchConditional %22 %24 %25
60         %24 = OpLabel
61         %28 = OpAccessChain %_ptr_Workgroup_uint %localCounts %int_0
62               OpAtomicStore %28 %uint_2 %uint_0 %uint_0
63         %33 = OpAccessChain %_ptr_Workgroup_uint %localCounts %int_1
64               OpAtomicStore %33 %uint_2 %uint_0 %uint_0
65               OpBranch %25
66         %25 = OpLabel
67               OpControlBarrier %uint_2 %uint_2 %uint_264
68         %38 = OpLoad %v3uint %sk_LocalInvocationID
69         %39 = OpCompositeExtract %uint %38 0
70         %41 = OpULessThan %bool %39 %uint_128
71         %42 = OpSelect %int %41 %int_0 %int_1
72         %43 = OpBitcast %uint %42
73               OpStore %idx %43
74         %45 = OpAccessChain %_ptr_Workgroup_uint %localCounts %43
75         %44 = OpAtomicIAdd %uint %45 %uint_2 %uint_0 %uint_1
76               OpControlBarrier %uint_2 %uint_2 %uint_264
77         %48 = OpLoad %v3uint %sk_LocalInvocationID
78         %49 = OpCompositeExtract %uint %48 0
79         %50 = OpIEqual %bool %49 %uint_0
80               OpSelectionMerge %52 None
81               OpBranchConditional %50 %51 %52
82         %51 = OpLabel
83         %54 = OpAccessChain %_ptr_Uniform_uint %3 %int_0 %int_0
84         %57 = OpAccessChain %_ptr_Workgroup_uint %localCounts %int_0
85         %56 = OpAtomicLoad %uint %57 %uint_2 %uint_0
86         %53 = OpAtomicIAdd %uint %54 %uint_1 %uint_0 %56
87         %59 = OpAccessChain %_ptr_Uniform_uint %3 %int_0 %int_1
88         %61 = OpAccessChain %_ptr_Workgroup_uint %localCounts %int_1
89         %60 = OpAtomicLoad %uint %61 %uint_2 %uint_0
90         %58 = OpAtomicIAdd %uint %59 %uint_1 %uint_0 %60
91               OpBranch %52
92         %52 = OpLabel
93               OpReturn
94               OpFunctionEnd
95