Mesa (gallium-resource-sampling): tgsi: fix parsing and dumping of resources

Zack Rusin zack at kemper.freedesktop.org
Tue Jun 8 16:55:19 UTC 2010


Module: Mesa
Branch: gallium-resource-sampling
Commit: 7ea3e376bd085248beafb556dfe869fe989247f7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7ea3e376bd085248beafb556dfe869fe989247f7

Author: Zack Rusin <zackr at vmware.com>
Date:   Tue Jun  8 12:51:51 2010 -0400

tgsi: fix parsing and dumping of resources

---

 src/gallium/auxiliary/tgsi/tgsi_dump.c |   10 ++++------
 src/gallium/auxiliary/tgsi/tgsi_info.c |   18 +++++++++---------
 src/gallium/auxiliary/tgsi/tgsi_text.c |   20 +++++++++++---------
 3 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c
index 7032e0e..2e10d23 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_dump.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c
@@ -340,13 +340,11 @@ iter_declaration(
       TXT(", ");
       ENM(decl->Resource.Resource, texture_names);
       TXT(", ");
-      if (decl->Resource.ReturnTypeX ==
-          decl->Resource.ReturnTypeY ==
-          decl->Resource.ReturnTypeZ ==
-          decl->Resource.ReturnTypeW)
+      if ((decl->Resource.ReturnTypeX == decl->Resource.ReturnTypeY) &&
+          (decl->Resource.ReturnTypeX == decl->Resource.ReturnTypeZ) &&
+          (decl->Resource.ReturnTypeX == decl->Resource.ReturnTypeW)) {
          ENM(decl->Resource.ReturnTypeX, type_names);
-      else {
-         TXT(", ");
+      } else {
          ENM(decl->Resource.ReturnTypeX, type_names);
          TXT(", ");
          ENM(decl->Resource.ReturnTypeY, type_names);
diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c
index e420f5b..14ed56a 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -177,15 +177,15 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
    { 0, 0, 0, 0, 0, 0, "DEFAULT", TGSI_OPCODE_DEFAULT },
    { 0, 0, 0, 0, 0, 0, "ENDSWITCH", TGSI_OPCODE_ENDSWITCH },
 
-   { 1, 2, 1, 0, 0, 0, "LOAD",        TGSI_OPCODE_LOAD },
-   { 1, 2, 1, 0, 0, 0, "LOAD_MS",     TGSI_OPCODE_LOAD_MS },
-   { 1, 3, 1, 0, 0, 0, "SAMPLE",      TGSI_OPCODE_SAMPLE },
-   { 1, 4, 1, 0, 0, 0, "SAMPLE_B",    TGSI_OPCODE_SAMPLE_B },
-   { 1, 4, 1, 0, 0, 0, "SAMPLE_C",    TGSI_OPCODE_SAMPLE_C },
-   { 1, 4, 1, 0, 0, 0, "SAMPLE_C_LZ", TGSI_OPCODE_SAMPLE_C_LZ },
-   { 1, 5, 1, 0, 0, 0, "SAMPLE_D",    TGSI_OPCODE_SAMPLE_D },
-   { 1, 3, 1, 0, 0, 0, "SAMPLE_L",    TGSI_OPCODE_SAMPLE_L },
-   { 1, 3, 1, 0, 0, 0, "GATHER4",     TGSI_OPCODE_GATHER4 },
+   { 1, 2, 0, 0, 0, 0, "LOAD",        TGSI_OPCODE_LOAD },
+   { 1, 2, 0, 0, 0, 0, "LOAD_MS",     TGSI_OPCODE_LOAD_MS },
+   { 1, 3, 0, 0, 0, 0, "SAMPLE",      TGSI_OPCODE_SAMPLE },
+   { 1, 4, 0, 0, 0, 0, "SAMPLE_B",    TGSI_OPCODE_SAMPLE_B },
+   { 1, 4, 0, 0, 0, 0, "SAMPLE_C",    TGSI_OPCODE_SAMPLE_C },
+   { 1, 4, 0, 0, 0, 0, "SAMPLE_C_LZ", TGSI_OPCODE_SAMPLE_C_LZ },
+   { 1, 5, 0, 0, 0, 0, "SAMPLE_D",    TGSI_OPCODE_SAMPLE_D },
+   { 1, 3, 0, 0, 0, 0, "SAMPLE_L",    TGSI_OPCODE_SAMPLE_L },
+   { 1, 3, 0, 0, 0, 0, "GATHER4",     TGSI_OPCODE_GATHER4 },
    { 1, 2, 0, 0, 0, 0, "RESINFO",     TGSI_OPCODE_RESINFO },
    { 1, 2, 0, 0, 0, 0, "SAMPLE_POS",  TGSI_OPCODE_SAMPLE_POS },
    { 1, 2, 0, 0, 0, 0, "SAMPLE_INFO", TGSI_OPCODE_SAMPLE_INFO },
diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c
index 5a26eaa..2535d81 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_text.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
@@ -1044,7 +1044,6 @@ static boolean parse_declaration( struct translate_ctx *ctx )
       cur++;
       eat_opt_white( &cur );
       if (file == TGSI_FILE_RESOURCE) {
-         debug_printf("RESOURCE!!!!!!!!\n");
          for (i = 0; i < TGSI_TEXTURE_COUNT; i++) {
             if (str_match_no_case(&cur, texture_names[i])) {
                if (!is_digit_alpha_underscore(cur)) {
@@ -1058,10 +1057,11 @@ static boolean parse_declaration( struct translate_ctx *ctx )
             return FALSE;
          }
          eat_opt_white( &cur );
-         if (*ctx->cur != ',') {
+         if (*cur != ',') {
             report_error( ctx, "Expected `,'" );
             return FALSE;
          }
+         ++cur;
          eat_opt_white( &cur );
          for (j = 0; j < 4; ++j) {
             for (i = 0; i < PIPE_TYPE_COUNT; ++i) {
@@ -1094,13 +1094,15 @@ static boolean parse_declaration( struct translate_ctx *ctx )
                }
                break;
             } else {
-               eat_opt_white( &ctx->cur );
-               if (*ctx->cur != ',') {
-                  report_error( ctx, "Expected `,'" );
-                  return FALSE;
-               }
-               ctx->cur++;
-               eat_opt_white( &ctx->cur );
+               const char *cur2 = cur;
+               eat_opt_white( &cur2 );
+               if (*cur2 == ',') {
+                  cur2++;
+                  eat_opt_white( &cur2 );
+                  cur = cur2;
+                  continue;
+               } else
+                  break;
             }
          }
          if (j < 4) {




More information about the mesa-commit mailing list