[Mesa-dev] [PATCH 15/22] glsl: Add ir_triop_lrp to get_range

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


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

diff --git a/src/glsl/opt_minmax.cpp b/src/glsl/opt_minmax.cpp
index 8d63d96..f066b45 100644
--- a/src/glsl/opt_minmax.cpp
+++ b/src/glsl/opt_minmax.cpp
@@ -457,6 +457,22 @@ get_range(ir_rvalue *rval)
          // Get the range of the addition of op0*op1 and op2
          return resolv_add_range(r0, r1);
 
+      case ir_triop_lrp:
+         r0 = get_range(expr->operands[2]);
+
+         // Get the range of (1-a)
+         r1 = resolv_add_range(get_range(new(mem_ctx) ir_constant(1.0f)),
+               get_range(neg(expr->operands[2])->as_rvalue()));
+
+         // Get the range of (1-a)*y
+         r1 = resolv_mul_range(r1, get_range(expr->operands[2]));
+
+         // Get the range of a*x
+         r0 = resolv_mul_range(r0, get_range(expr->operands[0]));
+
+         // Add the two parts together
+         return resolv_add_range(r0, r1);
+
       default:
          break;
       }
-- 
2.2.1



More information about the mesa-dev mailing list