On 07/02/2018 08:22 AM, vadym.shovkoplias wrote: > From: Vadym Shovkoplias <vadym.shovkopl...@globallogic.com> > > One of the operands can be NaN and multiplication by zero > should also result to NaN value. E.g: > > float Temp = 0.0; > void main() > { > Temp = log2(Temp); > Temp = Temp * 0.0; > isnan(Temp); > ... > } > > here Temp should be NaN and isnan() should return true.
In GLSL, the NaN or Inf behavior that you seek requires the use of the precise keyword. We go to some lengths to obey this in nir_opt_algebraic. It's possible that some cases in glsl/opt_algebraic. miss it. > Signed-off-by: Vadym Shovkoplias <vadym.shovkopl...@globallogic.com> > --- > src/compiler/glsl/opt_algebraic.cpp | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/src/compiler/glsl/opt_algebraic.cpp > b/src/compiler/glsl/opt_algebraic.cpp > index ff4be26957..2d01575bb3 100644 > --- a/src/compiler/glsl/opt_algebraic.cpp > +++ b/src/compiler/glsl/opt_algebraic.cpp > @@ -590,7 +590,8 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) > if (is_vec_one(op_const[1])) > return ir->operands[0]; > > - if (is_vec_zero(op_const[0]) || is_vec_zero(op_const[1])) > + if ((is_vec_zero(op_const[0]) || is_vec_zero(op_const[1])) && > + !ir->type->is_float() && !ir->type->is_double()) > return ir_constant::zero(ir, ir->type); > > if (is_vec_negative_one(op_const[0])) _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev