[Mesa-dev] [PATCH 2/3] glsl: Don't optimize min/max into saturate when EmitNoSat is set

Abdiel Janulgue abdiel.janulgue at linux.intel.com
Mon Dec 8 04:05:11 PST 2014


v3: Fix multi-line comment format (Ian)

Signed-off-by: Abdiel Janulgue <abdiel.janulgue at linux.intel.com>
---
 src/glsl/opt_algebraic.cpp | 2 +-
 src/mesa/main/mtypes.h     | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp
index c4f883b..c6f4a9c 100644
--- a/src/glsl/opt_algebraic.cpp
+++ b/src/glsl/opt_algebraic.cpp
@@ -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
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 7389baa..cee11a3 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -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]? */
 
    /**
-- 
1.9.1



More information about the mesa-dev mailing list