[Mesa-dev] [PATCH 6/6] glsl: Add abs/sqrt/exp to get_range

Thomas Helland thomashelland90 at gmail.com
Wed Oct 29 18:11:21 PDT 2014


All of these are guaranteed to be larger than 0

Signed-off-by: Thomas Helland <thomashelland90 at gmail.com>
---
 src/glsl/opt_minmax.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/glsl/opt_minmax.cpp b/src/glsl/opt_minmax.cpp
index 4088c80..e768857 100644
--- a/src/glsl/opt_minmax.cpp
+++ b/src/glsl/opt_minmax.cpp
@@ -307,6 +307,14 @@ get_range(ir_rvalue *rval)
             high = r0.high;
          return minmax_range(low, high);
 
+      case ir_unop_abs:
+      case ir_unop_sqrt:
+      case ir_unop_rsq:
+      case ir_unop_exp:
+      case ir_unop_exp2:
+         low = new(mem_ctx) ir_constant(0.0f);
+         return minmax_range(low, NULL);
+
       default:
          break;
       }
-- 
2.0.3



More information about the mesa-dev mailing list