Mesa (staging/22.0): anv: Disallow blending on swizzled formats

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 21 17:52:04 UTC 2022


Module: Mesa
Branch: staging/22.0
Commit: debfdc7c7a577831b4f86b222f2113f961ed7396
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=debfdc7c7a577831b4f86b222f2113f961ed7396

Author: Jason Ekstrand <jason.ekstrand at collabora.com>
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 <lionel.g.landwerlin at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15624>
(cherry picked from commit 54509d27d9cf7f85db30111a3b74bbdd031f2d9b)

---

 src/intel/vulkan/anv_formats.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

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;
    }
 



More information about the mesa-commit mailing list