GLSL, half + fixed data types?

Under both Cg and Microsofts HLSL there is support for a half-floating point data type. half, half2, half3, half4
Does OpenGL support something similiar? Both Microsofts HLSL compiler and NVIDIAs Cg compiler is capabable of optimizing the shaders source additionally with forexample special normalization instructions. Does OpenGL support half-floating points ?

Also there is a pragma instructions, #pragma optimize(on), how is one to see if the driver is capable at all of optimizing the shader if one can not see the shader assembler? Does OpenGL support access to intermediate shader assembly as Microsoft DirectX does? I remeber something similiar under the Cg interface but there is no information on OpenGL on how to get intermediate shader assembly code?

My primary platform is NVIDIA G80

That’s a “no” to all of your questions, unfortunately.

Since you are developing for G80, either use Cg or nvidias assembler interface (NV_fragment_program). If you need cross-platform (ie. also ATI support), you are pretty much out of luck.


Wouldn’t count on a half type being around much longer. It’s already history in d3d10, but the typename is still exposed for compatibility reasons…

FWIW, you may find some information that may interest you there :

It somehow outdated, but NVidia exposes half, half2, half3, half4 types in GLSL.

You’d better validate with NVShaderPerf that using those types is actually optimizing something…

About using half with a clean method :

You can use the command line Cg compiler (cgc) to see the intermediate assembly code.


NVIDIA might have exposed half data types in the 95 version, but it isnt the case any longer…

About DirectX 10, although half is still provided for compatibility, they have on the other hand integer support + double precision. So the loose of half data types is more than made up for with full integer support.