Re: [Mesa-dev] [PATCH 02/14] glsl: Add constant evaluation of ir_unop_saturate
On 06/23/2014 10:27 PM, Abdiel Janulgue wrote: > Signed-off-by: Abdiel Janulgue > --- > 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 8afe8f7..b885a2f 100644 > --- a/src/glsl/ir_constant_expression.cpp > +++ b/src/glsl/ir_constant_expression.cpp > @@ -1464,6 +1464,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] = MIN2(MAX2(op[0]->value.f[c], 0.0f), 1.0f); There's a CLAMP macro in src/mesa/main/macros.h. > + } > + break; > + > case ir_triop_bitfield_extract: { >int offset = op[1]->value.i[0]; >int bits = op[2]->value.i[0]; > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 02/14] glsl: Add constant evaluation of ir_unop_saturate
Signed-off-by: Abdiel Janulgue --- 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 8afe8f7..b885a2f 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -1464,6 +1464,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] = MIN2(MAX2(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 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev