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>
This commit is contained in:
Mike Blumenkrantz
2023-05-11 11:07:45 -04:00
committed by Marge Bot
parent 864ccc7a92
commit 468554804c
+9 -1
View File
@@ -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 commands srcImage nor the calling commands 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));