Mesa (staging/22.0): zink: track internal conditional render state
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Apr 14 18:18:04 UTC 2022
Module: Mesa
Branch: staging/22.0
Commit: 9d214402728feb0a34c69145783758d5b5b1750d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9d214402728feb0a34c69145783758d5b5b1750d
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Thu Feb 3 17:15:38 2022 -0500
zink: track internal conditional render state
this allows no-oping redundant calls
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15018>
(cherry picked from commit 082b42fbda231f54c366f44f3b263ba3a77d2cef)
---
src/gallium/drivers/zink/zink_context.h | 1 +
src/gallium/drivers/zink/zink_query.c | 9 +++++----
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/gallium/drivers/zink/zink_context.h b/src/gallium/drivers/zink/zink_context.h
index 3b6d9c0bffe..97b1130e797 100644
--- a/src/gallium/drivers/zink/zink_context.h
+++ b/src/gallium/drivers/zink/zink_context.h
@@ -293,6 +293,7 @@ struct zink_context {
struct {
struct zink_query *query;
bool inverted;
+ bool active; //this is the internal vk state
} render_condition;
struct pipe_resource *dummy_vertex_buffer;
diff --git a/src/gallium/drivers/zink/zink_query.c b/src/gallium/drivers/zink/zink_query.c
index 0ed073b5e37..9317d7ffe2f 100644
--- a/src/gallium/drivers/zink/zink_query.c
+++ b/src/gallium/drivers/zink/zink_query.c
@@ -882,7 +882,7 @@ zink_set_active_query_state(struct pipe_context *pctx, bool enable)
void
zink_start_conditional_render(struct zink_context *ctx)
{
- if (unlikely(!zink_screen(ctx->base.screen)->info.have_EXT_conditional_rendering))
+ if (unlikely(!zink_screen(ctx->base.screen)->info.have_EXT_conditional_rendering) || ctx->render_condition.active)
return;
struct zink_batch *batch = &ctx->batch;
VkConditionalRenderingFlagsEXT begin_flags = 0;
@@ -894,6 +894,7 @@ zink_start_conditional_render(struct zink_context *ctx)
begin_info.flags = begin_flags;
VKCTX(CmdBeginConditionalRenderingEXT)(batch->state->cmdbuf, &begin_info);
zink_batch_reference_resource_rw(batch, ctx->render_condition.query->predicate, false);
+ ctx->render_condition.active = true;
}
void
@@ -901,9 +902,10 @@ zink_stop_conditional_render(struct zink_context *ctx)
{
struct zink_batch *batch = &ctx->batch;
zink_clear_apply_conditionals(ctx);
- if (unlikely(!zink_screen(ctx->base.screen)->info.have_EXT_conditional_rendering))
+ if (unlikely(!zink_screen(ctx->base.screen)->info.have_EXT_conditional_rendering) || !ctx->render_condition.active)
return;
VKCTX(CmdEndConditionalRenderingEXT)(batch->state->cmdbuf);
+ ctx->render_condition.active = false;
}
bool
@@ -935,8 +937,7 @@ zink_render_condition(struct pipe_context *pctx,
/* force conditional clears if they exist */
if (ctx->clears_enabled && !ctx->batch.in_rp)
zink_batch_rp(ctx);
- if (ctx->batch.in_rp)
- zink_stop_conditional_render(ctx);
+ zink_stop_conditional_render(ctx);
ctx->render_condition_active = false;
ctx->render_condition.query = NULL;
return;
More information about the mesa-commit
mailing list