From 96c2036e118fb7405f5b086c798fe885df0caaa9 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Thu, 3 Jun 2021 16:45:31 +0200 Subject: [PATCH] zink: reject more illegal blits Vulkan has some additional restrictions for vkCmdBlitImage that we weren't testing for. Quting the Vulkan 1.2 spec, section 20.5 "Image Copies with Scaling", "Valid Usage" subsection: - If either of srcImage or dstImage was created with a signed integer VkFormat, the other must also have been created with a signed integer VkFormat - If either of srcImage or dstImage was created with an unsigned integer VkFormat, the other must also have been created with an unsigned integer VkFormat. So let's make sure we reject these illegal blits. Reviewed-By: Mike Blumenkrantz Reviewed-by: Hoe Hao Cheng Part-of: --- src/gallium/drivers/zink/zink_blit.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gallium/drivers/zink/zink_blit.c b/src/gallium/drivers/zink/zink_blit.c index 7dd4bfa05fb..3ea9ac7ca86 100644 --- a/src/gallium/drivers/zink/zink_blit.c +++ b/src/gallium/drivers/zink/zink_blit.c @@ -132,6 +132,12 @@ blit_native(struct zink_context *ctx, const struct pipe_blit_info *info) !(get_resource_features(screen, dst) & VK_FORMAT_FEATURE_BLIT_DST_BIT)) return false; + if ((util_format_is_pure_sint(info->src.format) != + util_format_is_pure_sint(info->dst.format)) || + (util_format_is_pure_uint(info->src.format) != + util_format_is_pure_uint(info->dst.format))) + return false; + if (info->filter == PIPE_TEX_FILTER_LINEAR && !(get_resource_features(screen, src) & VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT))