zink: no-op prim changes for pipeline recalc
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Mon, 14 Jun 2021 18:24:32 +0000 (14:24 -0400)
committerMarge Bot <eric+marge@anholt.net>
Fri, 27 Aug 2021 03:31:25 +0000 (03:31 +0000)
this is no longer part of pipeline hash since we're using dynamic state

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

src/gallium/drivers/zink/zink_pipeline.h
src/gallium/drivers/zink/zink_program.c

index de72882..18784e9 100644 (file)
@@ -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 {
index 3ff2654..748a6b4 100644 (file)
@@ -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;
 }