From 9c24784b7c15b815499a879cb4a486add8d61672 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 27 Mar 2023 15:35:47 -0400 Subject: [PATCH] zink: manually re-set framebuffer after msrtss replicate blit with the new zsbuf elimination handling, the fb state calculated in u_blitter's fb restore may be incorrect if the zsbuf has indeed been eliminated, so ensure the right fb is stored to be reapplied so that misrenders will be avoided fixes some crashes/misrenders in webgl (cherry picked from commit ec0860b40137779e1cbe92c8ca5b3e5d86105da5) Part-of: --- .pick_status.json | 2 +- src/gallium/drivers/zink/zink_render_pass.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index d2f28177f00..ef7b60b6814 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -139,7 +139,7 @@ "description": "zink: manually re-set framebuffer after msrtss replicate blit", "nominated": false, "nomination_type": null, - "resolution": 4, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/gallium/drivers/zink/zink_render_pass.c b/src/gallium/drivers/zink/zink_render_pass.c index 8b705529cbd..333c750fa7e 100644 --- a/src/gallium/drivers/zink/zink_render_pass.c +++ b/src/gallium/drivers/zink/zink_render_pass.c @@ -769,6 +769,7 @@ zink_begin_render_pass(struct zink_context *ctx) if (ctx->framebuffer->rp->state.msaa_expand_mask) { uint32_t rp_state = ctx->gfx_pipeline_state.rp_state; struct zink_render_pass *rp = ctx->gfx_pipeline_state.render_pass; + struct zink_framebuffer *fb = ctx->framebuffer; u_foreach_bit(i, ctx->framebuffer->rp->state.msaa_expand_mask) { struct zink_ctx_surface *csurf = (struct zink_ctx_surface*)ctx->fb_state.cbufs[i]; @@ -801,6 +802,9 @@ zink_begin_render_pass(struct zink_context *ctx) ctx->fb_changed = ctx->rp_changed = false; ctx->gfx_pipeline_state.rp_state = rp_state; ctx->gfx_pipeline_state.render_pass = rp; + /* manually re-set fb: depth buffer may have been eliminated */ + ctx->framebuffer = fb; + ctx->framebuffer->rp = rp; } assert(ctx->gfx_pipeline_state.render_pass); return begin_render_pass(ctx);