diff options
author | Erik Faye-Lund <[email protected]> | 2019-07-11 14:09:15 +0200 |
---|---|---|
committer | Erik Faye-Lund <[email protected]> | 2019-10-28 08:51:46 +0000 |
commit | 55bcf9b1e0bc58ef52667db752a53be07343afb8 (patch) | |
tree | 8301b422653b79ea020cbbbf3846b2bc86b44079 /src/gallium/drivers/zink/zink_resource.c | |
parent | cd59de1e3f5495ea35f699862d460d3bfc66f0cc (diff) |
zink: process one aspect-mask bit at the time
Acked-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/gallium/drivers/zink/zink_resource.c')
-rw-r--r-- | src/gallium/drivers/zink/zink_resource.c | 15 |
1 files 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; } |