xref: /aosp_15_r20/external/skia/tests/sksl/compute/AtomicOperations.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 64 1 1
6               OpName %ssbo "ssbo"
7               OpMemberName %ssbo 0 "globalCounter"
8               OpName %sk_LocalInvocationID "sk_LocalInvocationID"
9               OpName %localCounter "localCounter"
10               OpName %main "main"
11               OpMemberDecorate %ssbo 0 Offset 0
12               OpMemberDecorate %ssbo 0 RelaxedPrecision
13               OpDecorate %ssbo BufferBlock
14               OpDecorate %3 Binding 0
15               OpDecorate %3 DescriptorSet 0
16               OpDecorate %sk_LocalInvocationID BuiltIn LocalInvocationId
17       %uint = OpTypeInt 32 0
18       %ssbo = OpTypeStruct %uint
19%_ptr_Uniform_ssbo = OpTypePointer Uniform %ssbo
20          %3 = OpVariable %_ptr_Uniform_ssbo Uniform
21     %v3uint = OpTypeVector %uint 3
22%_ptr_Input_v3uint = OpTypePointer Input %v3uint
23%sk_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input
24%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
25%localCounter = OpVariable %_ptr_Workgroup_uint Workgroup
26       %void = OpTypeVoid
27         %13 = OpTypeFunction %void
28     %uint_0 = OpConstant %uint 0
29       %bool = OpTypeBool
30     %uint_2 = OpConstant %uint 2
31   %uint_264 = OpConstant %uint 264
32     %uint_1 = OpConstant %uint 1
33        %int = OpTypeInt 32 1
34      %int_0 = OpConstant %int 0
35%_ptr_Uniform_uint = OpTypePointer Uniform %uint
36       %main = OpFunction %void None %13
37         %14 = OpLabel
38         %15 = OpLoad %v3uint %sk_LocalInvocationID
39         %16 = OpCompositeExtract %uint %15 0
40         %18 = OpIEqual %bool %16 %uint_0
41               OpSelectionMerge %21 None
42               OpBranchConditional %18 %20 %21
43         %20 = OpLabel
44               OpAtomicStore %localCounter %uint_2 %uint_0 %uint_0
45               OpBranch %21
46         %21 = OpLabel
47               OpControlBarrier %uint_2 %uint_2 %uint_264
48         %26 = OpAtomicIAdd %uint %localCounter %uint_2 %uint_0 %uint_1
49               OpControlBarrier %uint_2 %uint_2 %uint_264
50         %29 = OpLoad %v3uint %sk_LocalInvocationID
51         %30 = OpCompositeExtract %uint %29 0
52         %31 = OpIEqual %bool %30 %uint_0
53               OpSelectionMerge %33 None
54               OpBranchConditional %31 %32 %33
55         %32 = OpLabel
56         %37 = OpAccessChain %_ptr_Uniform_uint %3 %int_0
57         %39 = OpAtomicLoad %uint %localCounter %uint_2 %uint_0
58         %34 = OpAtomicIAdd %uint %37 %uint_1 %uint_0 %39
59               OpBranch %33
60         %33 = OpLabel
61               OpReturn
62               OpFunctionEnd
63