diff options
Diffstat (limited to 'mesalib/src/glsl/ast_function.cpp')
-rw-r--r-- | mesalib/src/glsl/ast_function.cpp | 35 |
1 files changed, 7 insertions, 28 deletions
diff --git a/mesalib/src/glsl/ast_function.cpp b/mesalib/src/glsl/ast_function.cpp index 7df2b6925..02aad4f8f 100644 --- a/mesalib/src/glsl/ast_function.cpp +++ b/mesalib/src/glsl/ast_function.cpp @@ -388,7 +388,8 @@ match_function_by_name(const char *name, if (f != NULL) { /* Look for a match in the local shader. If exact, we're done. */ bool is_exact = false; - sig = local_sig = f->matching_signature(actual_parameters, &is_exact); + sig = local_sig = f->matching_signature(state, actual_parameters, + &is_exact); if (is_exact) goto done; @@ -402,33 +403,8 @@ match_function_by_name(const char *name, } /* Local shader has no exact candidates; check the built-ins. */ - _mesa_glsl_initialize_functions(state); - for (unsigned i = 0; i < state->num_builtins_to_link; i++) { - ir_function *builtin = - state->builtins_to_link[i]->symbols->get_function(name); - if (builtin == NULL) - continue; - - bool is_exact = false; - ir_function_signature *builtin_sig = - builtin->matching_signature(actual_parameters, &is_exact); - - if (builtin_sig == NULL) - continue; - - /* If the built-in signature is exact, we can stop. */ - if (is_exact) { - sig = builtin_sig; - goto done; - } - - if (sig == NULL) { - /* We found an inexact match, which is better than nothing. However, - * we should keep searching for an exact match. - */ - sig = builtin_sig; - } - } + _mesa_glsl_initialize_builtin_functions(); + sig = _mesa_glsl_find_builtin_function(state, name, actual_parameters); done: if (sig != NULL) { @@ -471,6 +447,9 @@ no_matching_function_error(const char *name, foreach_list (node, &f->signatures) { ir_function_signature *sig = (ir_function_signature *) node; + if (sig->is_builtin() && !sig->is_builtin_available(state)) + continue; + str = prototype_string(sig->return_type, f->name, &sig->parameters); _mesa_glsl_error(loc, state, "%s%s", prefix, str); ralloc_free(str); |