You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can't reproduce this problem on an M2 Macbook which indicates it is a GPU/driver-specific.
I strongly suspect this is an issue of NVidia doing very aggressive shader optimizations that end up causing a slight difference between the shader used for the depth prepass and the shader used for the render pass.
This issue commonly arises in Vertex shaders with gl_Position. In that case you can use the invariant qualifier. Newer versions of GLSL also have precise for situations like your shader.
I suspect that this could be solved by exposing precise to user shaders.
That being said, I don't think your shader gains anything by using the depth prepass. The depth prepass is nice because it allows you to avoid running the fragment shader for occluded fragments. But, writing to DEPTH fully disables that optimization, so you get no benefit from using the prepass. In fact, since the raymarch is expensive, you are essentially doubling the cost of your shader for no practical gain.
That being said, I don't think your shader gains anything by using the depth prepass. The depth prepass is nice because it allows you to avoid running the fragment shader for occluded fragments. But, writing to DEPTH fully disables that optimization, so you get no benefit from using the prepass. In fact, since the raymarch is expensive, you are essentially doubling the cost of your shader for no practical gain.
Is there a way to reliably disable the depth prepass on a single material without making it go through the transparent pipeline? I couldn't figure out a way to do this, other than using if (false) discard; which is likely slower than it needs to be.
Tested versions
System information
Windows 11 - Vulkan 1.3.280 - Forward+ - Using Device #0: NVIDIA - NVIDIA GeForce RTX 3070 Ti
Issue description
When using a shader that writes to DEPTH along with depth prepass, sometimes fragments are lost.
Steps to reproduce
Minimal reproduction project (MRP)
prepass-leak.zip
The text was updated successfully, but these errors were encountered: