965: cope better with range decls for temps, immediates, etc
authorKeith Whitwell <keith@tungstengraphics.com>
Thu, 10 Jan 2008 14:57:07 +0000 (14:57 +0000)
committerKeith Whitwell <keith@tungstengraphics.com>
Fri, 25 Jan 2008 15:50:05 +0000 (15:50 +0000)
src/mesa/pipe/i965simple/brw_vs_emit.c

index 5f212bd055387a7a1b1a1c77e6c66fe141671478..b32c233dd22d725371d74ca4a166fc02282a9341 100644 (file)
@@ -988,33 +988,24 @@ post_vs_emit( struct brw_vs_compile *c, struct brw_instruction *end_inst )
 static void process_declaration(const struct tgsi_full_declaration *decl,
                                 struct brw_prog_info *info)
 {
+   int first = decl->u.DeclarationRange.First;
+   int last = decl->u.DeclarationRange.Last;
+
+   assert (decl->Declaration.Declare != TGSI_DECLARE_MASK);
+   
    switch(decl->Declaration.File) {
-   case TGSI_FILE_CONSTANT: {
-      if (decl->Declaration.Declare == TGSI_DECLARE_MASK) {
-         printf("DECLARATION MASK = %d\n",
-                decl->u.DeclarationMask.Mask);
-         assert(0);
-      } else { /*range*/
-         info->num_consts += decl->u.DeclarationRange.Last - decl->u.DeclarationRange.First + 1;
-      }
-   }
+   case TGSI_FILE_CONSTANT: 
+      info->num_consts += last - first + 1;
       break;
    case TGSI_FILE_INPUT: {
    }
       break;
    case TGSI_FILE_OUTPUT: {
+      assert(last == first);   /* for now */
       if (decl->Declaration.Semantic) {
-         int idx = 0;
-         if (decl->Declaration.Declare == TGSI_DECLARE_MASK) {
-            printf("DECLARATION MASK = %d\n",
-                   decl->u.DeclarationMask.Mask);
-            assert(0);
-         } else { /*range*/
-            idx = decl->u.DeclarationRange.First;
-         }
          switch (decl->Semantic.SemanticName) {
          case TGSI_SEMANTIC_POSITION: {
-            info->pos_idx = idx;
+            info->pos_idx = first;
          }
             break;
          case TGSI_SEMANTIC_COLOR:
@@ -1025,7 +1016,7 @@ static void process_declaration(const struct tgsi_full_declaration *decl,
             break;
          case TGSI_SEMANTIC_PSIZE: {
             info->writes_psize = TRUE;
-            info->psize_idx = idx;
+            info->psize_idx = first;
          }
             break;
          case TGSI_SEMANTIC_GENERIC:
@@ -1035,14 +1026,14 @@ static void process_declaration(const struct tgsi_full_declaration *decl,
    }
       break;
    case TGSI_FILE_TEMPORARY: {
-      info->num_temps++;
+      info->num_temps += (last - first) + 1;
    }
       break;
    case TGSI_FILE_SAMPLER: {
    }
       break;
    case TGSI_FILE_ADDRESS: {
-      info->num_addrs++;
+      info->num_addrs += (last - first) + 1;
    }
       break;
    case TGSI_FILE_IMMEDIATE: {
@@ -1303,7 +1294,6 @@ void brw_vs_emit(struct brw_vs_compile *c)
       }
          break;
       case TGSI_TOKEN_TYPE_IMMEDIATE: {
-         int i;
          struct tgsi_full_immediate *imm = &parse.FullToken.FullImmediate;
          /*assert(imm->Immediate.Size == 4);*/
          c->prog_data.imm_buf[c->prog_data.num_imm][0] = imm->u.ImmediateFloat32[0].Float;