freedreno: Reuse u_math.h instead of open coding uif().
Plus the old version had a comment with what conversion was being done swapped! Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6360>
This commit is contained in:
parent
db95dfe252
commit
7438ea55c4
|
@ -101,7 +101,7 @@ struct state {
|
|||
#define F(s, field) \
|
||||
do { \
|
||||
OFF(s->field); \
|
||||
printf("%s%12s:\t%f (0x%0x)\n", tab(state->lvl), #field, d2f(s->field), \
|
||||
printf("%s%12s:\t%f (0x%0x)\n", tab(state->lvl), #field, uif(s->field), \
|
||||
s->field); \
|
||||
} while (0)
|
||||
|
||||
|
@ -161,7 +161,7 @@ dump_unknown(struct state *state, void *buf, unsigned start, unsigned n)
|
|||
uint8_t c = *(ascii++);
|
||||
printf("%c", (isascii(c) && !iscntrl(c)) ? c : '.');
|
||||
}
|
||||
printf("|\t%f", d2f(d));
|
||||
printf("|\t%f", uif(d));
|
||||
|
||||
/* TODO maybe scan for first non-null and non-ascii char starting from
|
||||
* end of shader binary to (roughly) establish the start of the string
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "util/u_math.h"
|
||||
|
||||
/* old-style program binary XOR'd ascii w/ 0xff */
|
||||
#ifndef ASCII_XOR
|
||||
#define ASCII_XOR 0
|
||||
|
@ -40,19 +42,6 @@ tab(int lvl)
|
|||
return &TAB[strlen(TAB) - lvl];
|
||||
}
|
||||
|
||||
/* convert float to dword */
|
||||
static inline float
|
||||
d2f(uint32_t d)
|
||||
{
|
||||
union {
|
||||
float f;
|
||||
uint32_t d;
|
||||
} u = {
|
||||
.d = d,
|
||||
};
|
||||
return u.f;
|
||||
}
|
||||
|
||||
static inline void
|
||||
dump_hex(const void *buf, int sz)
|
||||
{
|
||||
|
@ -101,7 +90,7 @@ dump_float(const void *buf, int sz)
|
|||
d |= *(ptr++) << 16;
|
||||
d |= (uint32_t)*(ptr++) << 24;
|
||||
|
||||
printf("%8f", d2f(d));
|
||||
printf("%8f", uif(d));
|
||||
|
||||
if ((i % 8) == 7) {
|
||||
printf("\n");
|
||||
|
|
Loading…
Reference in New Issue