pass vs output semantics to tgsi_mesa_compile_vp_program() to generate output DECs
authorBrian <brian.paul@tungstengraphics.com>
Fri, 21 Sep 2007 16:56:32 +0000 (10:56 -0600)
committerBrian <brian.paul@tungstengraphics.com>
Fri, 21 Sep 2007 17:14:49 +0000 (11:14 -0600)
src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c
src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h
src/mesa/state_tracker/st_atom_vs.c

index ea6716f1a2188b56eb4cdabc1d3c94d088537c32..8a3fda2c6374f5f645dce64655140100589bf20c 100644 (file)
@@ -686,7 +686,10 @@ tgsi_mesa_compile_vp_program(
    const GLuint inputMapping[],\r
    const ubyte inputSemanticName[],\r
    const ubyte inputSemanticIndex[],\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
@@ -705,8 +708,7 @@ tgsi_mesa_compile_vp_program(
 \r
    ti = 3;\r
 \r
-   /* XXX todo: input/output declarations\r
-    */\r
+   /* input decls */\r
    for (i = 0; i < numInputs; i++) {\r
       struct tgsi_full_declaration fulldecl;\r
       fulldecl = make_input_decl(i,\r
@@ -720,6 +722,19 @@ tgsi_mesa_compile_vp_program(
                                         maxTokens - ti );\r
    }\r
 \r
+   /* output decls */\r
+   for (i = 0; i < numOutputs; i++) {\r
+      struct tgsi_full_declaration fulldecl;\r
+      fulldecl = make_frag_output_decl(i,\r
+                                       outputSemanticName[i],\r
+                                       outputSemanticIndex[i],\r
+                                       TGSI_WRITEMASK_XYZW );\r
+      ti += tgsi_build_full_declaration(&fulldecl,\r
+                                        &tokens[ti],\r
+                                        header,\r
+                                        maxTokens - ti );\r
+   }\r
+\r
 \r
    for( i = 0; i < program->Base.NumInstructions; i++ ) {\r
       if( compile_instruction(\r
index dc020cefaa89287388fbac5125e24206abd1ea8a..cf85eb9c0b1eba13084f50e23171720d20222637 100644 (file)
@@ -26,7 +26,10 @@ tgsi_mesa_compile_vp_program(
    const GLuint inputMapping[],\r
    const ubyte inputSemanticName[],\r
    const ubyte inputSemanticIndex[],\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 d9ae0cdfacad2341ba903001986f9c0771627b60..c1bcdbe5a1a8c6148ae208e885f5b15768819a43 100644 (file)
@@ -136,11 +136,11 @@ st_translate_vertex_shader(struct st_context *st,
             vs.output_semantic_index[vs.num_outputs] = 0;
             break;
          case VERT_RESULT_COL0:
-            vs.output_semantic_name[vs.num_inputs] = TGSI_SEMANTIC_COLOR;
+            vs.output_semantic_name[vs.num_outputs] = TGSI_SEMANTIC_COLOR;
             vs.output_semantic_index[vs.num_outputs] = 0;
             break;
          case VERT_RESULT_COL1:
-            vs.output_semantic_name[vs.num_inputs] = TGSI_SEMANTIC_COLOR;
+            vs.output_semantic_name[vs.num_outputs] = TGSI_SEMANTIC_COLOR;
             vs.output_semantic_index[vs.num_outputs] = 1;
             break;
          case VERT_RESULT_BFC0:
@@ -187,7 +187,10 @@ st_translate_vertex_shader(struct st_context *st,
                                  stvp->input_to_index,
                                  vs.input_semantic_name,
                                  vs.input_semantic_index,
+                                 vs.num_outputs,
                                  st->vertex_attrib_to_slot,
+                                 vs.output_semantic_name,
+                                 vs.output_semantic_index,
                                  stvp->tokens, ST_FP_MAX_TOKENS );
 
    vs.tokens = &stvp->tokens[0];