glsl: Don't optimize min/max into saturate when EmitNoSat is set
authorAbdiel Janulgue <abdiel.janulgue@linux.intel.com>
Mon, 8 Dec 2014 11:31:29 +0000 (13:31 +0200)
committerAbdiel Janulgue <abdiel.janulgue@linux.intel.com>
Mon, 8 Dec 2014 18:14:17 +0000 (20:14 +0200)
v3: Fix multi-line comment format (Ian)

Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
src/glsl/opt_algebraic.cpp
src/mesa/main/mtypes.h

index c4f883b9a8efa50e7b3044a6842ee7c98ee78b71..c6f4a9c786df31315a910b9242735634079639f9 100644 (file)
@@ -689,7 +689,7 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
 
    case ir_binop_min:
    case ir_binop_max:
-      if (ir->type->base_type != GLSL_TYPE_FLOAT)
+      if (ir->type->base_type != GLSL_TYPE_FLOAT || options->EmitNoSat)
          break;
 
       /* Replace min(max) operations and its commutative combinations with
index 7389baa1d0255bae17fd09a533a2a16c4f0acf78..cee11a39120a364030010c3c5ff1d2f6c6b45973 100644 (file)
@@ -2990,6 +2990,7 @@ struct gl_shader_compiler_options
    GLboolean EmitNoMainReturn;            /**< Emit CONT/RET opcodes? */
    GLboolean EmitNoNoise;                 /**< Emit NOISE opcodes? */
    GLboolean EmitNoPow;                   /**< Emit POW opcodes? */
+   GLboolean EmitNoSat;                   /**< Emit SAT opcodes? */
    GLboolean LowerClipDistance; /**< Lower gl_ClipDistance from float[8] to vec4[2]? */
 
    /**