Shaders affecting eachother... annoying

ive got two shaders… if i add a texture fetch in one of the shaders fragment program… then i get some bug in the others vertex program…

im getting alot of problems where changes in shader causes problem with the other shader that has nothin to do with the other… which forces me to keep some code i dont need like just a simple if statement that doesnt do anythin so that the other shader works properly…

what might be causing this?

sounds like a driver problem or bug. what’s your hardware? and what problem do you have exactly?

7800 GT

this is an example within the same shader…

THIS WORKS!

FinalColor = pow(FinalColor*exposure, gamma);

alpha.x = 1.0;
if (OverWater)
{
alpha.x = 1.0;
}

gl_FragColor = vec4(FinalColor, alpha.x);

THIS DOESNT

FinalColor = pow(FinalColor*exposure, gamma);
gl_FragColor = vec4(FinalColor, 1.0);

the difference…? there is none!

Both look OK but we don’t see the declarations so we can’t be sure for example that FinalColor is the vec3 the code assumes it is (of course that would break both versions, but you can’t assess this without seeing the varyings out of your vertex and into your fragment shaders).

Check that you load the shaders correctly. For example if you are using zero terminated strings, check that they are really zero terminated at correct place. You can use the NVEmulate tool to see shader source code as it is seen by the driver.

Komat made a good point. I once had an issue with my shader loading code. I was skipping newline characters. Everything was fine until I used #ifdef in shader :slight_smile: Now I had one big preprocessor directive.
Not only this turned out to be a bug in my code, but it also coused the driver to enter endless loop. I reported driver bug and fixed my own - both are fixed now.
At first it could appear that that’s purely driver bug, but it was also my fault of not passing the source code correctly.

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