While developing we've ran into the following issue: at some point after switching to a specific FBO depth buffer stops working as expected. Depth test always passes.
We've played with the depth test set up/VS output and managed to get output which looks like z-fighting artifacts - I'm testing flat triangle parallel to a screen against z-buffer filled by the ground plane (which is orthogonal to the screen) - the results on the screen don't make any sense to me either. Blocks of pixels flash randomly and don't make any recognizable pattern.
When I press square on the android hud and and shows the list of applications the picture might switch to one I expect to see. One of the real footage levels is rendered correctly for several seconds, then it breaks.
This issue happens for the depth buffer which is used by multiple FBOs. It is cleared at the very beginning of the frame. No unexpected clears are performed later. glInvalidateFramebuffer is disabled. To make it worse everything looks fine on other vendor's devices. I've disabled all vendor-specific code.
When I try to check the content of the FBOs using your frame debugger tool both depth and stencil planes are hatched. In other FBOs all the planes look as expected (we still see some hatched planes but this is for the buffers which aren't rendered during the current frame).
Any chance anyone bumped into similar issue?
Is there a depth component on the problematic FBO ?
Also, is the application multi-threaded ? If yes, if the rendering glitches are similar to :
Also, getting a trace with the Mali Graphics Debugger or Apitrace might also help pinpoint the issue.
Thanks for jumping in.
Yes, FBO has depth component attach and no, multithreading is not used.
MGD doesn't help much: depth buffer is hatched for this FBO. Not sure what does this mean. The very same depth texture looks hatched/normal in MGD in different FBOs.
Is the current effect similar to this :
In that case, the problem seems to be related to "self-shadowing" and this article might help you : ShadowMapping with GLUT and GLSL . Also, this StackOverflow post might also shed some light on the subject.
Sorry for misleading.
What I've meant is that MGD shows red hatched box instead of depth buffer content for the FBO I have issues with.
As for the screen, this is not shadow acne.
To simplify everything, I'm going the following:
1. Bind FBO_COLOR0_DEPTH0
2. render scene_part_0 with depth test and write on
3. Bind FBO_COLOR1_DEPTH0
4. render scene_part_1 with depth test on and depth write off
Every single pixel from the stage 4 passes the depth test. Simplified scene:
blue box is rendered during the stage 1. red box is rendered during the stage 2. Depth test is configured correctly. Usually one sees blue box rendering over the red box, but the red box erases the blue one completely as if all pixels pass depth test.
P.S. can't correct my reply for some reason.
the rendering steps are
3. Bind FBO_COLOR0_COLOR1_DEPTH0
So the content of the COLOR0 and DEPTH0 is preserved between step2 and step4. So at the end one would expect to get the combined results in COLOR0