aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorErik Faye-Lund <[email protected]>2019-03-26 18:25:02 +0100
committerErik Faye-Lund <[email protected]>2019-10-28 08:51:44 +0000
commit0fcc9550b26afe23148aab2b1847d93f5a5ce3f6 (patch)
treec4138ae91f5e809c69d9b7a7e0f25fd67cfde1e1 /src
parentce66749e0b10bab369555ff624445a586c144e98 (diff)
zink: reference renderpass and framebuffer from cmdbuf
Acked-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/zink/zink_cmdbuf.c5
-rw-r--r--src/gallium/drivers/zink/zink_cmdbuf.h5
-rw-r--r--src/gallium/drivers/zink/zink_context.c12
3 files changed, 19 insertions, 3 deletions
diff --git a/src/gallium/drivers/zink/zink_cmdbuf.c b/src/gallium/drivers/zink/zink_cmdbuf.c
index ab07069128d..aab898f84b1 100644
--- a/src/gallium/drivers/zink/zink_cmdbuf.c
+++ b/src/gallium/drivers/zink/zink_cmdbuf.c
@@ -2,6 +2,8 @@
#include "zink_context.h"
#include "zink_fence.h"
+#include "zink_framebuffer.h"
+#include "zink_render_pass.h"
#include "zink_screen.h"
#include "util/u_debug.h"
@@ -15,6 +17,9 @@ reset_cmdbuf(struct zink_screen *screen, struct zink_cmdbuf *cmdbuf)
zink_fence_finish(screen, cmdbuf->fence, PIPE_TIMEOUT_INFINITE);
zink_fence_reference(screen, &cmdbuf->fence, NULL);
+
+ zink_render_pass_reference(screen, &cmdbuf->rp, NULL);
+ zink_framebuffer_reference(screen, &cmdbuf->fb, NULL);
}
struct zink_cmdbuf *
diff --git a/src/gallium/drivers/zink/zink_cmdbuf.h b/src/gallium/drivers/zink/zink_cmdbuf.h
index 822878d3028..ff5f4729760 100644
--- a/src/gallium/drivers/zink/zink_cmdbuf.h
+++ b/src/gallium/drivers/zink/zink_cmdbuf.h
@@ -28,10 +28,15 @@
struct zink_context;
struct zink_fence;
+struct zink_framebuffer;
+struct zink_render_pass;
struct zink_cmdbuf {
VkCommandBuffer cmdbuf;
struct zink_fence *fence;
+
+ struct zink_render_pass *rp;
+ struct zink_framebuffer *fb;
};
struct zink_cmdbuf *
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 30ac725d079..af9fc3c5fe9 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -760,8 +760,9 @@ zink_bind_vertex_buffers(VkCommandBuffer cmdbuf, struct zink_context *ctx)
}
static void
-begin_render_pass(struct zink_cmdbuf *cmdbuf, struct zink_render_pass *rp,
- struct zink_framebuffer *fb, unsigned width, unsigned height)
+begin_render_pass(struct zink_screen *screen, struct zink_cmdbuf *cmdbuf,
+ struct zink_render_pass *rp, struct zink_framebuffer *fb,
+ unsigned width, unsigned height)
{
VkRenderPassBeginInfo rpbi = {};
rpbi.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
@@ -774,6 +775,11 @@ begin_render_pass(struct zink_cmdbuf *cmdbuf, struct zink_render_pass *rp,
rpbi.pClearValues = NULL;
rpbi.framebuffer = fb->fb;
+ assert(rp && fb);
+ assert(!cmdbuf->rp && !cmdbuf->fb);
+ zink_render_pass_reference(screen, &cmdbuf->rp, rp);
+ zink_framebuffer_reference(screen, &cmdbuf->fb, fb);
+
vkCmdBeginRenderPass(cmdbuf->cmdbuf, &rpbi, VK_SUBPASS_CONTENTS_INLINE);
}
@@ -872,7 +878,7 @@ zink_draw_vbo(struct pipe_context *pctx,
if (!cmdbuf)
return;
- begin_render_pass(cmdbuf, ctx->gfx_pipeline_state.render_pass,
+ begin_render_pass(screen, cmdbuf, ctx->gfx_pipeline_state.render_pass,
ctx->framebuffer,
ctx->fb_state.width, ctx->fb_state.height);