From: Erik Faye-Lund Date: Thu, 11 Jul 2019 12:09:15 +0000 (+0200) Subject: zink: process one aspect-mask bit at the time X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=55bcf9b1e0bc58ef52667db752a53be07343afb8;p=mesa.git zink: process one aspect-mask bit at the time Acked-by: Jordan Justen --- 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; }