Mesa (main): zink: add explicit (awful) handling for fb layer mismatch clears
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jul 18 03:57:16 UTC 2022
Module: Mesa
Branch: main
Commit: 95f1c84739f5e67e2df26e459aa394fdaec63fee
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=95f1c84739f5e67e2df26e459aa394fdaec63fee
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Fri Jul 8 11:47:56 2022 -0400
zink: add explicit (awful) handling for fb layer mismatch clears
this is terrible and (hopefully?) rare, so just force it out early to
avoid any kind of issue
Acked-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17366>
---
src/gallium/drivers/zink/zink_clear.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/src/gallium/drivers/zink/zink_clear.c b/src/gallium/drivers/zink/zink_clear.c
index 9f38e728238..8f39b4ad4b0 100644
--- a/src/gallium/drivers/zink/zink_clear.c
+++ b/src/gallium/drivers/zink/zink_clear.c
@@ -227,6 +227,34 @@ zink_clear(struct pipe_context *pctx,
needs_rp = !zink_blit_region_fills(scissor, fb->width, fb->height);
}
+ if (unlikely(ctx->fb_layer_mismatch)) {
+ /* this is a terrible scenario:
+ * at least one attachment has a layerCount greater than the others,
+ * so iterate over all the mismatched attachments and pre-clear them separately,
+ * then continue to flag them as need (additional) clearing
+ * to avoid loadOp=LOAD
+ */
+ unsigned x = 0;
+ unsigned y = 0;
+ unsigned w = ctx->fb_state.width;
+ unsigned h = ctx->fb_state.height;
+ if (scissor_state) {
+ x = scissor_state->minx;
+ y = scissor_state->miny;
+ w = scissor_state->minx + scissor_state->maxx;
+ h = scissor_state->miny + scissor_state->maxy;
+ }
+ unsigned clear_buffers = buffers >> 2;
+ for (unsigned i = 0; i < ctx->fb_state.nr_cbufs; i++) {
+ if (ctx->fb_state.cbufs[i] &&
+ (ctx->fb_layer_mismatch & clear_buffers & BITFIELD_BIT(i)))
+ pctx->clear_render_target(pctx, ctx->fb_state.cbufs[i], pcolor,
+ x, y, w, h, ctx->render_condition_active);
+ }
+ if (ctx->fb_state.zsbuf && (buffers & PIPE_CLEAR_DEPTHSTENCIL))
+ pctx->clear_depth_stencil(pctx, ctx->fb_state.zsbuf, buffers & PIPE_CLEAR_DEPTHSTENCIL, depth, stencil,
+ x, y, w, h, ctx->render_condition_active);
+ }
if (batch->in_rp) {
clear_in_rp(pctx, buffers, scissor_state, pcolor, depth, stencil);
More information about the mesa-commit
mailing list