Mesa (staging/22.1): zink: fix framebuffer attachment usage asserts for dummy attachments
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jun 14 17:24:28 UTC 2022
Module: Mesa
Branch: staging/22.1
Commit: e87c8c53a70ac9234f858a843600f8d632dda5c0
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e87c8c53a70ac9234f858a843600f8d632dda5c0
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Fri May 27 10:04:05 2022 -0400
zink: fix framebuffer attachment usage asserts for dummy attachments
dummy attachments never overwrite existing attachments,
so they must be explicitly compared like this to avoid
erroneous crashing
Fixes: 3892c133811 ("zink: add an alternate path for EXT_color_write_enable usage")
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16848>
---
src/gallium/drivers/zink/zink_context.c | 26 +++++++++++++++++---------
1 file changed, 17 insertions(+), 9 deletions(-)
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index a97e3ea1faf..05445fd925f 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -2091,7 +2091,10 @@ get_render_pass(struct zink_context *ctx)
state.num_rts++;
}
state.have_zsbuf = fb->zsbuf != NULL;
- assert(clears == ctx->rp_clears_enabled);
+ if (zink_use_dummy_attachments(ctx))
+ assert(clears == (ctx->rp_clears_enabled & PIPE_CLEAR_DEPTHSTENCIL));
+ else
+ assert(clears == ctx->rp_clears_enabled);
state.clears = clears;
uint32_t hash = hash_render_pass_state(&state);
struct hash_entry *entry = _mesa_hash_table_search_pre_hashed(ctx->render_pass_cache, hash,
@@ -2327,7 +2330,7 @@ begin_render_pass(struct zink_context *ctx)
uint32_t clear_validate = 0;
for (int i = 0; i < fb_state->nr_cbufs; i++) {
/* these are no-ops */
- if (!fb_state->cbufs[i] || !zink_fb_clear_enabled(ctx, i))
+ if (!fb_state->cbufs[i] || !zink_fb_clear_enabled(ctx, i) || zink_use_dummy_attachments(ctx))
continue;
/* these need actual clear calls inside the rp */
struct zink_framebuffer_clear_data *clear = zink_fb_clear_element(&ctx->fb_clears[i], 0);
@@ -2380,13 +2383,18 @@ begin_render_pass(struct zink_context *ctx)
for (int i = 0; i < ctx->fb_state.nr_cbufs; i++) {
if (ctx->fb_state.cbufs[i]) {
struct zink_surface *surf = zink_csurface(ctx->fb_state.cbufs[i]);
- struct zink_surface *transient = zink_transient_surface(ctx->fb_state.cbufs[i]);
- if (surf->base.format == ctx->fb_state.cbufs[i]->format) {
- if (transient) {
- assert(zink_resource(transient->base.texture)->obj->vkusage == ctx->framebuffer->state.infos[i].usage);
- assert(zink_resource(surf->base.texture)->obj->vkusage == ctx->framebuffer->state.infos[cresolve_offset].usage);
- } else {
- assert(zink_resource(surf->base.texture)->obj->vkusage == ctx->framebuffer->state.infos[i].usage);
+ if (zink_use_dummy_attachments(ctx)) {
+ surf = zink_csurface(ctx->dummy_surface[util_logbase2_ceil(ctx->fb_state.samples)]);
+ assert(zink_resource(surf->base.texture)->obj->vkusage == ctx->framebuffer->state.infos[i].usage);
+ } else {
+ struct zink_surface *transient = zink_transient_surface(&surf->base);
+ if (surf->base.format == ctx->fb_state.cbufs[i]->format) {
+ if (transient) {
+ assert(zink_resource(transient->base.texture)->obj->vkusage == ctx->framebuffer->state.infos[i].usage);
+ assert(zink_resource(surf->base.texture)->obj->vkusage == ctx->framebuffer->state.infos[cresolve_offset].usage);
+ } else {
+ assert(zink_resource(surf->base.texture)->obj->vkusage == ctx->framebuffer->state.infos[i].usage);
+ }
}
}
}
More information about the mesa-commit
mailing list