#version 460
#extension GL_EXT_buffer_reference : 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 PhysicalPointerFloat4NonWriteArray;
layout(buffer_reference) buffer PhysicalPointerFloat4NonWriteCBVArray;
layout(buffer_reference) buffer PhysicalPointerFloat4CoherentArray;
layout(buffer_reference, buffer_reference_align = 4, std430) readonly buffer PhysicalPointerFloat4NonWriteArray
{
    vec4 value[];
};

layout(buffer_reference, buffer_reference_align = 16, std430) readonly buffer PhysicalPointerFloat4NonWriteCBVArray
{
    vec4 value[4096];
};

layout(buffer_reference, buffer_reference_align = 4, std430) coherent buffer PhysicalPointerFloat4CoherentArray
{
    vec4 value[];
};

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

void main()
{
    PhysicalPointerFloat4NonWriteArray _31 = PhysicalPointerFloat4NonWriteArray(registers._m1);
    PhysicalPointerFloat4NonWriteCBVArray _43 = PhysicalPointerFloat4NonWriteCBVArray(registers._m0);
    PhysicalPointerFloat4CoherentArray(registers._m2).value[gl_GlobalInvocationID.x] = vec4(_43.value[gl_GlobalInvocationID.x].x + _31.value[gl_GlobalInvocationID.x].x, _43.value[gl_GlobalInvocationID.x].y + _31.value[gl_GlobalInvocationID.x].y, _43.value[gl_GlobalInvocationID.x].z + _31.value[gl_GlobalInvocationID.x].z, _43.value[gl_GlobalInvocationID.x].w + _31.value[gl_GlobalInvocationID.x].w);
}


#if 0
// SPIR-V disassembly
; SPIR-V
; Version: 1.3
; Generator: Unknown(30017); 21022
; Bound: 62
; Schema: 0
OpCapability Shader
OpCapability PhysicalStorageBufferAddresses
OpExtension "SPV_KHR_physical_storage_buffer"
OpMemoryModel PhysicalStorageBuffer64 GLSL450
OpEntryPoint GLCompute %3 "main" %22
OpExecutionMode %3 LocalSize 1 1 1
OpName %3 "main"
OpName %7 "RootConstants"
OpName %9 "registers"
OpName %29 "PhysicalPointerFloat4NonWriteArray"
OpMemberName %29 0 "value"
OpName %41 "PhysicalPointerFloat4NonWriteCBVArray"
OpMemberName %41 0 "value"
OpName %55 "PhysicalPointerFloat4CoherentArray"
OpMemberName %55 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 %22 BuiltIn GlobalInvocationId
OpDecorate %28 ArrayStride 16
OpMemberDecorate %29 0 Offset 0
OpDecorate %29 Block
OpMemberDecorate %29 0 NonWritable
OpDecorate %40 ArrayStride 16
OpMemberDecorate %41 0 Offset 0
OpDecorate %41 Block
OpMemberDecorate %41 0 NonWritable
OpDecorate %54 ArrayStride 16
OpMemberDecorate %55 0 Offset 0
OpDecorate %55 Block
OpMemberDecorate %55 0 Coherent
%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
%15 = OpConstant %5 1
%18 = OpConstant %5 0
%20 = OpTypeVector %5 3
%21 = OpTypePointer Input %20
%22 = OpVariable %21 Input
%23 = OpTypePointer Input %5
%26 = OpTypeFloat 32
%27 = OpTypeVector %26 4
%28 = OpTypeRuntimeArray %27
%29 = OpTypeStruct %28
%30 = OpTypePointer PhysicalStorageBuffer %29
%32 = OpTypePointer PhysicalStorageBuffer %27
%39 = OpConstant %5 4096
%40 = OpTypeArray %27 %39
%41 = OpTypeStruct %40
%42 = OpTypePointer PhysicalStorageBuffer %41
%54 = OpTypeRuntimeArray %27
%55 = OpTypeStruct %54
%56 = OpTypePointer PhysicalStorageBuffer %55
%3 = OpFunction %1 None %2
%4 = OpLabel
OpBranch %60
%60 = OpLabel
%11 = OpAccessChain %10 %9 %12
%13 = OpLoad %6 %11
%14 = OpAccessChain %10 %9 %15
%16 = OpLoad %6 %14
%17 = OpAccessChain %10 %9 %18
%19 = OpLoad %6 %17
%24 = OpAccessChain %23 %22 %18
%25 = OpLoad %5 %24
%31 = OpBitcast %30 %16
%33 = OpInBoundsAccessChain %32 %31 %18 %25
%34 = OpLoad %27 %33 Aligned 4
%35 = OpCompositeExtract %26 %34 0
%36 = OpCompositeExtract %26 %34 1
%37 = OpCompositeExtract %26 %34 2
%38 = OpCompositeExtract %26 %34 3
%43 = OpBitcast %42 %19
%44 = OpInBoundsAccessChain %32 %43 %18 %25
%45 = OpLoad %27 %44 Aligned 16
%46 = OpCompositeExtract %26 %45 0
%47 = OpCompositeExtract %26 %45 1
%48 = OpCompositeExtract %26 %45 2
%49 = OpCompositeExtract %26 %45 3
%50 = OpFAdd %26 %46 %35
%51 = OpFAdd %26 %47 %36
%52 = OpFAdd %26 %48 %37
%53 = OpFAdd %26 %49 %38
%57 = OpBitcast %56 %13
%58 = OpInBoundsAccessChain %32 %57 %18 %25
%59 = OpCompositeConstruct %27 %50 %51 %52 %53
OpStore %58 %59 Aligned 4
OpReturn
OpFunctionEnd
#endif
