Depth texture clearing not working

595 Views Asked by At

I'm implementing shadowmapping in OpenGL es 2.0. I use OES_depth_texture extension to render the depth to a DEPTH_ATTACHMENT texture of type UNSIGNED_SHORT. The solution works on my macbook, and even in WebGL. However on Android (Acer B1-721, Mali-400 MP, Android version 4.4.2) there is an issue with clearing the depth texture. I haven't tried on other devices (it's the only android I have).

Most of the time the depth texture simply doesn't clear. Sometimes (very rarely) it clears it one frame. It also clears it when I suspend the app or the screen is dimmed.

I know Mali-400 MP is old, but it does claim it supports OES_depth_texture. Still it sounds like a driver issue. Does anyone have similar experiences? Any ideas for circumventing this issue?

EDIT: The problem isn't only with depth textures. I'm getting similar issues also with a normal depth buffer when rendering to a texture. It gets better when I drop the texture size, but there is still some flickering. Also reducing amount of vertices reduces the flickering. Might be a memory bandwidth issue?

EDIT: Some discussion on this matter https://www.opengl.org/discussion_boards/showthread.php/199655-Clearing-DEPTH_COMPONENT-of-type-UNSIGNED_SHORT-in-gles2-using-OES_depth_texture/page3 It's not only the clearing that isn't working. All operations on a FBO depth buffer (texture or render buffer, doesn't matter) are executed at wrong times in the pipeline or discarded. glFinish fixes the issue but isn't a very good solution otherwise.

0

There are 0 best solutions below