SPIRV-Cross/reference/shaders-no-opt/asm/comp/bitcast-fp16-fp32.asm.vk.comp.vk
Hans-Kristian Arntzen 5e5d1c27ce GLSL: Support f16x2 <-> f32 bitcast.
There is no native formulation, so introduce a concept of a "complex"
bitcast to handle odd-ball cases which have no native unary operation.
2020-04-21 23:27:33 +02:00

26 lines
636 B
Plaintext

#version 450
#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
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
layout(set = 0, binding = 0, std430) buffer SSBO
{
f16vec2 a;
float b;
float c;
f16vec2 d;
} _4;
void main()
{
_4.b = uintBitsToFloat(packFloat2x16(_4.a));
_4.d = unpackFloat2x16(floatBitsToUint(_4.c));
}