PDA

View Full Version : bitten by dynamic shader recompile?



qzm
08-05-2010, 03:20 PM
I *think* I have been bitten by the feature of NVidias whereby they can dynamically recompile a shader due to changes in uniform.

I have a few moderately parameterised shaders, and a sometimes a uniform needs to be undated per frame, however I am hitting big cpu loads (50%+) when doing so, which looks like the previously discussed feature of NVidias where they recompile to potimise the shaders.

Now, I really really cannot afford for that to happen, does anyone know of a way to avoid it? unfortunately using vertex attributes instead of uniforms will not work in my application...

I have been trying drivers around 185 and the latest (2xx?) and if anything the new ones seem to respond a little worse than the old ones (I guess a slightly heavier optimiser?)

a #pragma DONT_RECOMPILE would be nice ;)

Thanks a ton for any input.

Alfonse Reinheart
08-05-2010, 03:30 PM
What hardware do you have?

Dark Photon
08-05-2010, 05:31 PM
What hardware do you have?
About to ask that same thing. If it's GF7 or earlier, it's certainly possible. Haven't seen this GF8+.

kyle_
08-07-2010, 05:33 AM
NVidias where they recompile to potimise the shaders.
You could modify expressions using the uniforms to pull some data from attributes (of value known to you) to try to prevent these optimizations.

something like:


uniform float value;
...
float zero = gl_Vertex.w - 1;
...
if( value + zero > 4 ) ...


Or some more clever stuff.
Yes its silly, but may help.

Dark Photon
08-07-2010, 07:14 PM
About to ask that same thing. If it's GF7 or earlier, it's certainly possible. Haven't seen this GF8+.
For more info, see:

* Shader performance/complexity problem. (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=281380#Post2813 80)