tgsi: Add proper constraints to sanity.
authorMichal Krol <michal@vmware.com>
Thu, 30 Jul 2009 09:39:06 +0000 (11:39 +0200)
committerMichal Krol <michal@vmware.com>
Thu, 30 Jul 2009 09:39:06 +0000 (11:39 +0200)
src/gallium/auxiliary/tgsi/tgsi_sanity.c

index 8bb186bae54f161dfc0e1191279e9556e2de0d6e..cb62a95fc0ac23cf70dd2b92af99d366a5a73166 100644 (file)
@@ -235,9 +235,29 @@ 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]");
+         }
+      }
+   }
+
+   switch (inst->Instruction.Opcode) {
+   case TGSI_OPCODE_LOOP:
+   case TGSI_OPCODE_ENDLOOP:
+      if (inst->FullDstRegisters[0].DstRegister.File != TGSI_FILE_LOOP ||
+          inst->FullDstRegisters[0].DstRegister.Index != 0) {
+         report_error(ctx, "Destination register must be LOOP[0]");
+      }
+      break;
+   }
+
+   switch (inst->Instruction.Opcode) {
+   case TGSI_OPCODE_LOOP:
+      if (inst->FullSrcRegisters[0].SrcRegister.File != TGSI_FILE_CONSTANT &&
+          inst->FullSrcRegisters[0].SrcRegister.File != TGSI_FILE_IMMEDIATE) {
+         report_error(ctx, "Source register file must be either CONST or IMM");
       }
+      break;
    }
 
    ctx->num_instructions++;