#include "util/u_string.h"
#include "util/u_math.h"
#include "util/u_memory.h"
+#include "util/u_math.h"
#include "tgsi_dump.h"
#include "tgsi_info.h"
#include "tgsi_iterate.h"
{
struct tgsi_iterate_context iter;
+ boolean dump_float_as_hex;
+
uint instno;
uint immno;
int indent;
#define SID(I) ctx->dump_printf( ctx, "%d", I )
#define FLT(F) ctx->dump_printf( ctx, "%10.4f", F )
#define DBL(D) ctx->dump_printf( ctx, "%10.8f", D )
+#define HFLT(F) ctx->dump_printf( ctx, "0x%08x", fui((F)) )
#define ENM(E,ENUMS) dump_enum( ctx, E, ENUMS, sizeof( ENUMS ) / sizeof( *ENUMS ) )
const char *
break;
}
case TGSI_IMM_FLOAT32:
- FLT( data[i].Float );
+ if (ctx->dump_float_as_hex)
+ HFLT( data[i].Float );
+ else
+ FLT( data[i].Float );
break;
case TGSI_IMM_UINT32:
UID(data[i].Uint);
ctx.indentation = 0;
ctx.file = file;
+ if (flags & TGSI_DUMP_FLOAT_AS_HEX)
+ ctx.dump_float_as_hex = TRUE;
+ else
+ ctx.dump_float_as_hex = FALSE;
+
tgsi_iterate_shader( tokens, &ctx.iter );
}
ctx.ptr = str;
ctx.left = (int)size;
+ if (flags & TGSI_DUMP_FLOAT_AS_HEX)
+ ctx.base.dump_float_as_hex = TRUE;
+ else
+ ctx.base.dump_float_as_hex = FALSE;
+
tgsi_iterate_shader( tokens, &ctx.base.iter );
}
boolean integral_part = FALSE;
boolean fractional_part = FALSE;
- *val = (float) atof( cur );
+ if (*cur == '0' && *(cur + 1) == 'x') {
+ union fi fi;
+ fi.ui = strtoul(cur, NULL, 16);
+ *val = fi.f;
+ cur += 10;
+ goto out;
+ }
+ *val = (float) atof( cur );
if (*cur == '-' || *cur == '+')
cur++;
if (is_digit( cur )) {
else
return FALSE;
}
+
+out:
*pcur = cur;
return TRUE;
}