zink: track number of fb attachment binds on resources

this will be useful for applying layouts

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11130>
This commit is contained in:
Mike Blumenkrantz
2021-03-09 13:28:54 -05:00
committed by Marge Bot
parent 9a1c833841
commit 3f332b16d5
2 changed files with 13 additions and 0 deletions

View File

@@ -1827,6 +1827,8 @@ zink_set_framebuffer_state(struct pipe_context *pctx,
zink_fb_clears_apply(ctx, surf->texture);
ctx->rp_changed = true;
}
if (surf)
zink_resource(surf->texture)->fb_binds--;
}
if (ctx->fb_state.zsbuf) {
struct pipe_surface *surf = ctx->fb_state.zsbuf;
@@ -1834,6 +1836,7 @@ zink_set_framebuffer_state(struct pipe_context *pctx,
zink_fb_clears_apply(ctx, ctx->fb_state.zsbuf->texture);
ctx->rp_changed = true;
}
zink_resource(surf->texture)->fb_binds--;
}
/* renderpass changes if the number or types of attachments change */
ctx->rp_changed |= ctx->fb_state.nr_cbufs != state->nr_cbufs;
@@ -1843,6 +1846,15 @@ zink_set_framebuffer_state(struct pipe_context *pctx,
unsigned h = ctx->fb_state.height;
util_copy_framebuffer_state(&ctx->fb_state, state);
for (int i = 0; i < ctx->fb_state.nr_cbufs; i++) {
struct pipe_surface *surf = ctx->fb_state.cbufs[i];
if (surf)
zink_resource(surf->texture)->fb_binds++;
}
if (ctx->fb_state.zsbuf) {
struct pipe_surface *surf = ctx->fb_state.zsbuf;
zink_resource(surf->texture)->fb_binds++;
}
if (ctx->fb_state.width != w || ctx->fb_state.height != h)
ctx->scissor_changed = true;
rebind_fb_state(ctx, NULL, true);

View File

@@ -105,6 +105,7 @@ struct zink_resource {
VkImageAspectFlags aspect;
bool optimal_tiling;
uint32_t sampler_binds[PIPE_SHADER_TYPES];
uint8_t fb_binds;
uint16_t image_bind_count[2]; //gfx, compute
};
};