mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 20:28:04 +02:00
zink: avoid hashing shader stages multiple times for new gfx programs
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12532>
This commit is contained in:
parent
4b5e26e678
commit
e14ecb903b
1 changed files with 5 additions and 3 deletions
|
|
@ -203,13 +203,15 @@ update_gfx_program(struct zink_context *ctx)
|
|||
unsigned bits = u_bit_consecutive(PIPE_SHADER_VERTEX, 5);
|
||||
if (ctx->dirty_shader_stages & bits) {
|
||||
struct zink_gfx_program *prog = NULL;
|
||||
struct hash_entry *entry = _mesa_hash_table_search(&ctx->program_cache[ctx->shader_stages >> 2],
|
||||
ctx->gfx_stages);
|
||||
|
||||
struct hash_table *ht = &ctx->program_cache[ctx->shader_stages >> 2];
|
||||
uint32_t hash = ht->key_hash_function(ctx->gfx_stages);
|
||||
struct hash_entry *entry = _mesa_hash_table_search_pre_hashed(ht, hash, ctx->gfx_stages);
|
||||
if (entry)
|
||||
zink_update_gfx_program(ctx, (struct zink_gfx_program*)entry->data);
|
||||
else {
|
||||
prog = zink_create_gfx_program(ctx, ctx->gfx_stages);
|
||||
entry = _mesa_hash_table_insert(&ctx->program_cache[ctx->shader_stages >> 2], prog->shaders, prog);
|
||||
entry = _mesa_hash_table_insert_pre_hashed(ht, hash, prog->shaders, prog);
|
||||
}
|
||||
prog = (struct zink_gfx_program*)(entry ? entry->data : NULL);
|
||||
if (prog && prog != ctx->curr_program) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue