Mesa (main): zink: emit fb attachment barriers inline during renderpass start
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jun 4 15:19:43 UTC 2021
Module: Mesa
Branch: main
Commit: 9a1c83384102c186af309bdd29f8cac569a7e809
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9a1c83384102c186af309bdd29f8cac569a7e809
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Wed Mar 3 10:56:16 2021 -0500
zink: emit fb attachment barriers inline during renderpass start
we don't need a separate function for this
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11130>
---
src/gallium/drivers/zink/zink_context.c | 25 ++++++-------------------
1 file changed, 6 insertions(+), 19 deletions(-)
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index c9406e85db7..3a30737b7ee 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -1504,24 +1504,6 @@ get_framebuffer(struct zink_context *ctx)
return fb;
}
-static void
-framebuffer_state_buffer_barriers_setup(struct zink_context *ctx,
- const struct pipe_framebuffer_state *state, struct zink_batch *batch)
-{
- for (int i = 0; i < state->nr_cbufs; i++) {
- struct pipe_surface *surf = state->cbufs[i];
- if (!surf)
- surf = ctx->framebuffer->null_surface;
- struct zink_resource *res = zink_resource(surf->texture);
- zink_resource_image_barrier(ctx, NULL, res, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, 0, 0);
- }
-
- if (state->zsbuf) {
- struct zink_resource *res = zink_resource(state->zsbuf->texture);
- zink_resource_image_barrier(ctx, NULL, res, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, 0, 0);
- }
-}
-
static void
setup_framebuffer(struct zink_context *ctx)
{
@@ -1611,6 +1593,12 @@ begin_render_pass(struct zink_context *ctx)
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);
+
+ VkImageLayout layout = i == ctx->framebuffer->state.num_attachments - 1 && fb_state->zsbuf ?
+ VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL :
+ VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
+ struct zink_resource *res = zink_resource(surf->base.texture);
+ zink_resource_image_barrier(ctx, NULL, res, layout, 0, 0);
}
}
@@ -1625,7 +1613,6 @@ zink_begin_render_pass(struct zink_context *ctx, struct zink_batch *batch)
{
setup_framebuffer(ctx);
assert(ctx->gfx_pipeline_state.render_pass);
- framebuffer_state_buffer_barriers_setup(ctx, &ctx->fb_state, batch);
unsigned clear_buffers = begin_render_pass(ctx);
if (ctx->render_condition.query)
More information about the mesa-commit
mailing list