glsl: Refactor handling of horizontal operations
authorIan Romanick <ian.d.romanick@intel.com>
Mon, 18 Jul 2016 18:16:18 +0000 (11:16 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Tue, 30 Aug 2016 23:28:03 +0000 (16:28 -0700)
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Dylan Baker <dylan@pnwbakers.com>
src/compiler/glsl/ir_expression_operation.py

index 8dfcf2c0397be8d000d685415ab6535ef8974dc4..d5a06f864eb429b284fb80e8c37698018b621efb 100644 (file)
@@ -365,22 +365,21 @@ class operation(object):
       if self.c_expression is None:
          return None
 
-      if self.num_operands == 1:
-         if horizontal_operation in self.flags and non_assign_operation in self.flags:
+      if horizontal_operation in self.flags:
+         if non_assign_operation in self.flags:
             return constant_template_horizontal_nonassignment.render(op=self)
-         elif horizontal_operation in self.flags:
+         elif types_identical_operation in self.flags:
+            return constant_template_horizontal_single_implementation.render(op=self)
+         else:
             return constant_template_horizontal.render(op=self)
-      elif self.num_operands == 2:
+
+      if self.num_operands == 2:
          if self.name == "mul":
             return constant_template_mul.render(op=self)
          elif self.name == "vector_extract":
             return constant_template_vector_extract.render(op=self)
          elif vector_scalar_operation in self.flags:
             return constant_template_vector_scalar.render(op=self)
-         elif horizontal_operation in self.flags and types_identical_operation in self.flags:
-            return constant_template_horizontal_single_implementation.render(op=self)
-         elif horizontal_operation in self.flags:
-            return constant_template_horizontal.render(op=self)
       elif self.num_operands == 3:
          if self.name == "vector_insert":
             return constant_template_vector_insert.render(op=self)