PDA

View Full Version : GLSL, half + fixed data types?



rcpedersen
12-18-2007, 07:56 AM
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

Jan
12-18-2007, 10:31 AM
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.

Jan.

Brolingstanz
12-18-2007, 11:00 AM
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..

Nicolas Lelong
12-18-2007, 11:10 AM
FWIW, you may find some information that may interest you there :

http://developer.download.nvidia.com/opengl/glsl/glsl_release_notes.pdf

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...

ZbuffeR
12-18-2007, 11:44 AM
About using half with a clean method :
http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=231401#Post231401

-NiCo-
12-18-2007, 11:53 AM
You can use the command line Cg compiler (cgc) to see the intermediate assembly code.

N.

rcpedersen
12-19-2007, 04:07 AM
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.