panfrost: Fix dual-source blending

If dual blending is enabled, only 1 output is supported. Multiple
outputs confuse the write combining pass in this case, leading to
incorrect output and/or an assert failure in emit_fragment_store.

The fix is straightforward, just skip the speculative emitting of
multiple outputs in the case where dual source blending is enabled.

This also adds an extra sanity check in `pan_nir_lower_zs_store` to
check for only one blend store being present.

Fixes: c65a9be421 ("panfrost: Preprocess shaders at CSO create time")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9487
Co-Authored-By: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26474>
This commit is contained in:
Christian Duerr
2023-12-03 04:45:44 +01:00
committed by Marge Bot
parent 084f81fd52
commit 49c1b404e5
2 changed files with 2 additions and 1 deletions

View File

@@ -405,7 +405,7 @@ panfrost_create_shader_state(struct pipe_context *pctx,
if (nir->info.stage == MESA_SHADER_FRAGMENT &&
nir->info.outputs_written & BITFIELD_BIT(FRAG_RESULT_COLOR)) {
NIR_PASS_V(nir, nir_lower_fragcolor, 8);
NIR_PASS_V(nir, nir_lower_fragcolor, nir->info.fs.color_is_dual_source ? 1 : 8);
so->fragcolor_lowered = true;
}

View File

@@ -106,6 +106,7 @@ pan_nir_lower_zs_store(nir_shader *nir)
stores[1] = intr;
writeout |= PAN_WRITEOUT_S;
} else if (sem.dual_source_blend_index) {
assert(!stores[2]); /* there should be only 1 source for dual blending */
stores[2] = intr;
writeout |= PAN_WRITEOUT_2;
}