diff --git a/src/gallium/drivers/zink/zink_pipeline.h b/src/gallium/drivers/zink/zink_pipeline.h index 8105da901a1..c686a6a1175 100644 --- a/src/gallium/drivers/zink/zink_pipeline.h +++ b/src/gallium/drivers/zink/zink_pipeline.h @@ -74,6 +74,9 @@ struct zink_gfx_pipeline_state { uint32_t vertex_buffers_enabled_mask; uint32_t vertex_strides[PIPE_MAX_ATTRIBS]; bool have_EXT_extended_dynamic_state; + + VkPipeline pipeline; + enum pipe_prim_type mode; }; struct zink_compute_pipeline_state { @@ -83,6 +86,8 @@ struct zink_compute_pipeline_state { bool dirty; bool use_local_size; uint32_t local_size[3]; + + VkPipeline pipeline; }; VkPipeline diff --git a/src/gallium/drivers/zink/zink_program.c b/src/gallium/drivers/zink/zink_program.c index b5368edab83..98b3d936ded 100644 --- a/src/gallium/drivers/zink/zink_program.c +++ b/src/gallium/drivers/zink/zink_program.c @@ -884,6 +884,9 @@ zink_get_gfx_pipeline(struct zink_context *ctx, struct zink_gfx_pipeline_state *state, enum pipe_prim_type mode) { + if (!state->dirty && !state->combined_dirty && !state->vertex_state_dirty && mode == state->mode) + return state->pipeline; + struct zink_screen *screen = zink_screen(ctx->base.screen); VkPrimitiveTopology vkmode = primitive_topology(mode); assert(vkmode <= ARRAY_SIZE(prog->pipelines)); @@ -935,7 +938,10 @@ zink_get_gfx_pipeline(struct zink_context *ctx, assert(entry); } - return ((struct gfx_pipeline_cache_entry *)(entry->data))->pipeline; + struct gfx_pipeline_cache_entry *cache_entry = entry->data; + state->pipeline = cache_entry->pipeline; + state->mode = mode; + return state->pipeline; } VkPipeline @@ -945,6 +951,8 @@ zink_get_compute_pipeline(struct zink_screen *screen, { struct hash_entry *entry = NULL; + if (!state->dirty) + return state->pipeline; if (state->dirty) { state->hash = hash_compute_pipeline_state(state); state->dirty = false; @@ -968,7 +976,9 @@ zink_get_compute_pipeline(struct zink_screen *screen, assert(entry); } - return ((struct compute_pipeline_cache_entry *)(entry->data))->pipeline; + struct compute_pipeline_cache_entry *cache_entry = entry->data; + state->pipeline = cache_entry->pipeline; + return state->pipeline; }