SQRT is not supported everywhere, so replace
it by RSQ + MUL and handle case <= 0.
Signed-off-by: Axel Davy <axel.davy@ens.fr>
struct ureg_src cPsz2 = ureg_DECL_constant(ureg, 27);
ureg_DP3(ureg, tmp_x, ureg_src(r[1]), ureg_src(r[1]));
struct ureg_src cPsz2 = ureg_DECL_constant(ureg, 27);
ureg_DP3(ureg, tmp_x, ureg_src(r[1]), ureg_src(r[1]));
- ureg_SQRT(ureg, tmp_y, _X(tmp));
+ ureg_RSQ(ureg, tmp_y, _X(tmp));
+ ureg_MUL(ureg, tmp_y, _Y(tmp), _X(tmp));
+ ureg_CMP(ureg, tmp_y, ureg_negate(_Y(tmp)), _Y(tmp), ureg_imm1f(ureg, 0.0f));
ureg_MAD(ureg, tmp_x, _Y(tmp), _YYYY(cPsz2), _XXXX(cPsz2));
ureg_MAD(ureg, tmp_x, _Y(tmp), _X(tmp), _WWWW(cPsz1));
ureg_RCP(ureg, tmp_x, ureg_src(tmp));
ureg_MAD(ureg, tmp_x, _Y(tmp), _YYYY(cPsz2), _XXXX(cPsz2));
ureg_MAD(ureg, tmp_x, _Y(tmp), _X(tmp), _WWWW(cPsz1));
ureg_RCP(ureg, tmp_x, ureg_src(tmp));