[Mesa-dev] [PATCH 07/22] compiler/spirv: handle 16-bit float in radians() and degrees()

Jason Ekstrand jason at jlekstrand.net
Thu May 17 14:02:49 UTC 2018


Rb

On May 17, 2018 01:48:03 Iago Toral Quiroga <itoral at igalia.com> wrote:

> ---
> src/compiler/spirv/vtn_glsl450.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/src/compiler/spirv/vtn_glsl450.c 
> b/src/compiler/spirv/vtn_glsl450.c
> index 6fa759b1bba..ffe12a71818 100644
> --- a/src/compiler/spirv/vtn_glsl450.c
> +++ b/src/compiler/spirv/vtn_glsl450.c
> @@ -540,11 +540,17 @@ handle_glsl450_alu(struct vtn_builder *b, enum 
> GLSLstd450 entrypoint,
>
>    switch (entrypoint) {
>    case GLSLstd450Radians:
> -      val->ssa->def = nir_fmul(nb, src[0], nir_imm_float(nb, 0.01745329251));
> +      val->ssa->def = nir_fmul(nb, src[0],
> +                               nir_imm_floatN_t(nb, 0.01745329251,
> +                                                src[0]->bit_size));
>       return;
> +
>    case GLSLstd450Degrees:
> -      val->ssa->def = nir_fmul(nb, src[0], nir_imm_float(nb, 57.2957795131));
> +      val->ssa->def = nir_fmul(nb, src[0],
> +                               nir_imm_floatN_t(nb, 57.2957795131,
> +                                                src[0]->bit_size));
>       return;
> +
>    case GLSLstd450Tan:
>       val->ssa->def = nir_fdiv(nb, nir_fsin(nb, src[0]),
>                                nir_fcos(nb, src[0]));
> --
> 2.14.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev





More information about the mesa-dev mailing list