glsl: Optimize clamp(x, 0, 1) as saturate(x)
authorAbdiel Janulgue <abdiel.janulgue@linux.intel.com>
Fri, 20 Jun 2014 05:15:14 +0000 (22:15 -0700)
committerAbdiel Janulgue <abdiel.janulgue@linux.intel.com>
Sun, 31 Aug 2014 18:04:08 +0000 (21:04 +0300)
commit8f890b119eaff88a7fad64abbf183cbcc22edc7a
tree58204934be18dc747a22ee575c270cea0d1f52fb
parentcbd0d643a30901dabc5b3cc84121bafe16f8fc6f
glsl: Optimize clamp(x, 0, 1) as saturate(x)

v2: - Check that the base type is float (Ian Romanick)
v3: - Make sure comments reflect that we are doing a commutative operation
    - Add missing condition where the inner constant is 1.0 and outer constant is 0.0
    - Make indexing of operands easier to read (Matt Turner)

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
src/glsl/opt_algebraic.cpp