return val;
}
-/**
- * Return e^x.
- */
-static nir_ssa_def *
-build_exp(nir_builder *b, nir_ssa_def *x)
-{
- return nir_fexp2(b, nir_fmul_imm(b, x, M_LOG2E));
-}
-
/**
* Return ln(x) - the natural logarithm of x.
*/
return;
case GLSLstd450Exp:
- val->ssa->def = build_exp(nb, src[0]);
+ val->ssa->def = nir_fexp(nb, src[0]);
return;
case GLSLstd450Log:
case GLSLstd450Sinh:
/* 0.5 * (e^x - e^(-x)) */
val->ssa->def =
- nir_fmul_imm(nb, nir_fsub(nb, build_exp(nb, src[0]),
- build_exp(nb, nir_fneg(nb, src[0]))),
+ nir_fmul_imm(nb, nir_fsub(nb, nir_fexp(nb, src[0]),
+ nir_fexp(nb, nir_fneg(nb, src[0]))),
0.5f);
return;
case GLSLstd450Cosh:
/* 0.5 * (e^x + e^(-x)) */
val->ssa->def =
- nir_fmul_imm(nb, nir_fadd(nb, build_exp(nb, src[0]),
- build_exp(nb, nir_fneg(nb, src[0]))),
+ nir_fmul_imm(nb, nir_fadd(nb, nir_fexp(nb, src[0]),
+ nir_fexp(nb, nir_fneg(nb, src[0]))),
0.5f);
return;
nir_imm_floatN_t(nb, -clamped_x, bit_size),
nir_imm_floatN_t(nb, clamped_x, bit_size));
val->ssa->def =
- nir_fdiv(nb, nir_fsub(nb, build_exp(nb, x),
- build_exp(nb, nir_fneg(nb, x))),
- nir_fadd(nb, build_exp(nb, x),
- build_exp(nb, nir_fneg(nb, x))));
+ nir_fdiv(nb, nir_fsub(nb, nir_fexp(nb, x),
+ nir_fexp(nb, nir_fneg(nb, x))),
+ nir_fadd(nb, nir_fexp(nb, x),
+ nir_fexp(nb, nir_fneg(nb, x))));
return;
}