glsl: Defer initialization of built-in functions until they're needed.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 20 Sep 2011 01:30:15 +0000 (18:30 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Sat, 24 Sep 2011 00:12:47 +0000 (17:12 -0700)
commit0fabf8e8dc96a0eb8a9fbbac760d4faceee3af48
treecb54d1bbcc585848df71fd12a6c0ea2151e3dbb9
parent604173fb1c4c7705681e77bbd862b9f953dbc6d4
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 <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/glsl/ast_function.cpp
src/glsl/ast_to_hir.cpp
src/glsl/builtins/tools/generate_builtins.py
src/glsl/glsl_parser_extras.cpp