[Mesa-dev] [PATCH 6/7] tgsi: remove TGSI_FILE_(IMMEDIATE|TEMP)_ARRAY

Christian König deathsimple at vodafone.de
Mon Mar 11 05:44:53 PDT 2013


From: Christian König <christian.koenig at amd.com>

Nobody seems to be using it, and only nv50 had a partial implementation.

Signed-off-by: Christian König <christian.koenig at amd.com>
---
 src/gallium/auxiliary/tgsi/tgsi_build.c            |   19 -----
 src/gallium/auxiliary/tgsi/tgsi_dump.c             |   38 ---------
 src/gallium/auxiliary/tgsi/tgsi_exec.c             |   41 ----------
 src/gallium/auxiliary/tgsi/tgsi_exec.h             |    2 -
 src/gallium/auxiliary/tgsi/tgsi_parse.c            |   11 ---
 src/gallium/auxiliary/tgsi/tgsi_parse.h            |    6 --
 src/gallium/auxiliary/tgsi/tgsi_sanity.c           |    2 -
 src/gallium/auxiliary/tgsi/tgsi_strings.c          |    2 -
 src/gallium/auxiliary/tgsi/tgsi_text.c             |   43 ----------
 .../drivers/nv50/codegen/nv50_ir_from_tgsi.cpp     |   82 --------------------
 src/gallium/include/pipe/p_shader_tokens.h         |    6 +-
 11 files changed, 2 insertions(+), 250 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c
index cb7b9b2..33cbbd8 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_build.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_build.c
@@ -336,7 +336,6 @@ tgsi_default_full_declaration( void )
    full_declaration.Range = tgsi_default_declaration_range();
    full_declaration.Semantic = tgsi_default_declaration_semantic();
    full_declaration.Interp = tgsi_default_declaration_interp();
-   full_declaration.ImmediateData.u = NULL;
    full_declaration.Resource = tgsi_default_declaration_resource();
    full_declaration.SamplerView = tgsi_default_declaration_sampler_view();
 
@@ -425,24 +424,6 @@ tgsi_build_full_declaration(
          header );
    }
 
-   if (full_decl->Declaration.File == TGSI_FILE_IMMEDIATE_ARRAY) {
-      unsigned i, j;
-      union tgsi_immediate_data *data;
-
-      for (i = 0; i <= dr->Last; ++i) {
-         for (j = 0; j < 4; ++j) {
-            unsigned idx = i*4 + j;
-            if (maxsize <= size)
-               return 0;
-            data = (union tgsi_immediate_data *) &tokens[size];
-            ++size;
-
-            *data = full_decl->ImmediateData.u[idx];
-            declaration_grow( declaration, header );
-         }
-      }
-   }
-
    if (full_decl->Declaration.File == TGSI_FILE_RESOURCE) {
       struct tgsi_declaration_resource *dr;
 
diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c
index 3e6f76a..177be0f 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_dump.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c
@@ -347,44 +347,6 @@ iter_declaration(
       TXT( ", INVARIANT" );
    }
 
-
-   if (decl->Declaration.File == TGSI_FILE_IMMEDIATE_ARRAY) {
-      unsigned i;
-      char range_indent[4];
-
-      TXT(" {");
-
-      if (decl->Range.Last < 10)
-         range_indent[0] = '\0';
-      else if (decl->Range.Last < 100) {
-         range_indent[0] = ' ';
-         range_indent[1] = '\0';
-      } else if (decl->Range.Last < 1000) {
-         range_indent[0] = ' ';
-         range_indent[1] = ' ';
-         range_indent[2] = '\0';
-      } else {
-         range_indent[0] = ' ';
-         range_indent[1] = ' ';
-         range_indent[2] = ' ';
-         range_indent[3] = '\0';
-      }
-
-      dump_imm_data(iter, decl->ImmediateData.u,
-                    4, TGSI_IMM_FLOAT32);
-      for(i = 1; i <= decl->Range.Last; ++i) {
-         /* indent by strlen of:
-          *   "DCL IMMX[0..1] {" */
-         CHR('\n');
-         TXT( "                " );
-         TXT( range_indent );
-         dump_imm_data(iter, decl->ImmediateData.u + i,
-                       4, TGSI_IMM_FLOAT32);
-      }
-
-      TXT(" }");
-   }
-
    EOL();
 
    return TRUE;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 6a74ef3..838c4a8 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -748,19 +748,6 @@ tgsi_exec_machine_bind_shader(
                ++mach->NumOutputs;
             }
          }
