zink: implement buffer-to-buffer copies
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Fri, 8 Nov 2019 11:53:43 +0000 (12:53 +0100)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Tue, 12 Nov 2019 12:40:49 +0000 (12:40 +0000)
src/gallium/drivers/zink/zink_context.c

index 30d19c6ffa285afb79c3ad7d0730e8fbaa613268..2be6ce351be68a821499cd31430bb1f8e524b29c 100644 (file)
@@ -1510,6 +1510,18 @@ zink_resource_copy_region(struct pipe_context *pctx,
       vkCmdCopyImage(batch->cmdbuf, src->image, src->layout,
                      dst->image, dst->layout,
                      1, &region);
+   } else if (dst->base.target == PIPE_BUFFER &&
+              src->base.target == PIPE_BUFFER) {
+      VkBufferCopy region;
+      region.srcOffset = src_box->x;
+      region.dstOffset = dstx;
+      region.size = src_box->width;
+
+      struct zink_batch *batch = zink_batch_no_rp(ctx);
+      zink_batch_reference_resoure(batch, src);
+      zink_batch_reference_resoure(batch, dst);
+
+      vkCmdCopyBuffer(batch->cmdbuf, src->buffer, dst->buffer, 1, &region);
    } else
       debug_printf("zink: TODO resource copy\n");
 }