summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2013-06-16 21:24:00 +1000
committerDave Airlie <[email protected]>2013-06-18 08:25:12 +1000
commit9e8400f4c95bde1f955c7977066583b507159a10 (patch)
treeba16becf86b3c45c7829026c3fe6499672cc74f0
parent0829b893a9e9c874c0ef80d343af49334305e32e (diff)
tgsi: text parser: fix parsing of array in declaration
I noticed this code didn't work as advertised while doing some passing around of TGSI shaders and trying to reparse them, and things failing. This seems to fix it here for at least the small test case I hacked into a graw test. Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_text.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c
index 688c5bc9d8d..4c5ae4f03ae 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_text.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
@@ -1129,8 +1129,13 @@ static boolean parse_declaration( struct translate_ctx *ctx )
cur2 = cur;
cur2++;
eat_opt_white( &cur2 );
- if (str_match_nocase_whole( &cur2, "ARRAY(" )) {
+ if (str_match_nocase_whole( &cur2, "ARRAY" )) {
int arrayid;
+ if (*cur2 != '(') {
+ report_error( ctx, "Expected `('" );
+ return FALSE;
+ }
+ cur2++;
eat_opt_white( &cur2 );
if (!parse_int( &cur2, &arrayid )) {
report_error( ctx, "Expected `,'" );
@@ -1138,12 +1143,13 @@ static boolean parse_declaration( struct translate_ctx *ctx )
}
eat_opt_white( &cur2 );
if (*cur2 != ')') {
- report_error( ctx, "Expected `,'" );
+ report_error( ctx, "Expected `)'" );
return FALSE;
}
+ cur2++;
decl.Declaration.Array = 1;
decl.Array.ArrayID = arrayid;
- cur = cur2;
+ ctx->cur = cur = cur2;
}
}