This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Depth buffer as Texture issue on Galaxy Note 4 SM-N910U, ARM Mali-T760 MP6

I've encountered another problem, 

To reproduce the issue:

open the APK https://www.dropbox.com/s/yza47wllwfwvhaq/Application2.7z?dl=0

hold 2 fingers on the screen - camera will start auto rotating and you will see weird glowy outlines around the character

if you then hold 3 fingers, then the problem goes away.

From my understanding the problem is as follows:

-I use depth buffer as depth texture

-I clear the depth buffer

-I render the character model, writing to the depth buffer

-I disable depth buffer writes, so I can process it in read only mode, and read depth values from the depth buffer texture

-I render the blue sky model, in which I use the shader with depth buffer texture reads, however the values from the depth texture are not up-to-date but seem like they come from the previous frame

In all stages of above I don't change render targets / attachments / fbo, so from my understanding how the mali chip works, is that the depth buffer is stored in fast memory on the chip, but when I switch to read-only mode for depth buffer and want to read from the depth texture in the shader, then the driver does not detect properly that depth texture needs to be updated from the on-chip memory?

And to prove that problem, when you hold 3 fingers, then before sky is drawn, then I temporarly set a null (0) color render target and null (0) depth buffer, after that I restore the original color RT and depth buffer, so because of that switch, the driver flushes the depth contents to the texture, and it starts to work OK.