Finish up decls for packed fragment program outputs.
authorBrian <brian.paul@tungstengraphics.com>
Tue, 9 Oct 2007 22:20:00 +0000 (16:20 -0600)
committerBrian <brian.paul@tungstengraphics.com>
Tue, 9 Oct 2007 22:20:00 +0000 (16:20 -0600)
src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c
src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h
src/mesa/state_tracker/st_program.c

index 5a1ec3553e343535a7dcc5d1c413ed607511812b..66b8db07f956588903aae59bcd610146c4acca30 100644 (file)
@@ -516,7 +516,10 @@ tgsi_mesa_compile_fp_program(
    const ubyte inputSemanticName[],\r
    const ubyte inputSemanticIndex[],\r
    const GLuint interpMode[],\r
+   GLuint numOutputs,\r
    const GLuint outputMapping[],\r
+   const ubyte outputSemanticName[],\r
+   const ubyte outputSemanticIndex[],\r
    struct tgsi_token *tokens,\r
    GLuint maxTokens )\r
 {\r
@@ -580,30 +583,31 @@ tgsi_mesa_compile_fp_program(
    /*\r
     * Declare output attributes.\r
     */\r
-   assert(\r
-      program->Base.OutputsWritten ==\r
-      (program->Base.OutputsWritten & ((1 << FRAG_RESULT_COLR) | (1 << FRAG_RESULT_DEPR))) );\r
-\r
-   fulldecl = make_output_decl(\r
-      0,\r
-      TGSI_SEMANTIC_POSITION, 0,  /* Z / Depth */\r
-      TGSI_WRITEMASK_Z );\r
-   ti += tgsi_build_full_declaration(\r
-      &fulldecl,\r
-      &tokens[ti],\r
-      header,\r
-      maxTokens - ti );\r
-\r
-   if( program->Base.OutputsWritten & (1 << FRAG_RESULT_COLR) ) {\r
-      fulldecl = make_output_decl(\r
-         1,\r
-         TGSI_SEMANTIC_COLOR, 0,\r
-         TGSI_WRITEMASK_XYZW );\r
-      ti += tgsi_build_full_declaration(\r
-         &fulldecl,\r
-         &tokens[ti],\r
-         header,\r
-         maxTokens - ti );\r
+   for (i = 0; i < numOutputs; i++) {\r
+      switch (outputSemanticName[i]) {\r
+      case TGSI_SEMANTIC_POSITION:\r
+         fulldecl = make_output_decl(i,\r
+                                     TGSI_SEMANTIC_POSITION, 0, /* Z / Depth */\r
+                                     TGSI_WRITEMASK_Z );\r
+         ti += tgsi_build_full_declaration(\r
+                                           &fulldecl,\r
+                                           &tokens[ti],\r
+                                           header,\r
+                                           maxTokens - ti );\r
+         break;\r
+      case TGSI_SEMANTIC_COLOR:\r
+         fulldecl = make_output_decl(i,\r
+                                     TGSI_SEMANTIC_COLOR, 0,\r
+                                     TGSI_WRITEMASK_XYZW );\r
+         ti += tgsi_build_full_declaration(\r
+                                           &fulldecl,\r
+                                           &tokens[ti],\r
+                                           header,\r
+                                           maxTokens - ti );\r
+         break;\r
+      default:\r
+         abort();\r
+      }\r
    }\r
 \r
    /*\r
index cf85eb9c0b1eba13084f50e23171720d20222637..29e8053369022910abdf6fa7f31e2dfa64ffe7c6 100644 (file)
@@ -15,7 +15,10 @@ tgsi_mesa_compile_fp_program(
    const ubyte inputSemanticName[],\r
    const ubyte inputSemanticIndex[],\r
    const GLuint interpMode[],\r
+   GLuint numOutputs,\r
    const GLuint outputMapping[],\r
+   const ubyte outputSemanticName[],\r
+   const ubyte outputSemanticIndex[],\r
    struct tgsi_token *tokens,\r
    GLuint maxTokens );\r
 \r
index 0b14830353c5fd9772f88138f670bdb8abe0e446..1c5af7b75faa82fd536a616ac906855ca799fc76 100644 (file)
@@ -394,7 +394,10 @@ st_translate_fragment_program(struct st_context *st,
                                  fs.input_semantic_index,
                                  interpMode,
                                  /* outputs */
+                                 fs.num_outputs,
                                  outputMapping,
+                                 fs.output_semantic_name,
+                                 fs.output_semantic_index,
                                  /* tokenized result */
                                  tokensOut, maxTokens);