r600g/sb: improve alu packing on cayman
[mesa.git] / src / gallium / auxiliary / tgsi / tgsi_text.c
index 6b97bee8b0f67178905e81c7ec1769dd255715c7..4c5ae4f03ae97e38856fa9c378bb0886b054c7ea 100644 (file)
@@ -322,7 +322,7 @@ parse_file( const char **pcur, uint *file )
    for (i = 0; i < TGSI_FILE_COUNT; i++) {
       const char *cur = *pcur;
 
-      if (str_match_nocase_whole( &cur, tgsi_file_names[i] )) {
+      if (str_match_nocase_whole( &cur, tgsi_file_name(i) )) {
          *pcur = cur;
          *file = i;
          return TRUE;
@@ -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;
       }
    }
 
@@ -1570,7 +1576,7 @@ tgsi_text_translate(
    struct tgsi_token *tokens,
    uint num_tokens )
 {
-   struct translate_ctx ctx;
+   struct translate_ctx ctx = {0};
 
    ctx.text = text;
    ctx.cur = text;