PDA

View Full Version : Can I give hints to the GLSL runtime compiler?



Daniel Johansson
12-23-2004, 10:32 AM
Hello everybody!

Im currently developing a GLSL shader for doing procedural textures in 3d (~Hypertextures) with a raymarcher written in GLSL. Currently im having some problems with the NVidia compiler in driver 71.20, it generates assemby using too many temporary registers ( > 31 temp registers). If I manually compile the code with cgc.exe (v. 1.3) everything is fine (~20 temp registers).

So the question is: can I somehow give arguments to the GLSL compiler/linker in the NVidia drivers, and will this help me with my problem?

// Daniel

V-man
12-24-2004, 06:25 PM
No there aren't compiler switches defined in GLSL.

What could help is that you code in a plain way so the compiler doesn't have to work too hard.

Have you looked at the disassembly and compared between old driver and new driver? Use NVemulate tool to turn on disassembly.

Daniel Johansson
12-30-2004, 01:00 PM
I haven't compared the assembly from different drivers, but I will do that as soon as I get back from the holidays. It's strange though that the compiler doesn't complain although it exeeds the hardware limit of the current profile?

Ffelagund
01-05-2005, 08:46 AM
The GLSL specs defines two things that maybe could help you: #pragma optimize and #pragma debug


#pragma optimize(on)
#pragma optimize(off)

can be used to turn off optimizations as an aid on developing and debugging shaders. It can only be used outside function definitions. By default, optimization is turned on for all shaders.

The debug pragma
#pragma debug(on)
#pragma debug(off)
can be used to enable compiling and annotating a shader with debug information, so that it can be used with a debugger. It can only be used outside function definitions. By default, debug is turned off.