PDA

View Full Version : GLSL pack/unpack



Factor
07-30-2004, 03:11 AM
Hi...

Is it possible to use some kind of pk2h/pk4ub/etc... like instructions under GLSL on NVidia cards? I'm working on a deferred shading algorithm and I've used the NV_fragment_program extension until now. I found a short description of the EXT_Cg_shader extension, but it only says that we can use the Cg standard library functions in a GLSL program.

Any help would be appreciated...

MZ
07-30-2004, 08:24 AM
from Cg_Toolkit.pdf (1.2):

float pack_2half(float2 a);
float pack_2half(half2 a);
half2 unpack_2half(float a);

float pack_2ushort(float2 a);
float pack_2ushort(half2 a);
float2 unpack_2ushort(float a);

float pack_4byte(float4 a);
float pack_4byte(half4 a);
half4 unpack_4byte(float a);

float pack_4ubyte(float4 a);
float pack_4ubyte(half4 a);
half4 unpack_4ubyte(float a);

Factor
08-01-2004, 10:41 PM
Thanks, I've already knew this, so the question really is that is there any way to use them, or some similar functions under GLSL.

jra101
08-01-2004, 11:58 PM
Yes, all of the Cg stdlib functions are exposed in the NVIDIA GLSL implementation. Just call the unpack functions the same way you would in a Cg shader.

Galstaff
01-15-2007, 07:52 AM
It seems that NVIDIA GLSL compiler does not recognize pack/unpack functions anymore. As a result, my programs fail to start on GF8800 with 97.xx drivers. Is it a bug or intended behaviour?

knackered
01-15-2007, 08:14 AM
have a bang on this:-
http://www.opengl.org/discussion_boards/ubb/ultimatebb.php?ubb=get_topic;f=11;t=000944#000000

Galstaff
01-18-2007, 06:29 AM
Thanks! I wonder how fast this code is in comparison with native PK4UB/UP4UB.