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>
This commit is contained in:
Kenneth Graunke
2011-09-19 18:30:15 -07:00
parent 604173fb1c
commit 0fabf8e8dc
4 changed files with 7 additions and 3 deletions
+2
View File
@@ -52,6 +52,8 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *ctx,
this->error = false;
this->loop_or_switch_nesting = NULL;
this->num_builtins_to_link = 0;
/* Set default language version and extensions */
this->language_version = 110;
this->es_shader = false;