#version 460
#if defined(GL_AMD_gpu_shader_half_float)
#extension GL_AMD_gpu_shader_half_float : require
#elif defined(GL_EXT_shader_explicit_arithmetic_types_float16)
#extension GL_EXT_shader_explicit_arithmetic_types_float16 : require
#else
#error No extension available for FP16.
#endif
#extension GL_EXT_shader_16bit_storage : require
#extension GL_EXT_buffer_reference2 : require
#extension GL_EXT_scalar_block_layout : 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 PhysicalPointerHalfArray;
layout(buffer_reference) buffer PhysicalPointerHalf2Array;
layout(buffer_reference) buffer PhysicalPointerHalf3Array;
layout(buffer_reference) buffer PhysicalPointerHalf4Array;
layout(buffer_reference) buffer PhysicalPointerUint2Array;

float16_t _72;
uint _112;

layout(buffer_reference, buffer_reference_align = 16, 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 = 16, std430) coherent buffer PhysicalPointerFloat4CoherentArray
{
    vec4 value[];
};

layout(buffer_reference, buffer_reference_align = 2, std430) buffer PhysicalPointerHalfArray
{
    float16_t value[];
};

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

layout(buffer_reference, buffer_reference_align = 2, scalar) buffer PhysicalPointerHalf3Array
{
    f16vec3 value[];
};

layout(buffer_reference, buffer_reference_align = 8, std430) buffer PhysicalPointerHalf4Array
{
    f16vec4 value[];
};

layout(buffer_reference, buffer_reference_align = 8, std430) buffer PhysicalPointerUint2Array
{
    uvec2 value[];
};

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

void main()
{
    PhysicalPointerFloat4NonWriteArray _34 = PhysicalPointerFloat4NonWriteArray(registers._m1);
    PhysicalPointerFloat4NonWriteCBVArray _46 = PhysicalPointerFloat4NonWriteCBVArray(registers._m0);
    PhysicalPointerFloat4CoherentArray(registers._m2).value[gl_GlobalInvocationID.x] = vec4(_46.value[gl_GlobalInvocationID.x].x + _34.value[gl_GlobalInvocationID.x].x, _46.value[gl_GlobalInvocationID.x].y + _34.value[gl_GlobalInvocationID.x].y, _46.value[gl_GlobalInvocationID.x].z + _34.value[gl_GlobalInvocationID.x].z, _46.value[gl_GlobalInvocationID.x].w + _34.value[gl_GlobalInvocationID.x].w);
    PhysicalPointerHalfArray(registers._m3).value[gl_GlobalInvocationID.x] = float16_t(1.0);
    PhysicalPointerHalf2Array(registers._m3).value[gl_GlobalInvocationID.x] = f16vec2(float16_t(1.0), float16_t(2.0));
    PhysicalPointerHalf3Array(registers._m3).value[gl_GlobalInvocationID.x] = f16vec3(float16_t(1.0), float16_t(2.0), float16_t(3.0));
    PhysicalPointerHalf4Array(registers._m3).value[gl_GlobalInvocationID.x] = f16vec4(float16_t(1.0), float16_t(2.0), float16_t(3.0), float16_t(4.0));
    PhysicalPointerUint2Array(registers._m3).value[gl_GlobalInvocationID.x] = uvec2(4u, 5u);
}


