[Mesa-dev] [PATCH 04/21] glsl: Add a method to tell whether a built-in is available.
Kenneth Graunke
kenneth at whitecape.org
Wed Sep 4 15:22:27 PDT 2013
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 <kenneth at 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
More information about the mesa-dev
mailing list