zink: more accurately track supported blits
We don't care if blits need to respect render-conditions if there's no
active one. So let's hit the potentially faster native blit-paths
instead.
Fixes: 5743fa6e709 ("zink: enable conditional rendering if available")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3792
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7606>
(cherry picked from commit 19906022e22cb37493861b6976c9623618b5b769)
diff --git a/.pick_status.json b/.pick_status.json
index 06eab24..2509e22 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -220,7 +220,7 @@
"description": "zink: more accurately track supported blits",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": "5743fa6e709a01c5a6820320b2e87931af46e7cf"
},
diff --git a/src/gallium/drivers/zink/zink_blit.c b/src/gallium/drivers/zink/zink_blit.c
index 2a902d2..4bcb43a 100644
--- a/src/gallium/drivers/zink/zink_blit.c
+++ b/src/gallium/drivers/zink/zink_blit.c
@@ -14,8 +14,11 @@
util_format_get_mask(info->src.format) != info->mask ||
util_format_is_depth_or_stencil(info->dst.format) ||
info->scissor_enable ||
- info->alpha_blend ||
- info->render_condition_enable)
+ info->alpha_blend)
+ return false;
+
+ if (info->render_condition_enable &&
+ ctx->render_condition_active)
return false;
struct zink_resource *src = zink_resource(info->src.resource);
@@ -67,8 +70,11 @@
if (util_format_get_mask(info->dst.format) != info->mask ||
util_format_get_mask(info->src.format) != info->mask ||
info->scissor_enable ||
- info->alpha_blend ||
- info->render_condition_enable)
+ info->alpha_blend)
+ return false;
+
+ if (info->render_condition_enable &&
+ ctx->render_condition_active)
return false;
if (util_format_is_depth_or_stencil(info->dst.format) &&
diff --git a/src/gallium/drivers/zink/zink_context.h b/src/gallium/drivers/zink/zink_context.h
index 593c022..d0d0b79 100644
--- a/src/gallium/drivers/zink/zink_context.h
+++ b/src/gallium/drivers/zink/zink_context.h
@@ -130,7 +130,7 @@
struct list_head suspended_queries;
struct list_head primitives_generated_queries;
- bool queries_disabled;
+ bool queries_disabled, render_condition_active;
struct pipe_resource *dummy_buffer;
struct pipe_resource *null_buffers[5]; /* used to create zink_framebuffer->null_surface, one buffer per samplecount */
diff --git a/src/gallium/drivers/zink/zink_query.c b/src/gallium/drivers/zink/zink_query.c
index 4df778e..0d018c0 100644
--- a/src/gallium/drivers/zink/zink_query.c
+++ b/src/gallium/drivers/zink/zink_query.c
@@ -492,6 +492,7 @@
if (query == NULL) {
screen->vk_CmdEndConditionalRenderingEXT(batch->cmdbuf);
+ ctx->render_condition_active = false;
return;
}
@@ -528,6 +529,7 @@
begin_info.buffer = res->buffer;
begin_info.flags = begin_flags;
screen->vk_CmdBeginConditionalRenderingEXT(batch->cmdbuf, &begin_info);
+ ctx->render_condition_active = true;
zink_batch_reference_resource_rw(batch, res, true);