#if 0
// SPIR-V disassembly
; SPIR-V
; Version: 1.3
; Generator: Unknown(30017); 21022
; Bound: 116
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability DenormPreserve
OpCapability PhysicalStorageBufferAddresses
OpExtension "SPV_KHR_float_controls"
OpExtension "SPV_KHR_physical_storage_buffer"
OpMemoryModel PhysicalStorageBuffer64 GLSL450
OpEntryPoint GLCompute %3 "main" %25
OpExecutionMode %3 LocalSize 1 1 1
OpExecutionMode %3 DenormPreserve 16
OpName %3 "main"
OpName %7 "RootConstants"
OpName %9 "registers"
OpName %32 "PhysicalPointerFloat4NonWriteArray"
OpMemberName %32 0 "value"
OpName %44 "PhysicalPointerFloat4NonWriteCBVArray"
OpMemberName %44 0 "value"
OpName %58 "PhysicalPointerFloat4CoherentArray"
OpMemberName %58 0 "value"
OpName %66 "PhysicalPointerHalfArray"
OpMemberName %66 0 "value"
OpName %76 "PhysicalPointerHalf2Array"
OpMemberName %76 0 "value"
OpName %87 "PhysicalPointerHalf3Array"
OpMemberName %87 0 "value"
OpName %97 "PhysicalPointerHalf4Array"
OpMemberName %97 0 "value"
OpName %105 "PhysicalPointerUint2Array"
OpMemberName %105 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 %25 BuiltIn GlobalInvocationId
OpDecorate %31 ArrayStride 16
OpMemberDecorate %32 0 Offset 0
OpDecorate %32 Block
OpMemberDecorate %32 0 NonWritable
OpDecorate %43 ArrayStride 16
OpMemberDecorate %44 0 Offset 0
OpDecorate %44 Block
OpMemberDecorate %44 0 NonWritable
OpDecorate %57 ArrayStride 16
OpMemberDecorate %58 0 Offset 0
OpDecorate %58 Block
OpMemberDecorate %58 0 Coherent
OpDecorate %65 ArrayStride 2
OpMemberDecorate %66 0 Offset 0
OpDecorate %66 Block
OpDecorate %75 ArrayStride 4
OpMemberDecorate %76 0 Offset 0
OpDecorate %76 Block
OpDecorate %86 ArrayStride 6
OpMemberDecorate %87 0 Offset 0
OpDecorate %87 Block
OpDecorate %96 ArrayStride 8
OpMemberDecorate %97 0 Offset 0
OpDecorate %97 Block
OpDecorate %104 ArrayStride 8
OpMemberDecorate %105 0 Offset 0
OpDecorate %105 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 3
%15 = OpConstant %5 2
%18 = OpConstant %5 1
%21 = OpConstant %5 0
%23 = OpTypeVector %5 3
%24 = OpTypePointer Input %23
%25 = OpVariable %24 Input
%26 = OpTypePointer Input %5
%29 = OpTypeFloat 32
%30 = OpTypeVector %29 4
%31 = OpTypeRuntimeArray %30
%32 = OpTypeStruct %31
%33 = OpTypePointer PhysicalStorageBuffer %32
%35 = OpTypePointer PhysicalStorageBuffer %30
%42 = OpConstant %5 4096
%43 = OpTypeArray %30 %42
%44 = OpTypeStruct %43
%45 = OpTypePointer PhysicalStorageBuffer %44
%57 = OpTypeRuntimeArray %30
%58 = OpTypeStruct %57
%59 = OpTypePointer PhysicalStorageBuffer %58
%64 = OpTypeFloat 16
%65 = OpTypeRuntimeArray %64
%66 = OpTypeStruct %65
%67 = OpTypePointer PhysicalStorageBuffer %66
%69 = OpTypePointer PhysicalStorageBuffer %64
%71 = OpConstant %64 0x1p+0
%74 = OpTypeVector %64 2
%75 = OpTypeRuntimeArray %74
%76 = OpTypeStruct %75
%77 = OpTypePointer PhysicalStorageBuffer %76
%79 = OpTypePointer PhysicalStorageBuffer %74
%81 = OpConstant %64 0x1p+1
%84 = OpConstant %5 6
%85 = OpTypeVector %64 3
%86 = OpTypeRuntimeArray %85
%87 = OpTypeStruct %86
%88 = OpTypePointer PhysicalStorageBuffer %87
%90 = OpTypePointer PhysicalStorageBuffer %85
%92 = OpConstant %64 0x1.8p+1
%95 = OpTypeVector %64 4
%96 = OpTypeRuntimeArray %95
%97 = OpTypeStruct %96
%98 = OpTypePointer PhysicalStorageBuffer %97
%100 = OpTypePointer PhysicalStorageBuffer %95
%102 = OpConstant %64 0x1p+2
%104 = OpTypeRuntimeArray %6
%105 = OpTypeStruct %104
%106 = OpTypePointer PhysicalStorageBuffer %105
%108 = OpTypePointer PhysicalStorageBuffer %6
%110 = OpConstant %5 4
%111 = OpConstant %5 5
%3 = OpFunction %1 None %2
%4 = OpLabel
%72 = OpUndef %64
%112 = OpUndef %5
OpBranch %114
%114 = 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
%20 = OpAccessChain %10 %9 %21
%22 = OpLoad %6 %20
%27 = OpAccessChain %26 %25 %21
%28 = OpLoad %5 %27
%34 = OpBitcast %33 %19
%36 = OpInBoundsAccessChain %35 %34 %21 %28
%37 = OpLoad %30 %36 Aligned 16
%38 = OpCompositeExtract %29 %37 0
%39 = OpCompositeExtract %29 %37 1
%40 = OpCompositeExtract %29 %37 2
%41 = OpCompositeExtract %29 %37 3
%46 = OpBitcast %45 %22
%47 = OpInBoundsAccessChain %35 %46 %21 %28
%48 = OpLoad %30 %47 Aligned 16
%49 = OpCompositeExtract %29 %48 0
%50 = OpCompositeExtract %29 %48 1
%51 = OpCompositeExtract %29 %48 2
%52 = OpCompositeExtract %29 %48 3
%53 = OpFAdd %29 %49 %38
%54 = OpFAdd %29 %50 %39
%55 = OpFAdd %29 %51 %40
%56 = OpFAdd %29 %52 %41
%60 = OpBitcast %59 %16
%61 = OpInBoundsAccessChain %35 %60 %21 %28
%62 = OpCompositeConstruct %30 %53 %54 %55 %56
OpStore %61 %62 Aligned 16
%63 = OpShiftLeftLogical %5 %28 %18
%68 = OpBitcast %67 %13
%70 = OpInBoundsAccessChain %69 %68 %21 %28
OpStore %70 %71 Aligned 2
%73 = OpShiftLeftLogical %5 %28 %15
%78 = OpBitcast %77 %13
%80 = OpInBoundsAccessChain %79 %78 %21 %28
%82 = OpCompositeConstruct %74 %71 %81
OpStore %80 %82 Aligned 4
%83 = OpIMul %5 %28 %84
%89 = OpBitcast %88 %13
%91 = OpInBoundsAccessChain %90 %89 %21 %28
%93 = OpCompositeConstruct %85 %71 %81 %92
OpStore %91 %93 Aligned 2
%94 = OpShiftLeftLogical %5 %28 %12
%99 = OpBitcast %98 %13
%101 = OpInBoundsAccessChain %100 %99 %21 %28
%103 = OpCompositeConstruct %95 %71 %81 %92 %102
OpStore %101 %103 Aligned 8
%107 = OpBitcast %106 %13
%109 = OpInBoundsAccessChain %108 %107 %21 %28
%113 = OpCompositeConstruct %6 %110 %111
OpStore %109 %113 Aligned 8
OpReturn
OpFunctionEnd
#endif
