From 44d9d4d06b50f7f819bd87a1a98933a869949082 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 11 Aug 2025 01:47:37 -0400 Subject: [PATCH] glsl/ir_constant_expression: don't ralloc the hash table Reviewed-by: Gert Wollny Acked-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/compiler/glsl/ir_constant_expression.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/compiler/glsl/ir_constant_expression.cpp b/src/compiler/glsl/ir_constant_expression.cpp index 573b3d75eab..ee4ed849560 100644 --- a/src/compiler/glsl/ir_constant_expression.cpp +++ b/src/compiler/glsl/ir_constant_expression.cpp @@ -1203,7 +1203,8 @@ ir_function_signature::constant_expression_value(linear_ctx *linalloc, * We expect the correctness of the number of parameters to have * been checked earlier. */ - hash_table *deref_hash = _mesa_pointer_hash_table_create(NULL); + hash_table deref_hash; + _mesa_pointer_hash_table_init(&deref_hash, NULL); /* If "origin" is non-NULL, then the function body is there. So we * have to use the variable objects from the object with the body, @@ -1215,13 +1216,13 @@ ir_function_signature::constant_expression_value(linear_ctx *linalloc, ir_constant *constant = n->constant_expression_value(linalloc, variable_context); if (constant == NULL) { - _mesa_hash_table_destroy(deref_hash, NULL); + _mesa_hash_table_fini(&deref_hash, NULL); return NULL; } ir_variable *var = (ir_variable *)parameter_info; - _mesa_hash_table_insert(deref_hash, var, constant); + _mesa_hash_table_insert(&deref_hash, var, constant); parameter_info = parameter_info->next; } @@ -1231,11 +1232,11 @@ ir_function_signature::constant_expression_value(linear_ctx *linalloc, /* Now run the builtin function until something non-constant * happens or we get the result. */ - if (constant_expression_evaluate_expression_list(linalloc, origin ? origin->body : body, deref_hash, &result) && + if (constant_expression_evaluate_expression_list(linalloc, origin ? origin->body : body, &deref_hash, &result) && result) result = result->clone(linalloc, NULL); - _mesa_hash_table_destroy(deref_hash, NULL); + _mesa_hash_table_fini(&deref_hash, NULL); return result; }