Half in glsl was support since which version? the difference between half and precision mediump float?

half in glsl was support since which version? the difference between half and precision mediump float?
Thanks!

No version of GLSL supports half-precision floats as a variable data type.

There are extensions such as AMD_gpu_shader_half_float, but nothing in core.

OpenGL 3.0 and later include the ARB_half_float_pixel and ARB_half_float_vertex extensions which allow for half-float texture/image data and half-float vertex data respectively. These are converted to float data in GLSL, similarly to how normalised data is handled.

GLSL 4.20 has unpackHalf2x16 and packHalf2x16 which allow you to convert between a 32-bit integer and a pair of half-precision floats.

Half-precision is a 16-bit memory format. Data is converted to/from half-precision on read/write; GPU registers are always 32-bit.

“mediump float” is specific to OpenGL ES (desktop OpenGL always uses the full highp precision; precision qualifiers are accepted but ignored). It allows variables to be stored in lower-precision registers and manipulated using lower-precision arithmetic. OpenGL ES can be implemented on hardware which doesn’t support 32-bit floating-point arithmetic in the fragment shader.

1 Like