From: Timothy Arceri Date: Wed, 9 Aug 2017 03:34:07 +0000 (+1000) Subject: glsl: stop cloning builtin fuctions _mesa_glsl_find_builtin_function() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9d41ec21826b1c19da69a183b3c0ce535bfd7b10;p=mesa.git glsl: stop cloning builtin fuctions _mesa_glsl_find_builtin_function() The cloning was introduced in f81ede469910d to fix a problem with shaders including IR that was owned by builtins. However the approach of cloning the whole function each time we reference a builtin lead to a significant reduction in the GLSL IR compilers performance. The previous patch fixes the ownership problem in a more precise way. So we can now remove this cloning. Testing on a Ryzen 7 1800X shows a ~15% decreases in compiling the Deus Ex: Mankind Divided shaders on radeonsi (which take 5min+ on some machines). Looking just at the GLSL IR compiler the speed up is ~40%. Tested-by: Dieter Nützel Reviewed-by: Kenneth Graunke Reviewed-by: Nicolai Hähnle --- diff --git a/src/compiler/glsl/builtin_functions.cpp b/src/compiler/glsl/builtin_functions.cpp index a63f545b791..9df9671f137 100644 --- a/src/compiler/glsl/builtin_functions.cpp +++ b/src/compiler/glsl/builtin_functions.cpp @@ -6291,16 +6291,7 @@ _mesa_glsl_find_builtin_function(_mesa_glsl_parse_state *state, s = builtins.find(state, name, actual_parameters); mtx_unlock(&builtins_lock); - if (s == NULL) - return NULL; - - struct hash_table *ht = - _mesa_hash_table_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal); - void *mem_ctx = state; - ir_function *f = s->function()->clone(mem_ctx, ht); - _mesa_hash_table_destroy(ht, NULL); - - return f->matching_signature(state, actual_parameters, true); + return s; } bool