zink: add a renderpass flag for mixed zs layout

this indicates that the layout requires reading from the depth aspect
and writing to the stencil aspect

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15716>
This commit is contained in:
Mike Blumenkrantz 2022-04-05 14:55:05 -04:00 committed by Marge Bot
parent f24b966d27
commit 7781a75229
2 changed files with 9 additions and 3 deletions

View File

@ -1998,9 +1998,14 @@ get_render_pass(struct zink_context *ctx)
clears |= PIPE_CLEAR_STENCIL;
const uint64_t outputs_written = ctx->gfx_stages[PIPE_SHADER_FRAGMENT] ?
ctx->gfx_stages[PIPE_SHADER_FRAGMENT]->nir->info.outputs_written : 0;
bool needs_write = (ctx->dsa_state && ctx->dsa_state->hw_state.depth_write) ||
outputs_written & (BITFIELD64_BIT(FRAG_RESULT_DEPTH) | BITFIELD64_BIT(FRAG_RESULT_STENCIL));
state.rts[fb->nr_cbufs].needs_write = needs_write || state.num_zsresolves || state.rts[fb->nr_cbufs].clear_color || state.rts[fb->nr_cbufs].clear_stencil;
bool needs_write_z = (ctx->dsa_state && ctx->dsa_state->hw_state.depth_write) ||
outputs_written & BITFIELD64_BIT(FRAG_RESULT_DEPTH);
needs_write_z |= state.num_zsresolves || state.rts[fb->nr_cbufs].clear_color;
bool needs_write_s = state.rts[fb->nr_cbufs].clear_stencil || outputs_written & BITFIELD64_BIT(FRAG_RESULT_STENCIL);
if (!needs_write_z && (!ctx->dsa_state || !ctx->dsa_state->base.depth_enabled))
state.rts[fb->nr_cbufs].mixed_zs = needs_write_s && zsbuf->bind_count[0];
state.rts[fb->nr_cbufs].needs_write = needs_write_z | needs_write_s;
state.num_rts++;
}
state.have_zsbuf = fb->zsbuf != NULL;

View File

@ -44,6 +44,7 @@ struct zink_rt_attrib {
bool needs_write;
};
bool resolve;
bool mixed_zs;
};
struct zink_render_pass_state {