[Mesa-dev] [PATCH 16/22] glsl: Add ir_binop_dot to get_range

Thomas Helland thomashelland90 at gmail.com
Sat Jan 3 11:18:21 PST 2015


---
 src/glsl/opt_minmax.cpp | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/src/glsl/opt_minmax.cpp b/src/glsl/opt_minmax.cpp
index f066b45..5515f51 100644
--- a/src/glsl/opt_minmax.cpp
+++ b/src/glsl/opt_minmax.cpp
@@ -411,6 +411,30 @@ get_range(ir_rvalue *rval)
          r1 = get_range(expr->operands[1]);
          return resolv_add_range(r0, r1);
 
+      case ir_binop_dot: {
+         r0 = get_range(expr->operands[0]);
+         r1 = get_range(expr->operands[1]);
+
+         r0 = resolv_mul_range(r0, r1);
+         float sum = 0.0f;
+
+         if (r0.low) {
+            for (unsigned i = 0; i < r0.low->type->components(); i++)
+               sum += r0.low->get_float_component(i);
+            low = new(mem_ctx) ir_constant(sum);
+         }
+
+         sum = 0.0f;
+
+         if (r0.high) {
+            for (unsigned i = 0; i < r0.high->type->components(); i++)
+               sum += r0.high->get_float_component(i);
+            high = new(mem_ctx) ir_constant(sum);
+         }
+
+         return minmax_range(low, high);
+      }
+
       case ir_binop_min:
       case ir_binop_max:
          r0 = get_range(expr->operands[0]);
-- 
2.2.1



More information about the mesa-dev mailing list