[Mesa-dev] [PATCH 05/51] nir: Print 16-bit constants

Topi Pohjolainen topi.pohjolainen at gmail.com
Fri Nov 24 12:26:32 UTC 2017


Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
 src/compiler/nir/nir_print.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
index fcc8025346..9ed23a74bb 100644
--- a/src/compiler/nir/nir_print.c
+++ b/src/compiler/nir/nir_print.c
@@ -27,6 +27,7 @@
 
 #include "nir.h"
 #include "compiler/shader_enums.h"
+#include "util/half_float.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <inttypes.h> /* for PRIx64 macro */
@@ -842,6 +843,10 @@ print_load_const_instr(nir_load_const_instr *instr, print_state *state)
       if (instr->def.bit_size == 64)
          fprintf(fp, "0x%16" PRIx64 " /* %f */", instr->value.u64[i],
                  instr->value.f64[i]);
+      else if (instr->def.bit_size == 16)
+         fprintf(fp, "0x%04x /* %f */",
+                 instr->value.u16[i],
+                 _mesa_half_to_float(instr->value.u16[i]));
       else
          fprintf(fp, "0x%08x /* %f */", instr->value.u32[i], instr->value.f32[i]);
    }
-- 
2.11.0



More information about the mesa-dev mailing list