Mesa (main): zink: reject more illegal blits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 11 09:51:43 UTC 2021


Module: Mesa
Branch: main
Commit: 96c2036e118fb7405f5b086c798fe885df0caaa9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=96c2036e118fb7405f5b086c798fe885df0caaa9

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Thu Jun  3 16:45:31 2021 +0200

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 at gmail.com>
Reviewed-by: Hoe Hao Cheng <haochengho12907 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11217>

---

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



More information about the mesa-commit mailing list