diff options
author | Kenneth Graunke <[email protected]> | 2013-11-23 12:06:24 -0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2013-12-01 15:33:00 -0800 |
commit | 5af97b43c962c57aceb9c40d3c9050745d124892 (patch) | |
tree | 37bbbd6dd6b0d33d456ea1469dc26fcb07a2c631 /src | |
parent | e04a97ff23f6e0568c3c21cec8849c6c3fd2077f (diff) |
glsl: Drop crazy looping from no_matching_function_error().
Since the built-in functions rewrite, num_builtins_to_link is always either
0 or 1, so we don't need tho crazy loop starting at -1 with a special
case.
All we need to do is print the prototypes from the current shader, and
the single built-in function shader (if present).
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/glsl/ast_function.cpp | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 6def25a7d2e..36bb26086fd 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -421,6 +421,25 @@ done: return sig; } +static void +print_function_prototypes(_mesa_glsl_parse_state *state, YYLTYPE *loc, + ir_function *f) +{ + if (f == NULL) + return; + + foreach_list (node, &f->signatures) { + ir_function_signature *sig = (ir_function_signature *) node; + + if (sig->is_builtin() && !sig->is_builtin_available(state)) + continue; + + char *str = prototype_string(sig->return_type, f->name, &sig->parameters); + _mesa_glsl_error(loc, state, " %s", str); + ralloc_free(str); + } +} + /** * Raise a "no matching function" error, listing all possible overloads the * compiler considered so developers can figure out what went wrong. @@ -437,23 +456,11 @@ no_matching_function_error(const char *name, str); ralloc_free(str); - for (int i = -1; i < (int) state->num_builtins_to_link; i++) { - glsl_symbol_table *syms = i >= 0 ? state->builtins_to_link[i]->symbols - : state->symbols; - ir_function *f = syms->get_function(name); - if (f == NULL) - continue; + print_function_prototypes(state, loc, state->symbols->get_function(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", str); - ralloc_free(str); - } + if (state->num_builtins_to_link) { + gl_shader *sh = state->builtins_to_link[0]; + print_function_prototypes(state, loc, sh->symbols->get_function(name)); } } |