diff options
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/ast_function.cpp | 1 | ||||
-rw-r--r-- | src/glsl/ast_to_hir.cpp | 1 | ||||
-rwxr-xr-x | src/glsl/builtins/tools/generate_builtins.py | 6 | ||||
-rw-r--r-- | src/glsl/glsl_parser_extras.cpp | 2 |
4 files changed, 7 insertions, 3 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); diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index ce29d5a87aa..91a2231605d 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -60,7 +60,6 @@ void _mesa_ast_to_hir(exec_list *instructions, struct _mesa_glsl_parse_state *state) { _mesa_glsl_initialize_variables(instructions, state); - _mesa_glsl_initialize_functions(state); state->symbols->language_version = state->language_version; diff --git a/src/glsl/builtins/tools/generate_builtins.py b/src/glsl/builtins/tools/generate_builtins.py index 17d528c2180..8ce2b70c500 100755 --- a/src/glsl/builtins/tools/generate_builtins.py +++ b/src/glsl/builtins/tools/generate_builtins.py @@ -228,12 +228,14 @@ _mesa_read_profile(struct _mesa_glsl_parse_state *state, void _mesa_glsl_initialize_functions(struct _mesa_glsl_parse_state *state) { + /* If we've already initialized the built-ins, bail early. */ + if (state->num_builtins_to_link > 0) + return; + if (builtin_mem_ctx == NULL) { builtin_mem_ctx = ralloc_context(NULL); // "GLSL built-in functions" memset(&builtin_profiles, 0, sizeof(builtin_profiles)); } - - state->num_builtins_to_link = 0; """ i = 0 diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 8faddc578d4..a9075b2b1be 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -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; |