From 5f216373700f6c05cdb31ab52ccef4cf8b6ddf34 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Wed, 19 Jun 2019 18:54:19 +0200 Subject: [PATCH] zink: simplify renderpass/framebuffer logic a tad Acked-by: Jordan Justen --- src/gallium/drivers/zink/zink_context.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 3da85808bc1..beefba1f755 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -441,9 +441,9 @@ zink_set_clip_state(struct pipe_context *pctx, } static struct zink_render_pass * -get_render_pass(struct zink_context *ctx, - const struct pipe_framebuffer_state *fb) +get_render_pass(struct zink_context *ctx) { + const struct pipe_framebuffer_state *fb = &ctx->fb_state; struct zink_render_pass_state state; for (int i = 0; i < fb->nr_cbufs; i++) { @@ -463,12 +463,16 @@ get_render_pass(struct zink_context *ctx, } static struct zink_framebuffer * -get_framebuffer(struct zink_context *ctx, - const struct pipe_framebuffer_state *fb, - struct zink_render_pass *rp) +get_framebuffer(struct zink_context *ctx) { + struct zink_screen *screen = zink_screen(ctx->base.screen); + struct zink_render_pass *rp = get_render_pass(ctx); // TODO: cache! - return zink_create_framebuffer(zink_screen(ctx->base.screen), fb, rp); + struct zink_framebuffer *ret = zink_create_framebuffer(screen, + &ctx->fb_state, + rp); + zink_render_pass_reference(screen, &rp, NULL); + return ret; } static void @@ -527,18 +531,15 @@ zink_set_framebuffer_state(struct pipe_context *pctx, struct zink_context *ctx = zink_context(pctx); struct zink_screen *screen = zink_screen(pctx->screen); - struct zink_render_pass *rp = get_render_pass(ctx, state); - zink_render_pass_reference(screen, &ctx->gfx_pipeline_state.render_pass, rp); + util_copy_framebuffer_state(&ctx->fb_state, state); - struct zink_framebuffer *fb = get_framebuffer(ctx, state, rp); + struct zink_framebuffer *fb = get_framebuffer(ctx); zink_framebuffer_reference(screen, &ctx->framebuffer, fb); + zink_render_pass_reference(screen, &ctx->gfx_pipeline_state.render_pass, fb->rp); zink_framebuffer_reference(screen, &fb, NULL); - zink_render_pass_reference(screen, &rp, NULL); ctx->gfx_pipeline_state.num_attachments = state->nr_cbufs; - util_copy_framebuffer_state(&ctx->fb_state, state); - flush_batch(ctx); struct zink_batch *batch = zink_context_curr_batch(ctx); -- 2.30.2