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.

Parents
  • Esenthel said:
    then the driver does not detect properly that depth texture needs to be updated from the on-chip memory?

    It sounds like its the same issue as you had on your other post.

    You cannot safely make texture samples from an attachment which is currently attached as a framebuffer attachment; it's "implementation defined" behavior in the specification. It won't throw an error, but you've got no guarantees about what any vendor's implementation will do.

    For Mali the "implementation defined behavior" will only give stable results if the attachment has been read-only for the entire render pass; anything else will give unpredictable results. Switching to read-only part way though a pass is not effective - as you are finding the tile-state is not written back to memory until the end of a render pass. What other vendors will do may be completely different, so you're definitely not writing portable code at this point.

    Hope that clears it up, 

    Cheers, 
    Pete

Reply
  • Esenthel said:
    then the driver does not detect properly that depth texture needs to be updated from the on-chip memory?

    It sounds like its the same issue as you had on your other post.

    You cannot safely make texture samples from an attachment which is currently attached as a framebuffer attachment; it's "implementation defined" behavior in the specification. It won't throw an error, but you've got no guarantees about what any vendor's implementation will do.

    For Mali the "implementation defined behavior" will only give stable results if the attachment has been read-only for the entire render pass; anything else will give unpredictable results. Switching to read-only part way though a pass is not effective - as you are finding the tile-state is not written back to memory until the end of a render pass. What other vendors will do may be completely different, so you're definitely not writing portable code at this point.

    Hope that clears it up, 

    Cheers, 
    Pete

Children