broadcom/compiler: don't promote early fragment tests when writing sample mask
authorIago Toral Quiroga <itoral@igalia.com>
Fri, 20 May 2022 07:44:45 +0000 (09:44 +0200)
committerMarge Bot <emma+marge@anholt.net>
Fri, 20 May 2022 13:04:32 +0000 (13:04 +0000)
If the sample mask is being written it means we want to discard some of the
samples generated so we should not be promoting the fragment shader to
do early tests, since that would not take into account the sample mask
written from the shader.

Fixes:
dEQP-VK.fragment_operations.early_fragment.sample_count_early_fragment_tests_depth_samples_4

Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16626>

src/broadcom/compiler/nir_to_vir.c

index 1f9c2fa..a1561d4 100644 (file)
@@ -1931,6 +1931,7 @@ emit_frag_end(struct v3d_compile *c)
             !(c->s->info.num_images || c->s->info.num_ssbos) &&
             !c->s->info.fs.uses_discard &&
             !c->fs_key->sample_alpha_to_coverage &&
+            c->output_sample_mask_index == -1 &&
             has_any_tlb_color_write) {
                 c->s->info.fs.early_fragment_tests = true;
         }