Can I give hints to the GLSL runtime compiler?

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

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.

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?

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.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.