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) {
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;
}