Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualtanzanite7

Posted 18 May 2013 - 05:15 PM

thanks both of you. I tried it out, and the results I got was:
-when early depth testing is enabled: layout(early_fragment_tests) in;
the whole sprite is overwritten the by topmost (despite the black areas being discarded, see pic)
-if disabled it works fine.

Weird :/.

Generally, if early depth test is possible then it will be done - there is no reason to ask for it (funky exceptions, which i am not aware of, excepted). When explicitly requiring it causes "discard" to be ignored then ... that is a strong suggestion that early depth test is impossible given the shader.

Discard is similar to alpha testing - it sounds like your hardware just does not support early depth test with alpha testing. When i think about it then it rings true - i vaguely remember that alpha test indeed is not compatible with early depth test.

Logically it is also true - depth test and write happen at the same time, it can not do that early if the alpha test/discard result is only known after the fragment program ran.

In short: cannot use early depth test.

So, bac to: Why do you need it ... really? What platform are you on that it is an concern? How do you know the overdraw is a problem? Is discard without early depth test really too slow? Could you perhaps simplify your shader?

edit:
Wiki agrees with me: http://www.opengl.org/wiki/Early_Fragment_Test

#1tanzanite7

Posted 18 May 2013 - 05:11 PM

thanks both of you. I tried it out, and the results I got was:
-when early depth testing is enabled: layout(early_fragment_tests) in;
the whole sprite is overwritten the by topmost (despite the black areas being discarded, see pic)
-if disabled it works fine.

Weird :/.

Generally, if early depth test is possible then it will be done - there is no reason to ask for it (funky exceptions, which i am not aware of, excepted). When explicitly requiring it causes "discard" to be ignored then ... that is a strong suggestion that early depth test is impossible given the shader.

Discard is similar to alpha testing - it sounds like your hardware just does not support early depth test with alpha testing. When i think about it then it rings true - i vaguely remember that alpha test indeed is not compatible with early depth test.

Logically it is also true - depth test and write happen at the same time, it can not do that early if the alpha test/discard result is only known after the fragment program ran.

In short: cannot use early depth test.

So, bac to: Why do you need it ... really? What platform are you on that it is an concern? How do you know the overdraw is a problem? Is discard without early depth test really too slow? Could you perhaps simplify your shader?

PARTNERS