From 468554804ce09b8cb5341fccaf441edf014d06a7 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 11 May 2023 11:07:45 -0400 Subject: [PATCH] zink: ignore no-op image copies rare, but it happens and is illegal affects: GTF-GL46.gtf30.GLCoverage.CoverageGL30 Part-of: --- src/gallium/drivers/zink/zink_context.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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(®ion, 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(®ion.dstOffset, ®ion.srcOffset, sizeof(region.srcOffset)) && + !memcmp(®ion.dstSubresource, ®ion.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));