summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/tgsi/tgsi_text.c
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2014-08-27 09:56:14 +1000
committerDave Airlie <[email protected]>2015-02-20 08:51:49 +1000
commitfa43e0443e206740e219d45abefee65bdb2c3ecb (patch)
tree4cc94bf841c3c2ec4ead63821bb45b77ff61327f /src/gallium/auxiliary/tgsi/tgsi_text.c
parent3cd1338534374c8ed13651548dcbf3949857dbcd (diff)
tgsi: add support for flt64 constants
These act like flt32 except they take up two slots, and you can only add 2 x flt64 constants in one slot. The main reason they are different is we don't want to match half a flt64 constants against a flt32 constant in the matching code, we need to make sure we treat both parts of the flt64 as an single structure. Cleaned up printing/parsing by Ilia Mirkin <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/tgsi/tgsi_text.c')
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_text.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c
index f965b0130e0..5069d13a1db 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_text.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
@@ -232,6 +232,24 @@ static boolean parse_float( const char **pcur, float *val )
return TRUE;
}
+static boolean parse_double( const char **pcur, uint32_t *val0, uint32_t *val1)
+{
+ const char *cur = *pcur;
+ union {
+ double dval;
+ uint32_t uval[2];
+ } v;
+
+ v.dval = strtod(cur, pcur);
+ if (*pcur == cur)
+ return FALSE;
+
+ *val0 = v.uval[0];
+ *val1 = v.uval[1];
+
+ return TRUE;
+}
+
struct translate_ctx
{
const char *text;
@@ -1104,6 +1122,10 @@ static boolean parse_immediate_data(struct translate_ctx *ctx, unsigned type,
}
switch (type) {
+ case TGSI_IMM_FLOAT64:
+ ret = parse_double(&ctx->cur, &values[i].Uint, &values[i+1].Uint);
+ i++;
+ break;
case TGSI_IMM_FLOAT32:
ret = parse_float(&ctx->cur, &values[i].Float);
break;