Mesa (main): zink: flush pending clears if a resource is bound as a descriptor
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Jun 24 23:23:49 UTC 2021
Module: Mesa
Branch: main
Commit: be94bad12606c98ae3a06579b6740d20b11dca98
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=be94bad12606c98ae3a06579b6740d20b11dca98
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Sat Apr 24 13:16:20 2021 -0400
zink: flush pending clears if a resource is bound as a descriptor
ensure that resource data is in sync with the expected command stream
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11590>
---
src/gallium/drivers/zink/zink_context.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 7f55e289d39..337b3384f9f 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -1146,6 +1146,13 @@ update_binds_for_samplerviews(struct zink_context *ctx, struct zink_resource *re
}
}
+static void
+flush_pending_clears(struct zink_context *ctx, struct zink_resource *res)
+{
+ if (res->fb_binds && ctx->clears_enabled)
+ zink_fb_clears_apply(ctx, &res->base.b);
+}
+
static inline void
unbind_shader_image_counts(struct zink_context *ctx, struct zink_resource *res, bool is_compute, bool writable)
{
@@ -1249,6 +1256,7 @@ zink_set_shader_images(struct pipe_context *pctx,
if (res->bind_count[p_stage == PIPE_SHADER_COMPUTE] == 1 ||
res->layout != get_layout_for_binding(res, ZINK_DESCRIPTOR_TYPE_IMAGE, p_stage == PIPE_SHADER_COMPUTE))
_mesa_set_add(ctx->need_barriers[p_stage == PIPE_SHADER_COMPUTE], res);
+ flush_pending_clears(ctx, res);
}
if (!ctx->descriptor_refs_dirty[p_stage == PIPE_SHADER_COMPUTE]) {
zink_batch_reference_resource_rw(&ctx->batch, zink_resource(image_view->base.resource),
@@ -1331,7 +1339,7 @@ zink_set_sampler_views(struct pipe_context *pctx,
update |= iv != b->image_view->image_view;
} else if (a != b)
update = true;
-
+ flush_pending_clears(ctx, res);
res->sampler_binds[shader_type] |= BITFIELD_BIT(start_slot + i);
if (res->bind_count[shader_type == PIPE_SHADER_COMPUTE] == 1 ||
res->layout != get_layout_for_binding(res, ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW, shader_type == PIPE_SHADER_COMPUTE))
More information about the mesa-commit
mailing list