zink: use surface references for fb attachments

this guarantees the lifetimes of framebuffer surfaces

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9665>
This commit is contained in:
Mike Blumenkrantz 2020-12-22 10:25:14 -05:00
parent 17ef151f62
commit c56fe22064

View file

@ -1264,10 +1264,12 @@ zink_begin_render_pass(struct zink_context *ctx, struct zink_batch *batch)
framebuffer_state_buffer_barriers_setup(ctx, fb_state, batch);
zink_batch_reference_framebuffer(batch, ctx->framebuffer);
for (int i = 0; i < ARRAY_SIZE(ctx->framebuffer->surfaces); i++) {
if (!ctx->framebuffer->surfaces[i])
break;
zink_batch_reference_resource_rw(batch, zink_resource(ctx->framebuffer->surfaces[i]->texture), true);
for (int i = 0; i < ctx->framebuffer->state.num_attachments; i++) {
if (ctx->framebuffer->surfaces[i]) {
struct zink_surface *surf = zink_surface(ctx->framebuffer->surfaces[i]);
zink_batch_reference_resource_rw(batch, zink_resource(surf->base.texture), true);
zink_batch_reference_surface(batch, surf);
}
}
vkCmdBeginRenderPass(batch->state->cmdbuf, &rpbi, VK_SUBPASS_CONTENTS_INLINE);