-         if (parse.FullToken.FullDeclaration.Declaration.File ==
-             TGSI_FILE_IMMEDIATE_ARRAY) {
-            unsigned reg;
-            struct tgsi_full_declaration *decl =
-               &parse.FullToken.FullDeclaration;
-            debug_assert(decl->Range.Last < TGSI_EXEC_NUM_IMMEDIATES);
-            for (reg = decl->Range.First; reg <= decl->Range.Last; ++reg) {
-               for( i = 0; i < 4; i++ ) {
-                  int idx = reg * 4 + i;
-                  mach->ImmArray[reg][i] = decl->ImmediateData.u[idx].Float;
-               }
-            }
-         }
          memcpy(declarations + numDeclarations,
                 &parse.FullToken.FullDeclaration,
                 sizeof(declarations[0]));
@@ -1115,16 +1102,6 @@ fetch_src_file_channel(const struct tgsi_exec_machine *mach,
       }
       break;
 
-   case TGSI_FILE_TEMPORARY_ARRAY:
-      for (i = 0; i < TGSI_QUAD_SIZE; i++) {
-         assert(index->i[i] < TGSI_EXEC_NUM_TEMPS);
-         assert(index2D->i[i] < TGSI_EXEC_NUM_TEMP_ARRAYS);
-
-         chan->u[i] =
-            mach->TempArray[index2D->i[i]][index->i[i]].xyzw[swizzle].u[i];
-      }
-      break;
-
    case TGSI_FILE_IMMEDIATE:
       for (i = 0; i < TGSI_QUAD_SIZE; i++) {
          assert(index->i[i] >= 0 && index->i[i] < (int)mach->ImmLimit);
@@ -1134,14 +1111,6 @@ fetch_src_file_channel(const struct tgsi_exec_machine *mach,
       }
       break;
 
-   case TGSI_FILE_IMMEDIATE_ARRAY:
-      for (i = 0; i < TGSI_QUAD_SIZE; i++) {
-         assert(index2D->i[i] == 0);
-
-         chan->f[i] = mach->ImmArray[index->i[i]][swizzle];
-      }
-      break;
-
    case TGSI_FILE_ADDRESS:
       for (i = 0; i < TGSI_QUAD_SIZE; i++) {
          assert(index->i[i] >= 0);
@@ -1500,16 +1469,6 @@ store_dest(struct tgsi_exec_machine *mach,
       dst = &mach->Temps[offset + index].xyzw[chan_index];
       break;
 
-   case TGSI_FILE_TEMPORARY_ARRAY:
-      index = reg->Register.Index;
-      assert( index < TGSI_EXEC_NUM_TEMPS );
-      assert( index2D.i[0] < TGSI_EXEC_NUM_TEMP_ARRAYS );
-      /* XXX we use index2D.i[0] here but somehow we might
-       * end up with someone trying to store indirectly in
-       * different buffers */
-      dst = &mach->TempArray[index2D.i[0]][offset + index].xyzw[chan_index];
-      break;
-
    case TGSI_FILE_ADDRESS:
       index = reg->Register.Index;
       dst = &mach->Addrs[index].xyzw[chan_index];
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h
index ef1fa82..b14fa2e 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h
@@ -141,7 +141,6 @@ struct tgsi_sampler
 
 #define TGSI_EXEC_NUM_TEMPS       4096
 #define TGSI_EXEC_NUM_IMMEDIATES  256
-#define TGSI_EXEC_NUM_TEMP_ARRAYS 8
 
 /*
  * Locations of various utility registers (_I = Index, _C = Channel)
@@ -269,7 +268,6 @@ struct tgsi_exec_machine
     */
    struct tgsi_exec_vector       Temps[TGSI_EXEC_NUM_TEMPS +
                                        TGSI_EXEC_NUM_TEMP_EXTRAS];
-   struct tgsi_exec_vector       TempArray[TGSI_EXEC_NUM_TEMP_ARRAYS][TGSI_EXEC_NUM_TEMPS];
 
    float                         Imms[TGSI_EXEC_NUM_IMMEDIATES][4];
 
diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.c b/src/gallium/auxiliary/tgsi/tgsi_parse.c
index 45c5c41..720d68d 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_parse.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_parse.c
@@ -121,17 +121,6 @@ tgsi_parse_token(
          next_token( ctx, &decl->Semantic );
       }
 
-      if (decl->Declaration.File == TGSI_FILE_IMMEDIATE_ARRAY) {
-         unsigned i, j;
-         decl->ImmediateData.u = (union tgsi_immediate_data*)
-                                 &ctx->Tokens[ctx->Position];
-         for (i = 0; i <= decl->Range.Last; ++i) {
-            for (j = 0; j < 4; ++j) {
-               ctx->Position++;
-            }
-         }
-      }
-
       if (decl->Declaration.File == TGSI_FILE_RESOURCE) {
          next_token(ctx, &decl->Resource);
       }
diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.h b/src/gallium/auxiliary/tgsi/tgsi_parse.h
index 3f8bf99..78210ed 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_parse.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_parse.h
@@ -57,11 +57,6 @@ struct tgsi_full_src_register
    struct tgsi_src_register         DimIndirect;
 };
 
-struct tgsi_immediate_array_data
-{
-   union tgsi_immediate_data *u;
-};
-
 struct tgsi_full_declaration
 {
    struct tgsi_declaration Declaration;
@@ -69,7 +64,6 @@ struct tgsi_full_declaration
    struct tgsi_declaration_dimension Dim;
    struct tgsi_declaration_interp Interp;
    struct tgsi_declaration_semantic Semantic;
-   struct tgsi_immediate_array_data ImmediateData;
    struct tgsi_declaration_resource Resource;
    struct tgsi_declaration_sampler_view SamplerView;
 };
diff --git a/src/gallium/auxiliary/tgsi/tgsi_sanity.c b/src/gallium/auxiliary/tgsi/tgsi_sanity.c
index 509c534..8a21e56 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_sanity.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_sanity.c
@@ -257,8 +257,6 @@ static const char *file_names[TGSI_FILE_COUNT] =
    "IMM",
    "PRED",
    "SV",
-   "IMMX",
-   "TEMPX",
    "RES"
 };
 
diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c b/src/gallium/auxiliary/tgsi/tgsi_strings.c
index 70f997b..5c92e9a 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_strings.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c
@@ -52,8 +52,6 @@ const char *tgsi_file_names[TGSI_FILE_COUNT] =
    "IMM",
    "PRED",
    "SV",
-   "IMMX",
-   "TEMPX",
    "RES",
    "SVIEW"
 };
diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c
index 5abcb45..7d580e6 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_text.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
@@ -1084,7 +1084,6 @@ static boolean parse_declaration( struct translate_ctx *ctx )
    const char *cur, *cur2;
    uint advance;
    boolean is_vs_input;
-   boolean is_imm_array;
 
    if (!eat_white( &ctx->cur )) {
       report_error( ctx, "Syntax error" );
@@ -1112,7 +1111,6 @@ static boolean parse_declaration( struct translate_ctx *ctx )
 
    is_vs_input = (file == TGSI_FILE_INPUT &&
                   ctx->processor == TGSI_PROCESSOR_VERTEX);
-   is_imm_array = (file == TGSI_FILE_IMMEDIATE_ARRAY);
 
    cur = ctx->cur;
    eat_opt_white( &cur );
@@ -1264,44 +1262,6 @@ static boolean parse_declaration( struct translate_ctx *ctx )
             }
          }
       }
-   } else if (is_imm_array) {
-      unsigned i;
-      union tgsi_immediate_data *vals_itr;
-      /* we have our immediate data */
-      if (*cur != '{') {
-         report_error( ctx, "Immediate array without data" );
-         return FALSE;
-      }
-      ++cur;
-      ctx->cur = cur;
-
-      decl.ImmediateData.u =
-         MALLOC(sizeof(union tgsi_immediate_data) * 4 *
-                (decl.Range.Last + 1));
-      vals_itr = decl.ImmediateData.u;
-      for (i = 0; i <= decl.Range.Last; ++i) {
-         if (!parse_immediate_data(ctx, TGSI_IMM_FLOAT32, vals_itr)) {
-            FREE(decl.ImmediateData.u);
-            return FALSE;
-         }
-         vals_itr += 4;
-         eat_opt_white( &ctx->cur );
-         if (*ctx->cur != ',') {
-            if (i !=  decl.Range.Last) {
-               report_error( ctx, "Not enough data in immediate array!" );
-               FREE(decl.ImmediateData.u);
-               return FALSE;
-            }
-         } else
-            ++ctx->cur;
-      }
-      eat_opt_white( &ctx->cur );
-      if (*ctx->cur != '}') {
-         FREE(decl.ImmediateData.u);
-         report_error( ctx, "Immediate array data missing closing '}'" );
-         return FALSE;
-      }
-      ++ctx->cur;
    }
 
    cur = ctx->cur;
