[Mesa-dev] [PATCH 06/22] compiler/nir: support 16-bit float in nir_imm_floatN_t
Jason Ekstrand
jason at jlekstrand.net
Thu May 17 14:01:51 UTC 2018
Why did the function move?
On May 17, 2018 01:47:51 Iago Toral Quiroga <itoral at igalia.com> wrote:
> ---
> src/compiler/nir/nir_builder.h | 29 ++++++++++++++++-------------
> 1 file changed, 16 insertions(+), 13 deletions(-)
>
> diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h
> index 02a9dbfb040..198c42dd823 100644
> --- a/src/compiler/nir/nir_builder.h
> +++ b/src/compiler/nir/nir_builder.h
> @@ -25,6 +25,7 @@
> #define NIR_BUILDER_H
>
> #include "nir_control_flow.h"
> +#include "util/half_float.h"
>
> struct exec_list;
>
> @@ -227,19 +228,6 @@ nir_imm_double(nir_builder *build, double x)
> return nir_build_imm(build, 1, 64, v);
> }
>
> -static inline nir_ssa_def *
> -nir_imm_floatN_t(nir_builder *build, double x, unsigned bit_size)
> -{
> - switch (bit_size) {
> - case 32:
> - return nir_imm_float(build, x);
> - case 64:
> - return nir_imm_double(build, x);
> - }
> -
> - unreachable("unknown float immediate bit size");
> -}
> -
> static inline nir_ssa_def *
> nir_imm_vec4(nir_builder *build, float x, float y, float z, float w)
> {
> @@ -288,6 +276,21 @@ nir_imm_intN_t(nir_builder *build, uint64_t x,
> unsigned bit_size)
> return nir_build_imm(build, 1, bit_size, v);
> }
>
> +static inline nir_ssa_def *
> +nir_imm_floatN_t(nir_builder *build, double x, unsigned bit_size)
> +{
> + switch (bit_size) {
> + case 16:
> + return nir_imm_intN_t(build, _mesa_float_to_half((float)x), 16);
> + case 32:
> + return nir_imm_float(build, x);
> + case 64:
> + return nir_imm_double(build, x);
> + }
> +
> + unreachable("unknown float immediate bit size");
> +}
> +
> static inline nir_ssa_def *
> nir_imm_ivec4(nir_builder *build, int x, int y, int z, int w)
> {
> --
> 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