From: Erik Faye-Lund Date: Mon, 25 Mar 2019 11:54:56 +0000 (+0100) Subject: zink: prepare for caching of renderpases/framebuffers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=70344223890d793f1fc00d07c872cb934130bc41;p=mesa.git zink: prepare for caching of renderpases/framebuffers Acked-by: Jordan Justen --- diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 2ce780ce9ff..0a3d52385fd 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -424,7 +424,7 @@ zink_set_clip_state(struct pipe_context *pctx, } static struct zink_render_pass * -get_render_pass(struct zink_screen *screen, +get_render_pass(struct zink_context *ctx, const struct pipe_framebuffer_state *fb) { struct zink_render_pass_state state; @@ -441,7 +441,17 @@ get_render_pass(struct zink_screen *screen, } state.have_zsbuf = fb->zsbuf != NULL; - return zink_create_render_pass(screen, &state); + // TODO: cache instead! + return zink_create_render_pass(zink_screen(ctx->base.screen), &state); +} + +static struct zink_framebuffer * +get_framebuffer(struct zink_context *ctx, + const struct pipe_framebuffer_state *fb, + struct zink_render_pass *rp) +{ + // TODO: cache! + return zink_create_framebuffer(zink_screen(ctx->base.screen), fb, rp); } static void @@ -451,10 +461,10 @@ 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(screen, state); + struct zink_render_pass *rp = get_render_pass(ctx, state); zink_render_pass_reference(screen, &ctx->render_pass, rp); - struct zink_framebuffer *fb = zink_create_framebuffer(screen, state, rp); + struct zink_framebuffer *fb = get_framebuffer(ctx, state, rp); zink_framebuffer_reference(screen, &ctx->framebuffer, fb); zink_framebuffer_reference(screen, &fb, NULL); zink_render_pass_reference(screen, &rp, NULL);