Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Shader code discarded by system?

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2004
    Location
    Australia/China
    Posts
    22

    Shader code discarded by system?

    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?

  2. #2
    Junior Member Regular Contributor
    Join Date
    Aug 2007
    Posts
    107

    Re: Shader code discarded by system?

    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
    kind regards,
    Nicolai de Haan

  3. #3
    Senior Member OpenGL Guru
    Join Date
    Dec 2000
    Location
    Reutlingen, Germany
    Posts
    2,052

    Re: Shader code discarded by system?

    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.
    GLIM - Immediate Mode Emulation for GL3

  4. #4
    Junior Member Newbie
    Join Date
    Nov 2004
    Location
    Australia/China
    Posts
    22

    Re: Shader code discarded by system?

    Thanks guys, I've figure out my error, the code is not discarded, it my error

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •