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!
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.