summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_print.c
diff options
context:
space:
mode:
authorKarol Herbst <[email protected]>2018-04-22 01:31:22 +0200
committerKarol Herbst <[email protected]>2018-04-26 11:16:15 +0200
commit14943add4440e9e79f93e039b788d287eeec2463 (patch)
treec114876a7e5cdd66dbbce9b0127d6ada63e1d859 /src/compiler/nir/nir_print.c
parent543a8c66a70cf8e154d2162685e15dfa413b0bde (diff)
nir: print 8 and 16 bit constants correctly
Signed-off-by: Karol Herbst <[email protected]> Reviewed-by: Rob Clark <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_print.c')
-rw-r--r--src/compiler/nir/nir_print.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
index 21f13097651..97b2d6164cd 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 */
@@ -846,11 +847,22 @@ 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 /* %f */", instr->value.u16[i],
+ _mesa_half_to_float(instr->value.u16[i]));
+ break;
+ case 8:
+ fprintf(fp, "0x%02x", instr->value.u8[i]);
+ break;
+ }
}
fprintf(fp, ")");