compiler/nir: move tan-calculation to helper

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-By: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4811>
This commit is contained in:
Erik Faye-Lund 2020-03-16 12:57:48 +01:00 committed by Marge Bot
parent 58bb817257
commit aab1361d59
2 changed files with 7 additions and 2 deletions

View File

@ -255,6 +255,12 @@ nir_select(nir_builder *b, nir_ssa_def *x, nir_ssa_def *y, nir_ssa_def *s)
return nir_bcsel(b, nir_ieq(b, s, nir_imm_intN_t(b, 0, s->bit_size)), x, y);
}
static inline nir_ssa_def *
nir_ftan(nir_builder *b, nir_ssa_def *x)
{
return nir_fdiv(b, nir_fsin(b, x), nir_fcos(b, x));
}
static inline nir_ssa_def *
nir_clz_u(nir_builder *b, nir_ssa_def *a)
{

View File

@ -309,8 +309,7 @@ handle_glsl450_alu(struct vtn_builder *b, enum GLSLstd450 entrypoint,
val->ssa->def = nir_degrees(nb, src[0]);
return;
case GLSLstd450Tan:
val->ssa->def = nir_fdiv(nb, nir_fsin(nb, src[0]),
nir_fcos(nb, src[0]));
val->ssa->def = nir_ftan(nb, src[0]);
return;
case GLSLstd450Modf: {