Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


#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