Mesa (master): zink: add batch flag for checking renderpass state
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Jan 14 22:18:16 UTC 2021
Module: Mesa
Branch: master
Commit: b2e5dadd229cf77a302ec082f443bf502f0d7990
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b2e5dadd229cf77a302ec082f443bf502f0d7990
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Thu Dec 24 09:16:33 2020 -0500
zink: add batch flag for checking renderpass state
Reviewed-by: Adam Jackson <ajax at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8227>
---
src/gallium/drivers/zink/zink_batch.h | 2 ++
src/gallium/drivers/zink/zink_context.c | 21 +++++++++++++--------
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/src/gallium/drivers/zink/zink_batch.h b/src/gallium/drivers/zink/zink_batch.h
index c7578f4f9a2..20c07766450 100644
--- a/src/gallium/drivers/zink/zink_batch.h
+++ b/src/gallium/drivers/zink/zink_batch.h
@@ -57,6 +57,8 @@ struct zink_batch {
struct util_dynarray zombie_samplers;
struct set *active_queries; /* zink_query objects which were active at some point in this batch */
+
+ bool in_rp; //renderpass is currently active
};
/* release all resources attached to batch */
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 5ab2b90b741..4213d76ca42 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -774,26 +774,31 @@ zink_begin_render_pass(struct zink_context *ctx, struct zink_batch *batch)
rpbi.framebuffer = ctx->framebuffer->fb;
assert(ctx->gfx_pipeline_state.render_pass && ctx->framebuffer);
- assert(!batch->rp || batch->rp == ctx->gfx_pipeline_state.render_pass);
assert(!batch->fb || batch->fb == ctx->framebuffer);
framebuffer_state_buffer_barriers_setup(ctx, fb_state, batch);
- zink_render_pass_reference(screen, &batch->rp, ctx->gfx_pipeline_state.render_pass);
zink_framebuffer_reference(screen, &batch->fb, ctx->framebuffer);
for (struct zink_surface **surf = (struct zink_surface **)batch->fb->surfaces; *surf; surf++)
zink_batch_reference_resource_rw(batch, zink_resource((*surf)->base.texture), true);
vkCmdBeginRenderPass(batch->cmdbuf, &rpbi, VK_SUBPASS_CONTENTS_INLINE);
+ batch->in_rp = true;
}
static void
-flush_batch(struct zink_context *ctx)
+zink_end_render_pass(struct zink_context *ctx, struct zink_batch *batch)
{
- struct zink_batch *batch = zink_curr_batch(ctx);
- if (batch->rp)
+ if (batch->in_rp)
vkCmdEndRenderPass(batch->cmdbuf);
+ batch->in_rp = false;
+}
+static void
+flush_batch(struct zink_context *ctx)
+{
+ struct zink_batch *batch = zink_curr_batch(ctx);
+ zink_end_render_pass(ctx, batch);
zink_end_batch(ctx, batch);
ctx->curr_batch++;
@@ -807,7 +812,7 @@ struct zink_batch *
zink_batch_rp(struct zink_context *ctx)
{
struct zink_batch *batch = zink_curr_batch(ctx);
- if (!batch->rp) {
+ if (!batch->in_rp) {
zink_begin_render_pass(ctx, batch);
assert(batch->rp);
}
@@ -818,11 +823,11 @@ struct zink_batch *
zink_batch_no_rp(struct zink_context *ctx)
{
struct zink_batch *batch = zink_curr_batch(ctx);
- if (batch->rp) {
+ if (batch->in_rp) {
/* flush batch and get a new one */
flush_batch(ctx);
batch = zink_curr_batch(ctx);
- assert(!batch->rp);
+ assert(!batch->in_rp);
}
return batch;
}
More information about the mesa-commit
mailing list