diff options
author | Abdiel Janulgue <abdiel.janulgue@linux.intel.com> | 2014-06-12 13:53:40 -0700 |
---|---|---|
committer | Abdiel Janulgue <abdiel.janulgue@linux.intel.com> | 2014-08-31 21:04:08 +0300 |
commit | 4c0ccfc5b39bf69ef90145e5ccf4cea04d9a8a73 (patch) | |
tree | 8f4b750b0a4db6398d7dfa225b84c4cdd763f341 /src/glsl/ir_constant_expression.cpp | |
parent | a5f02b6696c3ce9ed87e017a537a37d09e288702 (diff) | |
download | external_mesa3d-4c0ccfc5b39bf69ef90145e5ccf4cea04d9a8a73.zip external_mesa3d-4c0ccfc5b39bf69ef90145e5ccf4cea04d9a8a73.tar.gz external_mesa3d-4c0ccfc5b39bf69ef90145e5ccf4cea04d9a8a73.tar.bz2 |
glsl: Add constant evaluation of ir_unop_saturate
v2: Use CLAMP macro (Ian Romanick)
Signed-off-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'src/glsl/ir_constant_expression.cpp')
-rw-r--r-- | src/glsl/ir_constant_expression.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 9606021..1e8b3a3 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -1469,6 +1469,12 @@ ir_expression::constant_expression_value(struct hash_table *variable_context) } break; + case ir_unop_saturate: + for (unsigned c = 0; c < components; c++) { + data.f[c] = CLAMP(op[0]->value.f[c], 0.0f, 1.0f); + } + break; + case ir_triop_bitfield_extract: { int offset = op[1]->value.i[0]; int bits = op[2]->value.i[0]; |