diff options
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/glsl/ast_function.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/compiler/glsl/ast_function.cpp b/src/compiler/glsl/ast_function.cpp index 80cbb582b0e..0ed47660e22 100644 --- a/src/compiler/glsl/ast_function.cpp +++ b/src/compiler/glsl/ast_function.cpp @@ -748,6 +748,21 @@ generate_array_index(void *mem_ctx, exec_list *instructions, } } +static bool +function_exists(_mesa_glsl_parse_state *state, + struct glsl_symbol_table *symbols, const char *name) +{ + ir_function *f = symbols->get_function(name); + if (f != NULL) { + foreach_in_list(ir_function_signature, sig, &f->signatures) { + if (sig->is_builtin() && !sig->is_builtin_available(state)) + continue; + return true; + } + } + return false; +} + static void print_function_prototypes(_mesa_glsl_parse_state *state, YYLTYPE *loc, ir_function *f) @@ -778,9 +793,9 @@ no_matching_function_error(const char *name, { gl_shader *sh = _mesa_glsl_get_builtin_function_shader(); - if (state->symbols->get_function(name) == NULL + if (!function_exists(state, state->symbols, name) && (!state->uses_builtin_functions - || sh->symbols->get_function(name) == NULL)) { + || !function_exists(state, sh->symbols, name))) { _mesa_glsl_error(loc, state, "no function with name '%s'", name); } else { char *str = prototype_string(NULL, name, actual_parameters); |