diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index f6dc4edc890..7d89a8863f1 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -634,12 +634,13 @@ get_render_pass(struct zink_context *ctx) } state.have_zsbuf = fb->zsbuf != NULL; - struct hash_entry *entry = _mesa_hash_table_search(ctx->render_pass_cache, - &state); + uint32_t hash = hash_render_pass_state(&state); + struct hash_entry *entry = _mesa_hash_table_search_pre_hashed(ctx->render_pass_cache, hash, + &state); if (!entry) { struct zink_render_pass *rp; rp = zink_create_render_pass(screen, &state); - entry = _mesa_hash_table_insert(ctx->render_pass_cache, &state, rp); + entry = _mesa_hash_table_insert_pre_hashed(ctx->render_pass_cache, hash, &rp->state, rp); if (!entry) return NULL; } diff --git a/src/gallium/drivers/zink/zink_render_pass.c b/src/gallium/drivers/zink/zink_render_pass.c index 424fca26a77..d1472a090e3 100644 --- a/src/gallium/drivers/zink/zink_render_pass.c +++ b/src/gallium/drivers/zink/zink_render_pass.c @@ -100,7 +100,7 @@ zink_create_render_pass(struct zink_screen *screen, rp->render_pass = create_render_pass(screen->dev, state); if (!rp->render_pass) goto fail; - + memcpy(&rp->state, state, sizeof(struct zink_render_pass_state)); return rp; fail: diff --git a/src/gallium/drivers/zink/zink_render_pass.h b/src/gallium/drivers/zink/zink_render_pass.h index 2da246ee8f8..2d33612b3ee 100644 --- a/src/gallium/drivers/zink/zink_render_pass.h +++ b/src/gallium/drivers/zink/zink_render_pass.h @@ -46,6 +46,7 @@ struct zink_render_pass { struct pipe_reference reference; VkRenderPass render_pass; + struct zink_render_pass_state state; }; struct zink_render_pass *