[Mesa-dev] [v2 PATCH 02/16] glsl: Add constant evaluation of ir_unop_saturate
Abdiel Janulgue
abdiel.janulgue at linux.intel.com
Mon Jul 7 06:56:59 PDT 2014
v2: Use CLAMP macro (Ian Romanick)
Signed-off-by: Abdiel Janulgue <abdiel.janulgue at linux.intel.com>
---
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 7f83eb1..6813180 100644
--- a/src/glsl/ir_constant_expression.cpp
+++ b/src/glsl/ir_constant_expression.cpp
@@ -1463,6 +1463,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];
--
1.9.1
More information about the mesa-dev
mailing list