We can simply call the stored predicate function. In the case where we don't have a _mesa_glsl_parse_state pointer, it doesn't much matter whether we return true or false.
Signed-off-by: Kenneth Graunke <kenn...@whitecape.org> --- src/glsl/ir.cpp | 11 +++++++++++ src/glsl/ir.h | 3 +++ 2 files changed, 14 insertions(+) diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index d9fb808..e9317f8 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -1596,6 +1596,17 @@ ir_function_signature::is_builtin() const } +bool +ir_function_signature::is_builtin_available(const _mesa_glsl_parse_state *state) const +{ + if (state == NULL) + return true; + + assert(builtin_info != NULL); + return builtin_info(state); +} + + static bool modes_match(unsigned a, unsigned b) { diff --git a/src/glsl/ir.h b/src/glsl/ir.h index a927e90..bd1c12c 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -686,6 +686,9 @@ public: /** Whether or not this function signature is a built-in. */ bool is_builtin() const; + /** Whether or not a built-in is available for this shader. */ + bool is_builtin_available(const _mesa_glsl_parse_state *state) const; + /** Body of instructions in the function. */ struct exec_list body; -- 1.8.3.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev