glsl: Make it possible to ignore built-ins when matching signatures.
Historically, we've implemented the rules for overriding built-in functions by creating multiple ir_functions and relying on the symbol table to hide the one containing built-in functions. That works, but has a few drawbacks, so the next patch will change it. Instead, we'll have a single ir_function for a particular name, which will contain both built-in and user-defined signatures. Passing an extra parameter to matching_signature makes it easy to ignore built-ins when they're supposed to be hidden. I didn't add the parameter to exact_matching_signature since it wasn't necessary. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
@@ -281,15 +281,18 @@ choose_best_inexact_overload(_mesa_glsl_parse_state *state,
|
||||
|
||||
ir_function_signature *
|
||||
ir_function::matching_signature(_mesa_glsl_parse_state *state,
|
||||
const exec_list *actual_parameters)
|
||||
const exec_list *actual_parameters,
|
||||
bool allow_builtins)
|
||||
{
|
||||
bool is_exact;
|
||||
return matching_signature(state, actual_parameters, &is_exact);
|
||||
return matching_signature(state, actual_parameters, allow_builtins,
|
||||
&is_exact);
|
||||
}
|
||||
|
||||
ir_function_signature *
|
||||
ir_function::matching_signature(_mesa_glsl_parse_state *state,
|
||||
const exec_list *actual_parameters,
|
||||
bool allow_builtins,
|
||||
bool *is_exact)
|
||||
{
|
||||
ir_function_signature **inexact_matches = NULL;
|
||||
@@ -308,7 +311,8 @@ ir_function::matching_signature(_mesa_glsl_parse_state *state,
|
||||
*/
|
||||
foreach_in_list(ir_function_signature, sig, &this->signatures) {
|
||||
/* Skip over any built-ins that aren't available in this shader. */
|
||||
if (sig->is_builtin() && !sig->is_builtin_available(state))
|
||||
if (sig->is_builtin() && (!allow_builtins ||
|
||||
!sig->is_builtin_available(state)))
|
||||
continue;
|
||||
|
||||
switch (parameter_lists_match(state, & sig->parameters, actual_parameters)) {
|
||||
|
||||
Reference in New Issue
Block a user