zink: split out scissor flagging from framebuffer updating

this is kinda similar but not actually the same thing

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16476>
This commit is contained in:
Mike Blumenkrantz 2022-05-11 10:54:33 -04:00 committed by Marge Bot
parent 91a9676a0c
commit b25b8027e5
5 changed files with 12 additions and 9 deletions

View file

@ -533,7 +533,7 @@ zink_clear_depth_stencil(struct pipe_context *pctx, struct pipe_surface *dst,
if (fb_changed) {
ctx->fb_state.width = dstx + width;
ctx->fb_state.height = dsty + height;
zink_update_framebuffer_state(ctx, orig_width, orig_height);
ctx->fb_changed = true;
zink_batch_no_rp(ctx);
}
zink_clear(pctx, clear_flags, &scissor, NULL, depth, stencil);
@ -541,7 +541,7 @@ zink_clear_depth_stencil(struct pipe_context *pctx, struct pipe_surface *dst,
if (fb_changed) {
ctx->fb_state.width = orig_width;
ctx->fb_state.height = orig_height;
zink_update_framebuffer_state(ctx, dstx + width, dsty + height);
ctx->fb_changed = true;
zink_batch_no_rp(ctx);
}
} else {

View file

@ -2351,7 +2351,7 @@ zink_set_color_write_enables(struct zink_context *ctx)
/* use dummy color buffers instead of the more sane option */
zink_batch_no_rp(ctx);
ctx->rp_changed = true;
zink_update_framebuffer_state(ctx, ctx->fb_state.width, ctx->fb_state.height);
zink_update_framebuffer_state(ctx);
} else {
reapply_color_write(ctx);
}
@ -2434,7 +2434,9 @@ zink_set_framebuffer_state(struct pipe_context *pctx,
}
rebind_fb_state(ctx, NULL, true);
ctx->fb_state.samples = MAX2(samples, 1);
zink_update_framebuffer_state(ctx, w, h);
zink_update_framebuffer_state(ctx);
if (ctx->fb_state.width != w || ctx->fb_state.height != h)
ctx->scissor_changed = true;
uint8_t rast_samples = ctx->fb_state.samples - 1;
if (rast_samples != ctx->gfx_pipeline_state.rast_samples)

View file

@ -209,10 +209,8 @@ debug_describe_zink_framebuffer(char* buf, const struct zink_framebuffer *ptr)
}
void
zink_update_framebuffer_state(struct zink_context *ctx, int old_w, int old_h)
zink_update_framebuffer_state(struct zink_context *ctx)
{
if (ctx->fb_state.width != old_w || ctx->fb_state.height != old_h)
ctx->scissor_changed = true;
/* get_framebuffer adds a ref if the fb is reused or created;
* always do get_framebuffer first to avoid deleting the same fb
* we're about to use

View file

@ -86,5 +86,5 @@ struct zink_framebuffer *
zink_get_framebuffer(struct zink_context *ctx);
void
zink_update_framebuffer_state(struct zink_context *ctx, int old_w, int old_h);
zink_update_framebuffer_state(struct zink_context *ctx);
#endif

View file

@ -453,6 +453,7 @@ setup_framebuffer(struct zink_context *ctx)
if (!ctx->fb_changed)
return;
zink_update_framebuffer_state(ctx);
zink_init_framebuffer(screen, ctx->framebuffer, rp);
ctx->fb_changed = false;
ctx->gfx_pipeline_state.render_pass = rp;
@ -677,7 +678,9 @@ zink_render_update_swapchain(struct zink_context *ctx)
ctx->fb_state.width = ctx->swapchain_size.width;
ctx->fb_state.height = ctx->swapchain_size.height;
zink_kopper_fixup_depth_buffer(ctx);
zink_update_framebuffer_state(ctx, old_w, old_h);
if (ctx->fb_state.width != old_w || ctx->fb_state.height != old_h)
ctx->scissor_changed = true;
zink_update_framebuffer_state(ctx);
ctx->swapchain_size.width = ctx->swapchain_size.height = 0;
}
}