diff --git a/src/gallium/drivers/zink/zink_clear.c b/src/gallium/drivers/zink/zink_clear.c index 97d2baeb70a..c1fa0106431 100644 --- a/src/gallium/drivers/zink/zink_clear.c +++ b/src/gallium/drivers/zink/zink_clear.c @@ -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 { diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index bdc28793902..260a6da7ac6 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -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) diff --git a/src/gallium/drivers/zink/zink_framebuffer.c b/src/gallium/drivers/zink/zink_framebuffer.c index ec83d3e26fc..852c99bcb69 100644 --- a/src/gallium/drivers/zink/zink_framebuffer.c +++ b/src/gallium/drivers/zink/zink_framebuffer.c @@ -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 diff --git a/src/gallium/drivers/zink/zink_framebuffer.h b/src/gallium/drivers/zink/zink_framebuffer.h index 24d0dbf46d7..7544074e89b 100644 --- a/src/gallium/drivers/zink/zink_framebuffer.h +++ b/src/gallium/drivers/zink/zink_framebuffer.h @@ -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 diff --git a/src/gallium/drivers/zink/zink_render_pass.c b/src/gallium/drivers/zink/zink_render_pass.c index 6e330cb59c8..fecb93f345a 100644 --- a/src/gallium/drivers/zink/zink_render_pass.c +++ b/src/gallium/drivers/zink/zink_render_pass.c @@ -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; } }