[Mesa-dev] [PATCH 2/3] nir: print 8 and 16 bit constants correctly

Jason Ekstrand jason at jlekstrand.net
Wed Apr 25 12:33:06 UTC 2018


Making the float comment thing work with 16-bit would be cool.  R-b anyway.

On April 25, 2018 05:14:18 Karol Herbst <kherbst at redhat.com> wrote:

> Signed-off-by: Karol Herbst <kherbst at redhat.com>
> ---
> src/compiler/nir/nir_print.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
> index 21f13097651..1c84b4b7076 100644
> --- a/src/compiler/nir/nir_print.c
> +++ b/src/compiler/nir/nir_print.c
> @@ -846,11 +846,21 @@ print_load_const_instr(nir_load_const_instr *instr, 
> print_state *state)
>        * and then print the float in a comment for readability.
>        */
>
> -      if (instr->def.bit_size == 64)
> +      switch (instr->def.bit_size) {
> +      case 64:
>          fprintf(fp, "0x%16" PRIx64 " /* %f */", instr->value.u64[i],
>                  instr->value.f64[i]);
> -      else
> +         break;
> +      case 32:
>          fprintf(fp, "0x%08x /* %f */", instr->value.u32[i], instr->value.f32[i]);
> +         break;
> +      case 16:
> +         fprintf(fp, "0x%04x", instr->value.u16[i]);
> +         break;
> +      case 8:
> +         fprintf(fp, "0x%02x", instr->value.u8[i]);
> +         break;
> +      }
>    }
>
>    fprintf(fp, ")");
> --
> 2.14.3





More information about the mesa-dev mailing list