summaryrefslogtreecommitdiffstats
path: root/src/glsl/ast_function.cpp
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2011-09-19 18:30:15 -0700
committerKenneth Graunke <[email protected]>2011-09-23 17:12:47 -0700
commit0fabf8e8dc96a0eb8a9fbbac760d4faceee3af48 (patch)
treecb54d1bbcc585848df71fd12a6c0ea2151e3dbb9 /src/glsl/ast_function.cpp
parent604173fb1c4c7705681e77bbd862b9f953dbc6d4 (diff)
glsl: Defer initialization of built-in functions until they're needed.
Very simple shaders don't actually use GLSL built-ins. For example: - gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; - gl_FragColor = vec4(0.0); Both of the shaders used by _mesa_meta_glsl_Clear() also qualify. By waiting to initialize the built-ins until the first time we need to look for a signature, we can avoid the overhead entirely in these cases. Makes piglit run roughly 18% faster (255 vs. 312 seconds). Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/glsl/ast_function.cpp')
-rw-r--r--src/glsl/ast_function.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp
index ca45934a478..fc0d7497d53 100644
--- a/src/glsl/ast_function.cpp
+++ b/src/glsl/ast_function.cpp
@@ -117,6 +117,7 @@ match_function_by_name(exec_list *instructions, const char *name,
/* The current shader doesn't contain a matching function or signature.
* Before giving up, look for the prototype in the built-in functions.
*/
+ _mesa_glsl_initialize_functions(state);
for (unsigned i = 0; i < state->num_builtins_to_link; i++) {
ir_function *builtin;
builtin = state->builtins_to_link[i]->symbols->get_function(name);