PDA

View Full Version : Shader code discarded by system?



Ren
10-23-2007, 10:37 AM
I'm just wondering, if I have an extremely complicated shader,will system discard some of the code during rendering?

What I think is, even if the shader is very complicated, but as long as it compiles and links, it should be execued at a slower rate, right?

Now I have a very complicated Geometry Shader,I suspect that some code might have been discarded, is it possible?

Nicolai de Haan Brøgger
10-23-2007, 11:02 AM
I am not an expert on programming shaders but I have experienced code being discarded from them.

It is very common that shader compilers discard the code that does NOT contribute to any output or varying variables.

If your shader is very complicated, perhaps it is difficult to see that some of the code is not necessary and can be stripped, the compiler would catch that and discard it. Maybe you can split up the shader into more manageable parts and test them separately?

kind regards,
Nicolai Brøgger

Jan
10-23-2007, 02:47 PM
It is very difficult to find out which code does NOT contribute to the result and thus discard it. It is highly unlikely, that code is regarded as "not contributing to the result" and thus discarded, although it has impact on the result.

Of course driver-errors can happen, and are, unfortunately, not as rare as we liked them to be.

All you can do, is test further, and maybe show us your code and tell us the results, so that we can help you figure out, what is going wrong.

If you can pinpoint an obvious driver-error, write a mail, including a simple test-application, to nVidia (i assume it is NV, since you use geometry shaders...).

Jan.

Ren
10-30-2007, 06:20 AM
Thanks guys, I've figure out my error, the code is not discarded, it my error