zink: track internal conditional render state
this allows no-oping redundant calls Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15018>
This commit is contained in:
parent
db48dcb4f3
commit
082b42fbda
|
@ -293,6 +293,7 @@ struct zink_context {
|
||||||
struct {
|
struct {
|
||||||
struct zink_query *query;
|
struct zink_query *query;
|
||||||
bool inverted;
|
bool inverted;
|
||||||
|
bool active; //this is the internal vk state
|
||||||
} render_condition;
|
} render_condition;
|
||||||
|
|
||||||
struct pipe_resource *dummy_vertex_buffer;
|
struct pipe_resource *dummy_vertex_buffer;
|
||||||
|
|
|
@ -882,7 +882,7 @@ zink_set_active_query_state(struct pipe_context *pctx, bool enable)
|
||||||
void
|
void
|
||||||
zink_start_conditional_render(struct zink_context *ctx)
|
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;
|
return;
|
||||||
struct zink_batch *batch = &ctx->batch;
|
struct zink_batch *batch = &ctx->batch;
|
||||||
VkConditionalRenderingFlagsEXT begin_flags = 0;
|
VkConditionalRenderingFlagsEXT begin_flags = 0;
|
||||||
|
@ -894,6 +894,7 @@ zink_start_conditional_render(struct zink_context *ctx)
|
||||||
begin_info.flags = begin_flags;
|
begin_info.flags = begin_flags;
|
||||||
VKCTX(CmdBeginConditionalRenderingEXT)(batch->state->cmdbuf, &begin_info);
|
VKCTX(CmdBeginConditionalRenderingEXT)(batch->state->cmdbuf, &begin_info);
|
||||||
zink_batch_reference_resource_rw(batch, ctx->render_condition.query->predicate, false);
|
zink_batch_reference_resource_rw(batch, ctx->render_condition.query->predicate, false);
|
||||||
|
ctx->render_condition.active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -901,9 +902,10 @@ zink_stop_conditional_render(struct zink_context *ctx)
|
||||||
{
|
{
|
||||||
struct zink_batch *batch = &ctx->batch;
|
struct zink_batch *batch = &ctx->batch;
|
||||||
zink_clear_apply_conditionals(ctx);
|
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;
|
return;
|
||||||
VKCTX(CmdEndConditionalRenderingEXT)(batch->state->cmdbuf);
|
VKCTX(CmdEndConditionalRenderingEXT)(batch->state->cmdbuf);
|
||||||
|
ctx->render_condition.active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -935,8 +937,7 @@ zink_render_condition(struct pipe_context *pctx,
|
||||||
/* force conditional clears if they exist */
|
/* force conditional clears if they exist */
|
||||||
if (ctx->clears_enabled && !ctx->batch.in_rp)
|
if (ctx->clears_enabled && !ctx->batch.in_rp)
|
||||||
zink_batch_rp(ctx);
|
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_active = false;
|
||||||
ctx->render_condition.query = NULL;
|
ctx->render_condition.query = NULL;
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue