diff options
author | Christian Duerr <contact@christianduerr.com> | 2023-12-03 04:45:44 +0100 |
---|---|---|
committer | Eric Engestrom <eric@engestrom.ch> | 2024-02-07 16:22:20 +0000 |
commit | 781ea0997b0a01754c0c1218e324c55fb0e5af6e (patch) | |
tree | c9bf6bb612f16d1f03ab4c872ef076a8d1e88b73 | |
parent | 1bcb089aa79a391cc073483cd1dad8829e79b71c (diff) | |
download | mesa3d-781ea0997b0a01754c0c1218e324c55fb0e5af6e.tar.gz |
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: c65a9be421c ("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>
(cherry picked from commit 49c1b404e5e1cf7010855c1345d01c53e3e17ea5)
-rw-r--r-- | .pick_status.json | 2 | ||||
-rw-r--r-- | src/gallium/drivers/panfrost/pan_shader.c | 3 | ||||
-rw-r--r-- | src/panfrost/util/pan_lower_writeout.c | 2 |
3 files changed, 5 insertions, 2 deletions
diff --git a/.pick_status.json b/.pick_status.json index 89f5ab5e9ae..6891b8ed933 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -594,7 +594,7 @@ "description": "panfrost: Fix dual-source blending", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "c65a9be421cd4a338939e29e9dca1d8f81f165ac", "notes": null diff --git a/src/gallium/drivers/panfrost/pan_shader.c b/src/gallium/drivers/panfrost/pan_shader.c index 546910f8e66..2a3837cfb3b 100644 --- a/src/gallium/drivers/panfrost/pan_shader.c +++ b/src/gallium/drivers/panfrost/pan_shader.c @@ -369,7 +369,8 @@ 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; } diff --git a/src/panfrost/util/pan_lower_writeout.c b/src/panfrost/util/pan_lower_writeout.c index 56b33a495b0..0489952f162 100644 --- a/src/panfrost/util/pan_lower_writeout.c +++ b/src/panfrost/util/pan_lower_writeout.c @@ -106,6 +106,8 @@ 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; } |