From 4c0ccfc5b39bf69ef90145e5ccf4cea04d9a8a73 Mon Sep 17 00:00:00 2001 From: Abdiel Janulgue Date: Thu, 12 Jun 2014 13:53:40 -0700 Subject: glsl: Add constant evaluation of ir_unop_saturate v2: Use CLAMP macro (Ian Romanick) Signed-off-by: Abdiel Janulgue Reviewed-by: Matt Turner Reviewed-by: Ian Romanick --- src/glsl/ir_constant_expression.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 96060217c97..1e8b3a3cced 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]; -- cgit v1.2.3