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 <michael.blumenkrantz@gmail.com>
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11217>
This commit is contained in:
Erik Faye-Lund 2021-06-03 16:45:31 +02:00 committed by Marge Bot
parent b16c12b0a0
commit 96c2036e11
1 changed files with 6 additions and 0 deletions

View File

@ -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))