@@ -1332,9 +1292,6 @@ static boolean parse_declaration( struct translate_ctx *ctx )
       ctx->header,
       (uint) (ctx->tokens_end - ctx->tokens_cur) );
 
-   if (is_imm_array)
-      FREE(decl.ImmediateData.u);
-
    if (advance == 0)
       return FALSE;
    ctx->tokens_cur += advance;
diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp
index acec623..f5525b2 100644
--- a/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp
+++ b/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp
@@ -316,8 +316,6 @@ static nv50_ir::DataFile translateFile(uint file)
    case TGSI_FILE_PREDICATE:       return nv50_ir::FILE_PREDICATE;
    case TGSI_FILE_IMMEDIATE:       return nv50_ir::FILE_IMMEDIATE;
    case TGSI_FILE_SYSTEM_VALUE:    return nv50_ir::FILE_SYSTEM_VALUE;
-   case TGSI_FILE_IMMEDIATE_ARRAY: return nv50_ir::FILE_IMMEDIATE;
-   case TGSI_FILE_TEMPORARY_ARRAY: return nv50_ir::FILE_MEMORY_LOCAL;
    case TGSI_FILE_RESOURCE:        return nv50_ir::FILE_MEMORY_GLOBAL;
    case TGSI_FILE_SAMPLER:
    case TGSI_FILE_NULL:
@@ -609,8 +607,6 @@ public:
 
    nv50_ir::DynArray tempArrays;
    nv50_ir::DynArray immdArrays;
-   int tempArrayCount;
-   int immdArrayCount;
 
    bool mainTempsInLMem;
 
@@ -673,8 +669,6 @@ bool Source::scanSource()
    samplerViewTargets = new uint8_t[samplerViewCount];
 
    info->immd.bufSize = 0;
-   tempArrayCount = 0;
-   immdArrayCount = 0;
 
    info->numInputs = scan.file_max[TGSI_FILE_INPUT] + 1;
    info->numOutputs = scan.file_max[TGSI_FILE_OUTPUT] + 1;
@@ -899,50 +893,6 @@ bool Source::scanDeclaration(const struct tgsi_full_declaration *decl)
       for (i = first; i <= last; ++i)
          samplerViewTargets[i] = decl->SamplerView.Resource;
       break;
-   case TGSI_FILE_IMMEDIATE_ARRAY:
-   {
-      if (decl->Dim.Index2D >= immdArrayCount)
-         immdArrayCount = decl->Dim.Index2D + 1;
-      immdArrays[decl->Dim.Index2D].u32 = (last + 1) << 2;
-      int c;
-      uint32_t base, count;
-      switch (decl->Declaration.UsageMask) {
-      case 0x1: c = 1; break;
-      case 0x3: c = 2; break;
-      default:
-         c = 4;
-         break;
-      }
-      immdArrays[decl->Dim.Index2D].u32 |= c;
-      count = (last + 1) * c;
-      base = info->immd.bufSize / 4;
-      info->immd.bufSize = (info->immd.bufSize + count * 4 + 0xf) & ~0xf;
-      info->immd.buf = (uint32_t *)REALLOC(info->immd.buf, base * 4,
-                                           info->immd.bufSize);
-      // NOTE: this assumes array declarations are ordered by Dim.Index2D
-      for (i = 0; i < count; ++i)
-         info->immd.buf[base + i] = decl->ImmediateData.u[i].Uint;
-   }
-      break;
-   case TGSI_FILE_TEMPORARY_ARRAY:
-   {
-      if (decl->Dim.Index2D >= tempArrayCount)
-         tempArrayCount = decl->Dim.Index2D + 1;
-      tempArrays[decl->Dim.Index2D].u32 = (last + 1) << 2;
-      int c;
-      uint32_t count;
-      switch (decl->Declaration.UsageMask) {
-      case 0x1: c = 1; break;
-      case 0x3: c = 2; break;
-      default:
-         c = 4;
-         break;
-      }
-      tempArrays[decl->Dim.Index2D].u32 |= c;
-      count = (last + 1) * c;
-      info->bin.tlsSpace += (info->bin.tlsSpace + count * 4 + 0xf) & ~0xf;
-   }
-      break;
    case TGSI_FILE_NULL:
    case TGSI_FILE_TEMPORARY:
    case TGSI_FILE_ADDRESS:
