From: Erik Faye-Lund Date: Tue, 26 Mar 2019 17:25:02 +0000 (+0100) Subject: zink: reference renderpass and framebuffer from cmdbuf X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0fcc9550b26afe23148aab2b1847d93f5a5ce3f6;p=mesa.git zink: reference renderpass and framebuffer from cmdbuf Acked-by: Jordan Justen --- 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);