From 55bcf9b1e0bc58ef52667db752a53be07343afb8 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Thu, 11 Jul 2019 14:09:15 +0200 Subject: [PATCH] zink: process one aspect-mask bit at the time Acked-by: Jordan Justen --- src/gallium/drivers/zink/zink_resource.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c index 55ad8115651..658774fcdf0 100644 --- a/src/gallium/drivers/zink/zink_resource.c +++ b/src/gallium/drivers/zink/zink_resource.c @@ -350,7 +350,6 @@ zink_transfer_copy_bufimage(struct zink_context *ctx, copyRegion.bufferOffset = staging_res->offset; copyRegion.bufferRowLength = 0; copyRegion.bufferImageHeight = 0; - copyRegion.imageSubresource.aspectMask = res->aspect; copyRegion.imageSubresource.mipLevel = trans->base.level; copyRegion.imageSubresource.layerCount = 1; if (res->base.array_size > 1) { @@ -369,10 +368,16 @@ zink_transfer_copy_bufimage(struct zink_context *ctx, zink_batch_reference_resoure(batch, res); zink_batch_reference_resoure(batch, staging_res); - if (buf2img) - vkCmdCopyBufferToImage(batch->cmdbuf, staging_res->buffer, res->image, res->layout, 1, ©Region); - else - vkCmdCopyImageToBuffer(batch->cmdbuf, res->image, res->layout, staging_res->buffer, 1, ©Region); + unsigned aspects = res->aspect; + while (aspects) { + int aspect = 1 << u_bit_scan(&aspects); + copyRegion.imageSubresource.aspectMask = aspect; + + if (buf2img) + vkCmdCopyBufferToImage(batch->cmdbuf, staging_res->buffer, res->image, res->layout, 1, ©Region); + else + vkCmdCopyImageToBuffer(batch->cmdbuf, res->image, res->layout, staging_res->buffer, 1, ©Region); + } return true; } -- 2.30.2