zink: fix (dynamic rendering) execution of scissored clears during flush

in the case where the renderpass did not change, this would
otherwise have skipped the mask composition for in-rp clears

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27553>
(cherry picked from commit 50b671c1c39ebae5131723b8e4e10a6653f6c464)
This commit is contained in:
Mike Blumenkrantz 2024-02-22 09:08:32 -05:00 committed by Eric Engestrom
parent baba35ed69
commit 850c9dbdc9
2 changed files with 24 additions and 5 deletions

View file

@ -214,7 +214,7 @@
"description": "zink: fix (dynamic rendering) execution of scissored clears during flush",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -2847,6 +2847,29 @@ begin_rendering(struct zink_context *ctx)
ctx->dynamic_fb.attachments[PIPE_MAX_COLOR_BUFS+1].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
}
}
}
if (changed_size || changed_layout)
ctx->rp_changed = true;
ctx->rp_loadop_changed = false;
ctx->rp_layout_changed = false;
}
/* always assemble clear_buffers mask:
* if a scissored clear must be triggered during glFlush,
* the renderpass metadata may be unchanged (e.g., LOAD from previous rp),
* but the buffer mask must still be returned
*/
if (ctx->clears_enabled) {
for (int i = 0; i < ctx->fb_state.nr_cbufs; i++) {
/* these are no-ops */
if (!ctx->fb_state.cbufs[i] || !zink_fb_clear_enabled(ctx, i))
continue;
/* these need actual clear calls inside the rp */
if (zink_fb_clear_needs_explicit(&ctx->fb_clears[i]))
clear_buffers |= (PIPE_CLEAR_COLOR0 << i);
}
if (ctx->fb_state.zsbuf && zink_fb_clear_enabled(ctx, PIPE_MAX_COLOR_BUFS)) {
struct zink_framebuffer_clear *fb_clear = &ctx->fb_clears[PIPE_MAX_COLOR_BUFS];
struct zink_framebuffer_clear_data *clear = zink_fb_clear_element(fb_clear, 0);
if (zink_fb_clear_needs_explicit(fb_clear)) {
for (int j = !zink_fb_clear_element_needs_explicit(clear);
(clear_buffers & PIPE_CLEAR_DEPTHSTENCIL) != PIPE_CLEAR_DEPTHSTENCIL && j < zink_fb_clear_count(fb_clear);
@ -2854,10 +2877,6 @@ begin_rendering(struct zink_context *ctx)
clear_buffers |= zink_fb_clear_element(fb_clear, j)->zs.bits;
}
}
if (changed_size || changed_layout)
ctx->rp_changed = true;
ctx->rp_loadop_changed = false;
ctx->rp_layout_changed = false;
}
if (!ctx->rp_changed && ctx->batch.in_rp)