#version 460
#extension GL_EXT_buffer_reference2 : require
#extension GL_EXT_buffer_reference_uvec2 : require
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

layout(buffer_reference) buffer PhysicalPointerUintArray;
layout(buffer_reference, buffer_reference_align = 4, std430) buffer PhysicalPointerUintArray
{
    uint value[];
};

layout(push_constant, std430) uniform RootConstants
{
    uvec2 _m0;
    uvec2 _m1;
    uvec2 _m2;
    uvec2 _m3;
} registers;

void main()
{
    uint _28 = atomicCompSwap(PhysicalPointerUintArray(registers._m2).value[gl_GlobalInvocationID.x], 1u, 2u);
}


#if 0
// SPIR-V disassembly
; SPIR-V
; Version: 1.3
; Generator: Unknown(30017); 21022
; Bound: 32
; Schema: 0
OpCapability Shader
OpCapability PhysicalStorageBufferAddresses
OpExtension "SPV_KHR_physical_storage_buffer"
OpMemoryModel PhysicalStorageBuffer64 GLSL450
OpEntryPoint GLCompute %3 "main" %16
OpExecutionMode %3 LocalSize 1 1 1
OpName %3 "main"
OpName %7 "RootConstants"
OpName %9 "registers"
OpName %23 "PhysicalPointerUintArray"
OpMemberName %23 0 "value"
OpDecorate %7 Block
OpMemberDecorate %7 0 Offset 0
OpMemberDecorate %7 1 Offset 8
OpMemberDecorate %7 2 Offset 16
OpMemberDecorate %7 3 Offset 24
OpDecorate %16 BuiltIn GlobalInvocationId
OpDecorate %22 ArrayStride 4
OpMemberDecorate %23 0 Offset 0
OpDecorate %23 Block
%1 = OpTypeVoid
%2 = OpTypeFunction %1
%5 = OpTypeInt 32 0
%6 = OpTypeVector %5 2
%7 = OpTypeStruct %6 %6 %6 %6
%8 = OpTypePointer PushConstant %7
%9 = OpVariable %8 PushConstant
%10 = OpTypePointer PushConstant %6
%12 = OpConstant %5 2
%14 = OpTypeVector %5 3
%15 = OpTypePointer Input %14
%16 = OpVariable %15 Input
%17 = OpTypePointer Input %5
%19 = OpConstant %5 0
%22 = OpTypeRuntimeArray %5
%23 = OpTypeStruct %22
%24 = OpTypePointer PhysicalStorageBuffer %23
%26 = OpTypePointer PhysicalStorageBuffer %5
%29 = OpConstant %5 1
%3 = OpFunction %1 None %2
%4 = OpLabel
OpBranch %30
%30 = OpLabel
%11 = OpAccessChain %10 %9 %12
%13 = OpLoad %6 %11
%18 = OpAccessChain %17 %16 %19
%20 = OpLoad %5 %18
%21 = OpShiftLeftLogical %5 %20 %12
%25 = OpBitcast %24 %13
%27 = OpAccessChain %26 %25 %19 %20
%28 = OpAtomicCompareExchange %5 %27 %29 %19 %19 %12 %29
OpReturn
OpFunctionEnd
#endif
