Do I lose/gain performance for discarding pixels even if I don't use depth testing?

Posted by Gajoo on Game Development See other posts from Game Development or by Gajoo
Published on 2012-10-19T22:58:27Z Indexed on 2012/10/20 5:22 UTC
Read the original article Hit count: 175

Filed under:
|
|

When I first searched for discard instruction, I've found experts saying using discard will result in performance drain. They said discarding pixels will break GPU's ability to use zBuffer properly because GPU have to first run Fragment shader for both objects to check if the one nearer to camera is discarded or not. For a 2D game I'm currently working on, I've disabled both depth-test and depth-write. I'm drawing all objects sorted by their depth and that's all, no need for GPU to do fancy things. now I'm wondering is it still bad if I discard pixels in my fragment shader?

© Game Development or respective owner

Related posts about opengl

Related posts about shaders