Mesa (gallium-0.1): tgsi: Fix definitions of LOOP/ENDLOOP instructions.

Michał Król michal at kemper.freedesktop.org
Thu Jul 30 11:54:46 UTC 2009


Module: Mesa
Branch: gallium-0.1
Commit: 52c7aae9f7bf1d3a9db73285f99b3e892e11dbe6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=52c7aae9f7bf1d3a9db73285f99b3e892e11dbe6

Author: Michal Krol <michal at vmware.com>
Date:   Thu Jul 30 13:54:13 2009 +0200

tgsi: Fix definitions of LOOP/ENDLOOP instructions.

---

 src/gallium/auxiliary/tgsi/tgsi_build.c    |    6 +++---
 src/gallium/auxiliary/tgsi/tgsi_dump.c     |    5 +++--
 src/gallium/auxiliary/tgsi/tgsi_dump_c.c   |    5 +++--
 src/gallium/auxiliary/tgsi/tgsi_info.c     |    4 ++--
 src/gallium/auxiliary/tgsi/tgsi_sanity.c   |   10 ++++++----
 src/gallium/auxiliary/tgsi/tgsi_text.c     |    3 ++-
 src/gallium/include/pipe/p_shader_tokens.h |    1 +
 7 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c
index ed8fc5a..61efda2 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_build.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_build.c
@@ -139,7 +139,7 @@ tgsi_build_declaration(
 {
    struct tgsi_declaration declaration;
 
-   assert( file <= TGSI_FILE_IMMEDIATE );
+   assert(file < TGSI_FILE_COUNT);
    assert( interpolate <= TGSI_INTERPOLATE_PERSPECTIVE );
 
    declaration = tgsi_default_declaration();
@@ -969,7 +969,7 @@ tgsi_build_src_register(
 {
    struct tgsi_src_register   src_register;
 
-   assert( file <= TGSI_FILE_IMMEDIATE );
+   assert(file < TGSI_FILE_COUNT);
    assert( swizzle_x <= TGSI_SWIZZLE_W );
    assert( swizzle_y <= TGSI_SWIZZLE_W );
    assert( swizzle_z <= TGSI_SWIZZLE_W );
@@ -1196,7 +1196,7 @@ tgsi_build_dst_register(
 {
    struct tgsi_dst_register dst_register;
 
-   assert( file <= TGSI_FILE_IMMEDIATE );
+   assert(file < TGSI_FILE_COUNT);
    assert( mask <= TGSI_WRITEMASK_XYZW );
    assert( index >= -32768 && index <= 32767 );
 
diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c
index 2ed8c2b..a3e47a2 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_dump.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c
@@ -80,7 +80,7 @@ static const char *processor_type_names[] =
    "GEOM"
 };
 
-static const char *file_names[] =
+static const char *file_names[TGSI_FILE_COUNT] =
 {
    "NULL",
    "CONST",
@@ -89,7 +89,8 @@ static const char *file_names[] =
    "TEMP",
    "SAMP",
    "ADDR",
-   "IMM"
+   "IMM",
+   "LOOP"
 };
 
 static const char *interpolate_names[] =
diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump_c.c b/src/gallium/auxiliary/tgsi/tgsi_dump_c.c
index be25cb4..8e5ef99 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_dump_c.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_dump_c.c
@@ -69,7 +69,7 @@ static const char *TGSI_TOKEN_TYPES[] =
    "TOKEN_TYPE_INSTRUCTION"
 };
 
-static const char *TGSI_FILES[] =
+static const char *TGSI_FILES[TGSI_FILE_COUNT] =
 {
    "FILE_NULL",
    "FILE_CONSTANT",
@@ -78,7 +78,8 @@ static const char *TGSI_FILES[] =
    "FILE_TEMPORARY",
    "FILE_SAMPLER",
    "FILE_ADDRESS",
-   "FILE_IMMEDIATE"
+   "FILE_IMMEDIATE",
+   "FILE_LOOP"
 };
 
 static const char *TGSI_INTERPOLATES[] =
diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c
index 68c7a6b..39fd8f9 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -105,11 +105,11 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
    { 1, 2, 1, 0, "TXL" },
    { 0, 0, 0, 0, "BRK" },
    { 0, 1, 0, 1, "IF" },
-   { 0, 0, 0, 0, "LOOP" },
+   { 1, 1, 0, 0, "LOOP" },
    { 0, 1, 0, 0, "REP" },
    { 0, 0, 0, 1, "ELSE" },
    { 0, 0, 0, 0, "ENDIF" },
-   { 0, 0, 0, 0, "ENDLOOP" },
+   { 1, 0, 0, 0, "ENDLOOP" },
    { 0, 0, 0, 0, "ENDREP" },
    { 0, 1, 0, 0, "PUSHA" },
    { 1, 0, 0, 0, "POPA" },
diff --git a/src/gallium/auxiliary/tgsi/tgsi_sanity.c b/src/gallium/auxiliary/tgsi/tgsi_sanity.c
index d802b43..8f942ad 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_sanity.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_sanity.c
@@ -131,7 +131,7 @@ is_register_used(
    return (ctx->regs_used[file][index / BITS_IN_REG_FLAG] & (1 << (index % BITS_IN_REG_FLAG))) ? TRUE : FALSE;
 }
 
-static const char *file_names[] =
+static const char *file_names[TGSI_FILE_COUNT] =
 {
    "NULL",
    "CONST",
@@ -140,7 +140,8 @@ static const char *file_names[] =
    "TEMP",
    "SAMP",
    "ADDR",
-   "IMM"
+   "IMM",
+   "LOOP"
 };
 
 static boolean
@@ -234,8 +235,9 @@ iter_instruction(
             index,
             "indirect",
             FALSE );
-         if (file != TGSI_FILE_ADDRESS || index != 0)
-            report_warning( ctx, "Indirect register not ADDR[0]" );
+         if (!(file == TGSI_FILE_ADDRESS || file == TGSI_FILE_LOOP) || index != 0) {
+            report_warning(ctx, "Indirect register neither ADDR[0] nor LOOP[0]");
+         }
       }
    }
 
diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c
index 9454563..6a7d2e1 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_text.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
@@ -230,7 +230,8 @@ static const char *file_names[TGSI_FILE_COUNT] =
    "TEMP",
    "SAMP",
    "ADDR",
-   "IMM"
+   "IMM",
+   "LOOP"
 };
 
 static boolean
diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h
index d591f04..e65a5c2 100644
--- a/src/gallium/include/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
@@ -51,6 +51,7 @@ enum tgsi_file_type {
    TGSI_FILE_SAMPLER     =5,
    TGSI_FILE_ADDRESS     =6,
    TGSI_FILE_IMMEDIATE   =7,
+   TGSI_FILE_LOOP        =8,
    TGSI_FILE_COUNT      /**< how many TGSI_FILE_ types */
 };
 




More information about the mesa-commit mailing list