Mesa (main): zink: no-op prim changes for pipeline recalc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Aug 27 03:51:13 UTC 2021


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Mon Jun 14 14:24:32 2021 -0400

zink: no-op prim changes for pipeline recalc

this is no longer part of pipeline hash since we're using dynamic state

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

---

 src/gallium/drivers/zink/zink_pipeline.h |  3 +--
 src/gallium/drivers/zink/zink_program.c  | 12 +++++++-----
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_pipeline.h b/src/gallium/drivers/zink/zink_pipeline.h
index de72882d3e5..18784e9e9dc 100644
--- a/src/gallium/drivers/zink/zink_pipeline.h
+++ b/src/gallium/drivers/zink/zink_pipeline.h
@@ -77,9 +77,8 @@ struct zink_gfx_pipeline_state {
    bool have_EXT_extended_dynamic_state;
 
    VkPipeline pipeline;
-   enum pipe_prim_type mode : 8;
-
    uint8_t patch_vertices;
+   unsigned idx : 8;
 };
 
 struct zink_compute_pipeline_state {
diff --git a/src/gallium/drivers/zink/zink_program.c b/src/gallium/drivers/zink/zink_program.c
index 3ff26544f95..748a6b419d3 100644
--- a/src/gallium/drivers/zink/zink_program.c
+++ b/src/gallium/drivers/zink/zink_program.c
@@ -764,13 +764,15 @@ zink_get_gfx_pipeline(struct zink_context *ctx,
 {
    struct zink_screen *screen = zink_screen(ctx->base.screen);
    const bool have_EXT_vertex_input_dynamic_state = screen->info.have_EXT_vertex_input_dynamic_state;
-   if (!state->dirty && !state->combined_dirty && mode == state->mode &&
-       (have_EXT_vertex_input_dynamic_state || !ctx->vertex_state_changed))
-      return state->pipeline;
+   const bool have_EXT_extended_dynamic_state = screen->info.have_EXT_extended_dynamic_state;
 
    VkPrimitiveTopology vkmode = zink_primitive_topology(mode);
    const unsigned idx = get_pipeline_idx(screen->info.have_EXT_extended_dynamic_state, mode, vkmode);
    assert(idx <= ARRAY_SIZE(prog->pipelines));
+   if (!state->dirty && !state->combined_dirty &&
+       (have_EXT_vertex_input_dynamic_state || !ctx->vertex_state_changed) &&
+       idx == state->idx)
+      return state->pipeline;
 
    struct hash_entry *entry = NULL;
 
@@ -792,7 +794,7 @@ zink_get_gfx_pipeline(struct zink_context *ctx,
    else
       if (ctx->vertex_state_changed) {
          uint32_t hash = state->combined_hash;
-         if (!state->have_EXT_extended_dynamic_state) {
+         if (!have_EXT_extended_dynamic_state) {
             /* if we don't have dynamic states, we have to hash the enabled vertex buffer bindings */
             uint32_t vertex_buffers_enabled_mask = state->vertex_buffers_enabled_mask;
             hash = XXH32(&vertex_buffers_enabled_mask, sizeof(uint32_t), hash);
@@ -828,7 +830,7 @@ zink_get_gfx_pipeline(struct zink_context *ctx,
 
    struct gfx_pipeline_cache_entry *cache_entry = entry->data;
    state->pipeline = cache_entry->pipeline;
-   state->mode = mode;
+   state->idx = idx;
    return state->pipeline;
 }
 



More information about the mesa-commit mailing list