fix get_result_vector() since fp output slots are not fixed anymore
authorBrian <brian.paul@tungstengraphics.com>
Wed, 10 Oct 2007 21:45:57 +0000 (15:45 -0600)
committerBrian <brian.paul@tungstengraphics.com>
Wed, 10 Oct 2007 21:45:57 +0000 (15:45 -0600)
src/mesa/pipe/i915simple/i915_fpc.h
src/mesa/pipe/i915simple/i915_fpc_translate.c

index 5fdc7ef27eafb70c0f8f0268acaebd41e052d1c6..c25f5abf0eaf1fc503ae194d7158e790c1c9c710 100644 (file)
@@ -54,6 +54,9 @@ struct i915_fp_compile {
    uint input_semantic_name[PIPE_MAX_SHADER_INPUTS];
    uint input_semantic_index[PIPE_MAX_SHADER_INPUTS];
 
+   uint output_semantic_name[PIPE_MAX_SHADER_OUTPUTS];
+   uint output_semantic_index[PIPE_MAX_SHADER_OUTPUTS];
+
    /** points into the i915->current.constants array: */
    float (*constants)[4];
    uint num_constants;
index 24bb1d3e2a984c3ac832adfeb4b2023cffb2de11..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);
@@ -867,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: