#version 460
#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require
#extension GL_EXT_shader_16bit_storage : require
#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_ray_tracing : require
#extension GL_EXT_nonuniform_qualifier : require

layout(set = 0, binding = 0, std430) writeonly buffer BUFSSBO
{
    uint16_t _m0[];
} BUF;

void main()
{
    BUF._m0[gl_LaunchIDEXT.x] = float16BitsToUint16(float16_t(20.0));
}


#if 0
// SPIR-V disassembly
; SPIR-V
; Version: 1.4
; Generator: Unknown(30017); 21022
; Bound: 25
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability Int16
OpCapability UniformBufferArrayDynamicIndexing
OpCapability SampledImageArrayDynamicIndexing
OpCapability StorageBufferArrayDynamicIndexing
OpCapability StorageImageArrayDynamicIndexing
OpCapability StorageBuffer16BitAccess
OpCapability DenormPreserve
OpCapability RayTracingKHR
OpCapability RuntimeDescriptorArray
OpCapability UniformBufferArrayNonUniformIndexing
OpCapability SampledImageArrayNonUniformIndexing
OpCapability StorageBufferArrayNonUniformIndexing
OpCapability StorageImageArrayNonUniformIndexing
OpExtension "SPV_EXT_descriptor_indexing"
OpExtension "SPV_KHR_float_controls"
OpExtension "SPV_KHR_ray_tracing"
OpMemoryModel Logical GLSL450
OpEntryPoint RayGenerationNV %3 "main" %9 %13
OpExecutionMode %3 DenormPreserve 16
OpName %3 "main"
OpName %7 "BUFSSBO"
OpName %9 "BUF"
OpDecorate %6 ArrayStride 2
OpMemberDecorate %7 0 Offset 0
OpDecorate %7 Block
OpDecorate %9 DescriptorSet 0
OpDecorate %9 Binding 0
OpDecorate %9 NonReadable
OpDecorate %13 BuiltIn LaunchIdNV
%1 = OpTypeVoid
%2 = OpTypeFunction %1
%5 = OpTypeInt 16 0
%6 = OpTypeRuntimeArray %5
%7 = OpTypeStruct %6
%8 = OpTypePointer StorageBuffer %7
%9 = OpVariable %8 StorageBuffer
%10 = OpTypeInt 32 0
%11 = OpTypeVector %10 3
%12 = OpTypePointer Input %11
%13 = OpVariable %12 Input
%14 = OpTypePointer Input %10
%16 = OpConstant %10 0
%18 = OpTypeFloat 16
%19 = OpConstant %18 0x1.4p+4
%21 = OpTypePointer StorageBuffer %5
%3 = OpFunction %1 None %2
%4 = OpLabel
OpBranch %23
%23 = OpLabel
%15 = OpAccessChain %14 %13 %16
%17 = OpLoad %10 %15
%20 = OpBitcast %5 %19
%22 = OpAccessChain %21 %9 %16 %17
OpStore %22 %20
OpReturn
OpFunctionEnd
#endif
