SPIRV-Cross/reference/opt/shaders/frag/16bit-constants.frag
Hans-Kristian Arntzen 4ef51331b2 Always value-cast FP16 constants instead of using literals.
GL_NV_gpu_shader5 doesn't support "hf", so to avoid lots of complicated
workarounds, just value-cast the half literals.
2019-02-20 12:30:01 +01:00

26 lines
557 B
GLSL

#version 450
#if defined(GL_AMD_gpu_shader_half_float)
#extension GL_AMD_gpu_shader_half_float : require
#elif defined(GL_NV_gpu_shader5)
#extension GL_NV_gpu_shader5 : require
#else
#error No extension available for FP16.
#endif
#if defined(GL_AMD_gpu_shader_int16)
#extension GL_AMD_gpu_shader_int16 : require
#else
#error No extension available for Int16.
#endif
layout(location = 0) out float16_t foo;
layout(location = 1) out int16_t bar;
layout(location = 2) out uint16_t baz;
void main()
{
foo = float16_t(1.0);
bar = 2s;
baz = 3us;
}