Mesa (main): zink: avoid unnecessarily rewriting gl_DrawID

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jul 1 22:41:34 UTC 2021


Module: Mesa
Branch: main
Commit: 2d32d123e5624e631fa1eda02da647d0065b7ae8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2d32d123e5624e631fa1eda02da647d0065b7ae8

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Fri Jan 29 17:12:44 2021 -0500

zink: avoid unnecessarily rewriting gl_DrawID

with tc enabled, we get genuine multidraws with valid drawids, so we can
update this to reflect the new capabilities...which are the same as the old
ones except that potentially some drivers can now do direct multidraws

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11662>

---

 src/gallium/drivers/zink/zink_draw.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_draw.c b/src/gallium/drivers/zink/zink_draw.c
index 85ae99df517..4cd9502f8a5 100644
--- a/src/gallium/drivers/zink/zink_draw.c
+++ b/src/gallium/drivers/zink/zink_draw.c
@@ -417,8 +417,11 @@ zink_draw_vbo(struct pipe_context *pctx,
    if (ctx->gfx_pipeline_state.vertices_per_patch != dinfo->vertices_per_patch)
       ctx->gfx_pipeline_state.dirty = true;
    bool drawid_broken = ctx->drawid_broken;
-   ctx->drawid_broken = BITSET_TEST(ctx->gfx_stages[PIPE_SHADER_VERTEX]->nir->info.system_values_read, SYSTEM_VALUE_DRAW_ID) &&
-                        (!dindirect || !dindirect->buffer);
+   ctx->drawid_broken = false;
+   if (!dindirect || !dindirect->buffer)
+      ctx->drawid_broken = BITSET_TEST(ctx->gfx_stages[PIPE_SHADER_VERTEX]->nir->info.system_values_read, SYSTEM_VALUE_DRAW_ID) &&
+                           (drawid_offset != 0 ||
+                           ((!ctx->tc || !screen->info.have_EXT_multi_draw) && num_draws > 1));
    if (drawid_broken != ctx->drawid_broken)
       ctx->dirty_shader_stages |= BITFIELD_BIT(PIPE_SHADER_VERTEX);
    ctx->gfx_pipeline_state.vertices_per_patch = dinfo->vertices_per_patch;



More information about the mesa-commit mailing list