@@ -1134,8 +1084,6 @@ private:
    DataArray aData; // TGSI_FILE_ADDRESS
    DataArray pData; // TGSI_FILE_PREDICATE
    DataArray oData; // TGSI_FILE_OUTPUT (if outputs in registers)
-   std::vector<DataArray> lData; // TGSI_FILE_TEMPORARY_ARRAY
-   std::vector<DataArray> iData; // TGSI_FILE_IMMEDIATE_ARRAY
 
    Value *zero;
    Value *fragCoord[4];
@@ -1315,12 +1263,6 @@ Converter::getArrayForFile(unsigned file, int idx)
       return &pData;
    case TGSI_FILE_ADDRESS:
       return &aData;
-   case TGSI_FILE_TEMPORARY_ARRAY:
-      assert(idx < code->tempArrayCount);
-      return &lData[idx];
-   case TGSI_FILE_IMMEDIATE_ARRAY:
-      assert(idx < code->immdArrayCount);
-      return &iData[idx];
    case TGSI_FILE_OUTPUT:
       assert(prog->getType() == Program::TYPE_FRAGMENT);
       return &oData;
@@ -1377,7 +1319,6 @@ Converter::acquireDst(int d, int c)
       return NULL;
 
    if (dst.isIndirect(0) ||
-       f == TGSI_FILE_TEMPORARY_ARRAY ||
        f == TGSI_FILE_SYSTEM_VALUE ||
        (f == TGSI_FILE_OUTPUT && prog->getType() != Program::TYPE_FRAGMENT))
       return getScratch();
@@ -1435,7 +1376,6 @@ Converter::storeDst(const tgsi::Instruction::DstRegister dst, int c,
          mkStore(OP_EXPORT, TYPE_U32, dstToSym(dst, c), ptr, val);
    } else
    if (f == TGSI_FILE_TEMPORARY ||
-       f == TGSI_FILE_TEMPORARY_ARRAY ||
        f == TGSI_FILE_PREDICATE ||
        f == TGSI_FILE_ADDRESS ||
        f == TGSI_FILE_OUTPUT) {
@@ -2337,28 +2277,6 @@ Converter::Converter(Program *ir, const tgsi::Source *code) : BuildUtil(ir),
    aData.setup(TGSI_FILE_ADDRESS, 0, 0, aSize, 4, 4, FILE_ADDRESS, 0);
    oData.setup(TGSI_FILE_OUTPUT, 0, 0, oSize, 4, 4, FILE_GPR, 0);
 
-   for (int vol = 0, i = 0; i < code->tempArrayCount; ++i) {
-      int len = code->tempArrays[i].u32 >> 2;
-      int dim = code->tempArrays[i].u32 & 3;
-
-      lData.push_back(DataArray(this));
-      lData.back().setup(TGSI_FILE_TEMPORARY_ARRAY, i, vol, len, dim, 4,
-                         FILE_MEMORY_LOCAL, 0);
-
-      vol += (len * dim * 4 + 0xf) & ~0xf;
-   }
-
-   for (int vol = 0, i = 0; i < code->immdArrayCount; ++i) {
-      int len = code->immdArrays[i].u32 >> 2;
-      int dim = code->immdArrays[i].u32 & 3;
-
-      lData.push_back(DataArray(this));
-      lData.back().setup(TGSI_FILE_IMMEDIATE_ARRAY, i, vol, len, dim, 4,
-                         FILE_MEMORY_CONST, 14);
-
-      vol += (len * dim * 4 + 0xf) & ~0xf;
-   }
-
    zero = mkImm((uint32_t)0);
 
    vtxBaseValid = 0;
diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h
index a9fb6aa..81e4a6b 100644
--- a/src/gallium/include/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
@@ -74,10 +74,8 @@ enum tgsi_file_type {
    TGSI_FILE_IMMEDIATE           =7,
    TGSI_FILE_PREDICATE           =8,
    TGSI_FILE_SYSTEM_VALUE        =9,
-   TGSI_FILE_IMMEDIATE_ARRAY     =10,
-   TGSI_FILE_TEMPORARY_ARRAY     =11,
-   TGSI_FILE_RESOURCE            =12,
-   TGSI_FILE_SAMPLER_VIEW        =13,
+   TGSI_FILE_RESOURCE            =10,
+   TGSI_FILE_SAMPLER_VIEW        =11,
    TGSI_FILE_COUNT      /**< how many TGSI_FILE_ types */
 };
 
-- 
1.7.9.5



More information about the mesa-dev mailing list