mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-02 09:30:11 +01:00
zink: fix rp hash table
hash table keys for inserted items have to be valid memory ranges for the
lifetime of the corresponding entry, so using a stack-allocated key like this
is broken and doesn't accurately return the correct renderpass
Fixes a872f46369: ("zink: cache render-passes")
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8011>
This commit is contained in:
parent
ec34b3f117
commit
354b2f7f75
3 changed files with 6 additions and 4 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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 *
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue