From 4dfb89904c0a3d2166e9a3fc0253a254680e91bc Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Wed, 8 Sep 2010 01:31:39 +0200 Subject: glsl: introduce ir_binop_all_equal and ir_binop_any_equal, allow vector cmps Currently GLSL IR forbids any vector comparisons, and defines "ir_binop_equal" and "ir_binop_nequal" to compare all elements and give a single bool. This is highly unintuitive and prevents generation of optimal Mesa IR. Hence, first rename "ir_binop_equal" to "ir_binop_all_equal" and "ir_binop_nequal" to "ir_binop_any_nequal". Second, readd "ir_binop_equal" and "ir_binop_nequal" with the same semantics as less, lequal, etc. Third, allow all comparisons to acts on vectors. Signed-off-by: Ian Romanick --- src/glsl/ir.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/glsl/ir.cpp') diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index b0945431ad..86dc490154 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -210,6 +210,8 @@ ir_expression::get_num_operands(ir_expression_operation op) 2, /* ir_binop_gequal */ 2, /* ir_binop_equal */ 2, /* ir_binop_nequal */ + 2, /* ir_binop_all_equal */ + 2, /* ir_binop_any_nequal */ 2, /* ir_binop_lshift */ 2, /* ir_binop_rshift */ @@ -275,6 +277,8 @@ static const char *const operator_strs[] = { ">=", "==", "!=", + "all_equal", + "any_nequal", "<<", ">>", "&", @@ -293,6 +297,7 @@ static const char *const operator_strs[] = { const char *ir_expression::operator_string(ir_expression_operation op) { assert((unsigned int) op < Elements(operator_strs)); + assert(Elements(operator_strs) == (ir_binop_pow + 1)); return operator_strs[op]; } -- cgit v1.2.3