Module: Mesa Branch: staging/22.0 Commit: 5156e4c8331fef52167e130e23770ce1a07ae3d9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5156e4c8331fef52167e130e23770ce1a07ae3d9
Author: Jason Ekstrand <[email protected]> Date: Tue Mar 29 16:35:49 2022 -0500 anv: Disallow blending on swizzled formats Fixes: c20f78dc5d7e ("anv: Support swizzled formats.") Reviewed-by: Lionel Landwerlin <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15624> (cherry picked from commit 54509d27d9cf7f85db30111a3b74bbdd031f2d9b) --- .pick_status.json | 2 +- src/intel/vulkan/anv_formats.c | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index a4657bc784d..704a8811055 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -636,7 +636,7 @@ "description": "anv: Disallow blending on swizzled formats", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "because_sha": "c20f78dc5d7e0fabd58c2d8548d5a6ead1ec1072" }, { diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c index 5343433bd00..66536ba59a8 100644 --- a/src/intel/vulkan/anv_formats.c +++ b/src/intel/vulkan/anv_formats.c @@ -627,7 +627,14 @@ anv_get_image_format_features2(const struct intel_device_info *devinfo, plane_format.swizzle.a == ISL_CHANNEL_SELECT_ALPHA) { flags |= VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BIT_KHR; - if (isl_format_supports_alpha_blending(devinfo, plane_format.isl_format)) + /* While we can render to swizzled formats, they don't blend correctly + * if there are blend constants involved. The swizzle just remaps the + * output of the shader to different channels in the texture. It + * doesn't change the interpretation of the constant blend factors in + * COLOR_CALC_STATE. + */ + if (isl_format_supports_alpha_blending(devinfo, plane_format.isl_format) && + isl_swizzle_is_identity(plane_format.swizzle)) flags |= VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BLEND_BIT_KHR; }
