Mesa (master): zink: verify that src and dst aspects are the same in resource_copy_region hook

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Sep 24 20:39:47 UTC 2020


Module: Mesa
Branch: master
Commit: 00515517016d3759543c097db68013fe287d8342
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=00515517016d3759543c097db68013fe287d8342

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Mon Jun 15 11:48:29 2020 -0400

zink: verify that src and dst aspects are the same in resource_copy_region hook

this is required by spec

Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6263>

---

 src/gallium/drivers/zink/zink_context.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 70845bb4385..6ef4e8fb23e 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -913,6 +913,17 @@ zink_resource_copy_region(struct pipe_context *pctx,
    struct zink_context *ctx = zink_context(pctx);
    if (dst->base.target != PIPE_BUFFER && src->base.target != PIPE_BUFFER) {
       VkImageCopy region = {};
+      if (util_format_get_num_planes(src->base.format) == 1 &&
+          util_format_get_num_planes(dst->base.format) == 1) {
+      /* If neither the calling command’s srcImage nor the calling command’s dstImage
+       * has a multi-planar image format then the aspectMask member of srcSubresource
+       * and dstSubresource must match
+       *
+       * -VkImageCopy spec
+       */
+         assert(src->aspect == dst->aspect);
+      } else
+         unreachable("planar formats not yet handled");
 
       region.srcSubresource.aspectMask = src->aspect;
       region.srcSubresource.mipLevel = src_level;



More information about the mesa-commit mailing list