CaffeineMC / sodium

A Minecraft mod designed to improve frame rates and reduce micro-stutter
Other
4.77k stars 810 forks source link

Material downgrading causes Z-fighting on older Intel GPUs #2830

Closed jellysquid3 closed 2 days ago

jellysquid3 commented 2 days ago

Some older Intel GPUs (at least Gen7.5) are not handling the requested depth buffer behavior correctly. For certain block models with overlays where the base texture is opaque, this causes Z-fighting even when the vertex positions and camera transforms are identical.

image

Since this only affects cases where terrain geometry is overlapping with different materials, it is not necessary to completely disable the optimization on this hardware. We can instead scan the entire block model and find the lowest common denominator between each quad, allowing for downgrading to happen when the entire block model has alpha-tested or opaque geometry only.

jellysquid3 commented 2 days ago

For the time being, it would be too much work to scan the entire block model. My patch set just disables the material downgrading functionality completely on Intel Gen8 (and older) GPUs.