1 Reply Latest reply on Dec 17, 2012 7:21 AM by gsellers

    Is it good idea to use 'discard' with conservative_depth?

    ckotinko1

      Hello.

       

      I rely on conservative depth extention in my pixel shaders:

       

      layout (depth_greater) out float gl_FragDepth;

       

      Is this feature compatible with shaders with discard instruction?

        • Re: Is it good idea to use 'discard' with conservative_depth?
          gsellers

          Hi,

           

          Yes, you can use discard; with conservative depth. The conservative depth feature controls whether the hardware runs your shader at all whereas executing discard; in the shader prevents the depth write from occurring. In the example you gave, if the depth test hardware determines that if you only make gl_FragDepth greater than it would have been then it is safe to not run the shader if the depth test is set to LESS or LEQUAL. However, if your shader executes discard, the resulting value will not be written to the depth buffer and nor will any other output from the shader.

           

          Thanks,

           

          Graham