aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Faye-Lund <[email protected]>2019-03-25 15:21:30 +0100
committerErik Faye-Lund <[email protected]>2019-10-28 08:51:44 +0000
commit86d0e741ec977193974c29c44cbf85699fedcf5a (patch)
tree80bd5229d067f73230aeecd763858f8b9505f0b3
parent229cd042d3a53e9057b3e8052ae47959deb7c647 (diff)
zink: prepare for multiple cmdbufs
Acked-by: Jordan Justen <[email protected]>
-rw-r--r--src/gallium/drivers/zink/zink_cmdbuf.c2
-rw-r--r--src/gallium/drivers/zink/zink_context.c8
-rw-r--r--src/gallium/drivers/zink/zink_context.h2
3 files changed, 7 insertions, 5 deletions
diff --git a/src/gallium/drivers/zink/zink_cmdbuf.c b/src/gallium/drivers/zink/zink_cmdbuf.c
index df55b2377f5..ab07069128d 100644
--- a/src/gallium/drivers/zink/zink_cmdbuf.c
+++ b/src/gallium/drivers/zink/zink_cmdbuf.c
@@ -20,7 +20,7 @@ reset_cmdbuf(struct zink_screen *screen, struct zink_cmdbuf *cmdbuf)
struct zink_cmdbuf *
zink_start_cmdbuf(struct zink_context *ctx)
{
- struct zink_cmdbuf *cmdbuf = &ctx->cmdbuf;
+ struct zink_cmdbuf *cmdbuf = &ctx->cmdbufs[0];
reset_cmdbuf(zink_screen(ctx->base.screen), cmdbuf);
VkCommandBufferBeginInfo cbbi = {};
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index b437bd3269d..4b31557cda9 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -53,7 +53,8 @@ zink_context_destroy(struct pipe_context *pctx)
{
struct zink_context *ctx = zink_context(pctx);
struct zink_screen *screen = zink_screen(pctx->screen);
- vkFreeCommandBuffers(screen->dev, ctx->cmdpool, 1, &ctx->cmdbuf.cmdbuf);
+ for (int i = 0; i < ARRAY_SIZE(ctx->cmdbufs); ++i)
+ vkFreeCommandBuffers(screen->dev, ctx->cmdpool, 1, &ctx->cmdbufs[i].cmdbuf);
vkDestroyCommandPool(screen->dev, ctx->cmdpool, NULL);
util_primconvert_destroy(ctx->primconvert);
@@ -1197,8 +1198,9 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
cbai.commandPool = ctx->cmdpool;
cbai.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
cbai.commandBufferCount = 1;
- if (vkAllocateCommandBuffers(screen->dev, &cbai, &ctx->cmdbuf.cmdbuf) != VK_SUCCESS)
- goto fail;
+ for (int i = 0; i < ARRAY_SIZE(ctx->cmdbufs); ++i)
+ if (vkAllocateCommandBuffers(screen->dev, &cbai, &ctx->cmdbufs[i].cmdbuf) != VK_SUCCESS)
+ goto fail;
VkDescriptorPoolSize sizes[] = {
{VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1000}
diff --git a/src/gallium/drivers/zink/zink_context.h b/src/gallium/drivers/zink/zink_context.h
index fdf6ed665f6..81aeb337e7f 100644
--- a/src/gallium/drivers/zink/zink_context.h
+++ b/src/gallium/drivers/zink/zink_context.h
@@ -60,7 +60,7 @@ struct zink_context {
struct blitter_context *blitter;
VkCommandPool cmdpool;
- struct zink_cmdbuf cmdbuf;
+ struct zink_cmdbuf cmdbufs[1];
VkQueue queue;