aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Faye-Lund <[email protected]>2019-07-11 14:09:15 +0200
committerErik Faye-Lund <[email protected]>2019-10-28 08:51:46 +0000
commit55bcf9b1e0bc58ef52667db752a53be07343afb8 (patch)
tree8301b422653b79ea020cbbbf3846b2bc86b44079
parentcd59de1e3f5495ea35f699862d460d3bfc66f0cc (diff)
zink: process one aspect-mask bit at the time
Acked-by: Jordan Justen <[email protected]>
-rw-r--r--src/gallium/drivers/zink/zink_resource.c15
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, &copyRegion);
- else
- vkCmdCopyImageToBuffer(batch->cmdbuf, res->image, res->layout, staging_res->buffer, 1, &copyRegion);
+ 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, &copyRegion);
+ else
+ vkCmdCopyImageToBuffer(batch->cmdbuf, res->image, res->layout, staging_res->buffer, 1, &copyRegion);
+ }
return true;
}