zink: track whether there's any transient attachments bound

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16476>
This commit is contained in:
Mike Blumenkrantz 2022-05-10 12:25:43 -04:00 committed by Marge Bot
parent b2a33d364e
commit ec3a7323da
2 changed files with 7 additions and 0 deletions

View file

@ -2384,10 +2384,14 @@ zink_set_framebuffer_state(struct pipe_context *pctx,
zink_update_fbfetch(ctx);
unsigned prev_void_alpha_attachments = ctx->gfx_pipeline_state.void_alpha_attachments;
ctx->gfx_pipeline_state.void_alpha_attachments = 0;
ctx->transient_attachments = 0;
for (int i = 0; i < ctx->fb_state.nr_cbufs; i++) {
struct pipe_surface *psurf = ctx->fb_state.cbufs[i];
if (psurf) {
struct zink_surface *transient = zink_transient_surface(psurf);
if (transient)
ctx->transient_attachments |= BITFIELD_BIT(i);
if (!samples)
samples = MAX3(transient ? transient->base.nr_samples : 1, psurf->texture->nr_samples, 1);
struct zink_resource *res = zink_resource(psurf->texture);
@ -2410,6 +2414,8 @@ zink_set_framebuffer_state(struct pipe_context *pctx,
if (ctx->fb_state.zsbuf) {
struct pipe_surface *psurf = ctx->fb_state.zsbuf;
struct zink_surface *transient = zink_transient_surface(psurf);
if (transient)
ctx->transient_attachments |= BITFIELD_BIT(PIPE_MAX_COLOR_BUFS);
if (!samples)
samples = MAX3(transient ? transient->base.nr_samples : 1, psurf->texture->nr_samples, 1);
zink_resource(psurf->texture)->fb_binds++;

View file

@ -214,6 +214,7 @@ struct zink_context {
uint32_t writable_ssbos[PIPE_SHADER_TYPES];
struct zink_image_view image_views[PIPE_SHADER_TYPES][ZINK_MAX_SHADER_IMAGES];
uint32_t transient_attachments;
struct pipe_framebuffer_state fb_state;
struct hash_table framebuffer_cache;