util/u_printf: support printing fp16 values
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34053>
This commit is contained in:
+7
-1
@@ -36,6 +36,8 @@
|
||||
#include "u_math.h"
|
||||
#include "u_printf.h"
|
||||
|
||||
#include "util/half_float.h"
|
||||
|
||||
#define XXH_INLINE_ALL
|
||||
#include "util/xxhash.h"
|
||||
|
||||
@@ -241,7 +243,11 @@ u_printf_impl(FILE *out, const char *buffer, size_t buffer_size,
|
||||
case 2: {
|
||||
uint16_t v;
|
||||
memcpy(&v, &buffer[elmt_buf_pos], elmt_size);
|
||||
fprintf(out, print_str, v);
|
||||
if (is_float) {
|
||||
fprintf(out, print_str, _mesa_half_to_float(v));
|
||||
} else {
|
||||
fprintf(out, print_str, v);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
|
||||
Reference in New Issue
Block a user