summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2023-05-11 11:07:45 -0400
committerMarge Bot <emma+marge@anholt.net>2023-05-15 22:52:57 +0000
commit468554804ce09b8cb5341fccaf441edf014d06a7 (patch)
tree70a2d5a4b4fbcc5c0471c2bf1ca71e4f9d030c61
parent864ccc7a92825a7b9e3bafb35f3875ee2ef72c79 (diff)
downloadmesa-468554804ce09b8cb5341fccaf441edf014d06a7.tar.gz
zink: ignore no-op image copies
rare, but it happens and is illegal affects: GTF-GL46.gtf30.GLCoverage.CoverageGL30 Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22960>
-rw-r--r--src/gallium/drivers/zink/zink_context.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 719428a561f..dc5f1510129 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -4389,7 +4389,9 @@ zink_resource_copy_region(struct pipe_context *pctx,
struct zink_resource *src = zink_resource(psrc);
struct zink_context *ctx = zink_context(pctx);
if (dst->base.b.target != PIPE_BUFFER && src->base.b.target != PIPE_BUFFER) {
- VkImageCopy region = {0};
+ VkImageCopy region;
+ /* fill struct holes */
+ memset(&region, 0, sizeof(region));
if (util_format_get_num_planes(src->base.b.format) == 1 &&
util_format_get_num_planes(dst->base.b.format) == 1) {
/* If neither the calling command’s srcImage nor the calling command’s dstImage
@@ -4470,6 +4472,12 @@ zink_resource_copy_region(struct pipe_context *pctx,
region.extent.width = src_box->width;
region.extent.height = src_box->height;
+ /* ignore no-op copies */
+ if (src == dst &&
+ !memcmp(&region.dstOffset, &region.srcOffset, sizeof(region.srcOffset)) &&
+ !memcmp(&region.dstSubresource, &region.srcSubresource, sizeof(region.srcSubresource)))
+ return;
+
zink_fb_clears_apply_or_discard(ctx, pdst, (struct u_rect){dstx, dstx + src_box->width, dsty, dsty + src_box->height}, false);
zink_fb_clears_apply_region(ctx, psrc, zink_rect_from_box(src_box));