From: Erik Faye-Lund Date: Mon, 15 Jul 2019 10:16:25 +0000 (+0200) Subject: zink: ensure layout is reasonable before copying X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c96963a8d1220b0f9e0e8b766c8e50bc8af9633b;p=mesa.git zink: ensure layout is reasonable before copying Acked-by: Jordan Justen --- diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 430252441d1..15f2de6f52b 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -1338,6 +1338,20 @@ zink_resource_copy_region(struct pipe_context *pctx, zink_batch_reference_resoure(batch, src); zink_batch_reference_resoure(batch, dst); + if (src->layout != VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL && + src->layout != VK_IMAGE_LAYOUT_GENERAL) { + zink_resource_barrier(batch->cmdbuf, src, src->aspect, + VK_IMAGE_LAYOUT_GENERAL); + src->layout = VK_IMAGE_LAYOUT_GENERAL; + } + + if (dst->layout != VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL && + dst->layout != VK_IMAGE_LAYOUT_GENERAL) { + zink_resource_barrier(batch->cmdbuf, dst, dst->aspect, + VK_IMAGE_LAYOUT_GENERAL); + dst->layout = VK_IMAGE_LAYOUT_GENERAL; + } + vkCmdCopyImage(batch->cmdbuf, src->image, src->layout, dst->image, dst->layout, 1, ®ion);