anv: Disallow blending on swizzled formats

Fixes: c20f78dc5d ("anv: Support swizzled formats.")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15624>
This commit is contained in:
Jason Ekstrand
2022-03-29 16:35:49 -05:00
committed by Marge Bot
parent 257a20f40d
commit 54509d27d9

View File

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