Hi mali experts, we have tried the pre z pass on mali gpu and found that on OpenGL it's working correctly but on vulkan there are some z-fighting like artifacts.
After some investigation, it seems on vulkan, even the depth of base pass matches the depth in pre-z pass, and the depth function is set to EQUAL, the depth testing still fail:
When we checked the vertex shader in render doc, it seems the gl_Position variable already has a invariant qualifier:
Also by default we use D24S8 format for depth-stencil attachement, after we change it to 32bit depth attachment, there are even more z-fighting like artifacts, so it seems like this artifacts is not caused by insufficient precision of the depth value.
Besides, we have tested the same scene with OpenGL and Vulkan on same mali devices( GLES: ARM, Mali-G710 MC10, OpenGL ES 3.2 v1.r32p1-01eac0.55ce131ae332d8a4a1eb9e0a95da701 ):
For the same period of time, it seems vulkan's early z and fpk are not working as efficient as opengl.
Any suggestions? Thanks in advance!
For the shader issues, can you share a matching pair of shaders (i.e. depth pass + main pass) where you expect the depth to match, with instructions for how you are generating the SPIR-V for them? If you can't share these publicly you can email "developer <at> arm <dot> com".
For the FPK issues, it will be hard to tell what's going on without seeing an APK. Happy to look if you can share via the above.
Hi peter, I sent the shaders to you by the email. For now, I'm afraid I cannot send the apk to you for helping analysis the fpk issues. Can you provide some common mistakes that might affect the FPK performance? I'm wondering if this early-z and FPK issue is related to the depth testing failures.
Just so the answer to this one is visible if anyone else hits the same problem:
OpenGL ES shaders generated via hlslcc and Vulkan SPIR-V generated via DXC were generating different precision, with Vulkan using more relaxed precision. As far as we can tell, the issue seems related to the intermediate codegen rather than the Mali compiler.