From 4ad08d90e046865c48f33e90d88b40d9bf50f050 Mon Sep 17 00:00:00 2001 From: Matthieu Oechslin Date: Sun, 30 Mar 2025 01:31:52 +0100 Subject: [PATCH] r600: Take dual source blending in account when creating target mask with RATs This is properly checked when filling CB_... registers in evergreen_emit_image_state(), but not when generating CB_TARGET_MASK. It would lead to an invalid command steam if a fragment shader uses SSBO/Image load/store alongside dual source blending. Acked-by: Patrick Lerda Fixes: a6b379284365 Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/622 Part-of: (cherry picked from commit 4e68e422e0da53e022fbf1b4f0716e5ee7a50ed6) --- .pick_status.json | 2 +- src/gallium/drivers/r600/evergreen_state.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index e02803b45fe..1bee8766b13 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -954,7 +954,7 @@ "description": "r600: Take dual source blending in account when creating target mask with RATs", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "a6b379284365e8adee780b691596d3a66de1ba93", "notes": null diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index c8a028d80c4..a246173cbe9 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -2032,7 +2032,7 @@ static void evergreen_emit_cb_misc_state(struct r600_context *rctx, struct r600_ struct r600_cb_misc_state *a = (struct r600_cb_misc_state*)atom; unsigned fb_colormask = a->bound_cbufs_target_mask; unsigned ps_colormask = a->ps_color_export_mask; - unsigned rat_colormask = evergreen_construct_rat_mask(rctx, a, a->nr_cbufs); + unsigned rat_colormask = evergreen_construct_rat_mask(rctx, a, a->nr_cbufs + (a->dual_src_blend ? 1 : 0)); radeon_set_context_reg_seq(cs, R_028238_CB_TARGET_MASK, 2); radeon_emit(cs, (a->blend_colormask & fb_colormask) | rat_colormask); /* R_028238_CB_TARGET_MASK */ /* This must match the used export instructions exactly.