fix get_result_vector() since fp output slots are not fixed anymore
[mesa.git] / src / mesa / pipe / i915simple / i915_fpc_translate.c
index 24f21f6633a101abc777b7640b318c8a2d2a18ef..f34225bfedcaae46c97442f8ccd8d5ce489eb293 100644 (file)
@@ -240,14 +240,17 @@ get_result_vector(struct i915_fp_compile *p,
 {
    switch (dest->DstRegister.File) {
    case TGSI_FILE_OUTPUT:
-      switch (dest->DstRegister.Index) {
-      case 0:  /**TGSI_ATTRIB_POS:**/
-         return UREG(REG_TYPE_OD, 0);
-      case 1:  /**TGSI_ATTRIB_COLOR0:**/
-         return UREG(REG_TYPE_OC, 0);
-      default:
-         i915_program_error(p, "Bad inst->DstReg.Index");
-         return 0;
+      {
+         uint sem_name = p->output_semantic_name[dest->DstRegister.Index];
+         switch (sem_name) {
+         case TGSI_SEMANTIC_POSITION:
+            return UREG(REG_TYPE_OD, 0);
+         case TGSI_SEMANTIC_COLOR:
+            return UREG(REG_TYPE_OC, 0);
+         default:
+            i915_program_error(p, "Bad inst->DstReg.Index/semantics");
+            return 0;
+         }
       }
    case TGSI_FILE_TEMPORARY:
       return UREG(REG_TYPE_R, dest->DstRegister.Index);
@@ -486,6 +489,10 @@ i915_translate_instruction(struct i915_fp_compile *p,
                       swizzle(src1, ONE, Y, ONE, W), 0);
       break;
 
+   case TGSI_OPCODE_END:
+      /* no-op */
+      break;
+
    case TGSI_OPCODE_EX2:
       src0 = src_vector(p, &inst->FullSrcRegisters[0]);
 
@@ -863,6 +870,17 @@ i915_translate_instructions(struct i915_fp_compile *p,
             p->input_semantic_name[ind] = sem;
             p->input_semantic_index[ind] = semi;
          }
+         else if (parse.FullToken.FullDeclaration.Declaration.File
+             == TGSI_FILE_OUTPUT) {
+            /* save output register info for use in get_result_vector() */
+            uint ind, sem, semi;
+            ind = parse.FullToken.FullDeclaration.u.DeclarationRange.First;
+            sem = parse.FullToken.FullDeclaration.Semantic.SemanticName;
+            semi = parse.FullToken.FullDeclaration.Semantic.SemanticIndex;
+            /*printf("FS Output DECL [%u] sem %u\n", ind, sem);*/
+            p->output_semantic_name[ind] = sem;
+            p->output_semantic_index[ind] = semi;
+         }
          break;
 
       case TGSI_TOKEN_TYPE_IMMEDIATE: