Mesa (staging/20.2): radv: ignore other blend targets if dual-source blending is enabled

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Dec 14 18:48:24 UTC 2020


Module: Mesa
Branch: staging/20.2
Commit: 436f9bd6f5b17040cfa83e5058cd924a1d583b4d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=436f9bd6f5b17040cfa83e5058cd924a1d583b4d

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Thu Nov 19 12:00:23 2020 +0100

radv: ignore other blend targets if dual-source blending is enabled

Using more blend targets than specified by maxFragmentDualSrcAttachments
is invalid per the Vulkan spec.

I'm usually not a fan to workaround game bugs inside the driver but
it's really easy for us to ignore MRT1+ in the driver and that
prevents wrong behaviour.

Cc: 20.2, 20.3
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7684>
(cherry picked from commit bc7f442d8e03919cf7f8e6a470b3c0406e11a1f9)

---

 src/amd/vulkan/radv_pipeline.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index bf4a64750da..d3c9b1e23e0 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -555,8 +555,10 @@ radv_pipeline_compute_spi_color_formats(struct radv_pipeline *pipeline,
 	/* The output for dual source blending should have the same format as
 	 * the first output.
 	 */
-	if (blend->mrt0_is_dual_src)
+	if (blend->mrt0_is_dual_src) {
+		assert(!(col_format >> 4));
 		col_format |= (col_format & 0xf) << 4;
+	}
 
 	blend->spi_shader_col_format = col_format;
 	blend->col_format_is_int8 = is_int8;
@@ -684,6 +686,12 @@ radv_pipeline_init_blend_state(struct radv_pipeline *pipeline,
 			if (!att->colorWriteMask)
 				continue;
 
+			/* Ignore other blend targets if dual-source blending
+			 * is enabled to prevent wrong behaviour.
+			 */
+			if (blend.mrt0_is_dual_src)
+				continue;
+
 			blend.cb_target_mask |= (unsigned)att->colorWriteMask << (4 * i);
 			blend.cb_target_enabled_4bit |= 0xfu << (4 * i);
 			if (!att->blendEnable) {



More information about the mesa-commit mailing list