summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/glsl/ir.cpp10
-rw-r--r--src/glsl/ir.h6
2 files changed, 13 insertions, 3 deletions
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index 96b32a2f34..6d72725374 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -287,11 +287,15 @@ static const char *const operator_strs[] = {
"pow",
};
+const char *ir_expression::operator_string(ir_expression_operation op)
+{
+ assert((unsigned int) op < Elements(operator_strs));
+ return operator_strs[op];
+}
+
const char *ir_expression::operator_string()
{
- assert((unsigned int) operation <=
- sizeof(operator_strs) / sizeof(operator_strs[0]));
- return operator_strs[operation];
+ return operator_string(this->operation);
}
ir_expression_operation
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index cf3a882f07..efe59d8064 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -731,6 +731,12 @@ public:
const char *operator_string();
/**
+ * Return a string representing this expression's operator.
+ */
+ static const char *operator_string(ir_expression_operation);
+
+
+ /**
* Do a reverse-lookup to translate the given string into an operator.
*/
static ir_expression_operation get_operator(const char *);