tu: disable LRZ writes also for alpha-to-coverage, FS sample coverage output

Currently LRZ writes are disabled when depth writes are enabled but the
fragment shader is using discard. Additionally, LRZ writes should be
disabled when fragment shader is outputting sample coverage or the pipeline
state is enabling alpha-to-coverage which behaves as a discard.

This fixes rendering problems on Assetto Corsa. Conditions now used for
disabling LRZ writes match one set of conditions under which the
EARLY_Z_LATE_Z z-test mode is used. It was assumed that in that mode the
LRZ writes in binning will not happen until the late-Z phase, but that's
apparently not the case.

Signed-off-by: Zan Dobersek <zdobersek@igalia.com>
Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36848>
This commit is contained in:
Zan Dobersek
2025-08-19 10:38:18 +02:00
committed by Marge Bot
parent ec4cebbf2e
commit 1bc25c855b
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -761,7 +761,8 @@ tu6_calculate_lrz_state(struct tu_cmd_buffer *cmd,
gras_lrz_cntl.enable = true;
gras_lrz_cntl.lrz_write =
z_write_enable &&
!(fs->fs.lrz.status & TU_LRZ_FORCE_DISABLE_WRITE);
!(fs->fs.lrz.status & TU_LRZ_FORCE_DISABLE_WRITE) &&
!cmd->vk.dynamic_graphics_state.ms.alpha_to_coverage_enable;
gras_lrz_cntl.z_write_enable = z_write_enable;
gras_lrz_cntl.z_bounds_enable = z_bounds_enable;
gras_lrz_cntl.fc_enable = cmd->state.lrz.fast_clear;
+1 -1
View File
@@ -2830,7 +2830,7 @@ tu_shader_create(struct tu_device *dev,
const struct ir3_shader_variant *fs = shader->variant;
shader->fs.sample_shading = fs->sample_shading;
shader->fs.has_fdm = key->fragment_density_map;
if (fs->has_kill)
if (fs->has_kill || fs->writes_smask)
shader->fs.lrz.status |= TU_LRZ_FORCE_DISABLE_WRITE;
if (fs->no_earlyz)
shader->fs.lrz.status = TU_LRZ_FORCE_DISABLE_LRZ;