Mesa (master): glsl: Optimize ir_triop_lrp(x, y, a) with a = 0.0f or 1.0f

Matt Turner mattst88 at kemper.freedesktop.org
Thu Feb 28 23:21:27 UTC 2013


Module: Mesa
Branch: master
Commit: af2c64063e7fb31b243d63b77e09cd19c3819d72
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=af2c64063e7fb31b243d63b77e09cd19c3819d72

Author: Matt Turner <mattst88 at gmail.com>
Date:   Fri Feb 15 17:51:46 2013 -0800

glsl: Optimize ir_triop_lrp(x, y, a) with a = 0.0f or 1.0f

Reviewed-by: Eric Anholt <eric at anholt.net>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/glsl/opt_algebraic.cpp |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp
index 44a21b6..70e016d 100644
--- a/src/glsl/opt_algebraic.cpp
+++ b/src/glsl/opt_algebraic.cpp
@@ -415,6 +415,17 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
 
       break;
 
+   case ir_triop_lrp:
+      /* Operands are (x, y, a). */
+      if (is_vec_zero(op_const[2])) {
+         this->progress = true;
+         return swizzle_if_required(ir, ir->operands[0]);
+      } else if (is_vec_one(op_const[2])) {
+         this->progress = true;
+         return swizzle_if_required(ir, ir->operands[1]);
+      }
+      break;
+
    default:
       break;
    }




More information about the mesa-commit mailing list