glsl: Store a predicate for whether a built-in signature is available.
For the upcoming built-in function rewrite, we'll need to be able to answer "Is this built-in function signature available?". This is actually a somewhat complex question, since it depends on the language version, GLSL vs. GLSL ES, enabled extensions, and the current shader stage. Storing such a set of constraints in a structure would be painful, so instead we store a function pointer. When creating a signature, we simply point to a predicate that inspects _mesa_glsl_parse_state and answers whether the signature is available in the current shader. Unfortunately, IR reader doesn't actually know when built-in functions are available, so this patch makes it lie and say that they're always present. This allows us to hook up the new functionality; it just won't be useful until real data is populated. In the meantime, the existing profile mechanism ensures built-ins are available in the right places. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Paul Berry <stereotype441@gmail.com>
This commit is contained in:
@@ -1579,11 +1579,13 @@ ir_variable::determine_interpolation_mode(bool flat_shade)
|
||||
}
|
||||
|
||||
|
||||
ir_function_signature::ir_function_signature(const glsl_type *return_type)
|
||||
: return_type(return_type), is_defined(false), _function(NULL)
|
||||
ir_function_signature::ir_function_signature(const glsl_type *return_type,
|
||||
builtin_available_predicate b)
|
||||
: return_type(return_type), is_defined(false), builtin_info(b),
|
||||
_function(NULL)
|
||||
{
|
||||
this->ir_type = ir_type_function_signature;
|
||||
this->is_builtin = false;
|
||||
this->is_builtin = builtin_info != NULL;
|
||||
this->origin = NULL;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user