Pass vertex program input semantics into tgsi_mesa_compile_vp_program() to produce...
authorBrian <brian.paul@tungstengraphics.com>
Fri, 21 Sep 2007 16:40:18 +0000 (10:40 -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 c7b62c9b848f494338fdb32e053c129abce8594d..ea6716f1a2188b56eb4cdabc1d3c94d088537c32 100644 (file)
@@ -469,7 +469,7 @@ compile_instruction(
 }\r
 \r
 static struct tgsi_full_declaration\r
-make_frag_input_decl(\r
+make_input_decl(\r
    GLuint index,\r
    GLuint interpolate,\r
    GLuint usage_mask,\r
@@ -560,20 +560,20 @@ tgsi_mesa_compile_fp_program(
       switch (inputSemanticName[i]) {\r
       case TGSI_SEMANTIC_POSITION:\r
          /* Fragment XY pos */\r
-         fulldecl = make_frag_input_decl(i,\r
-                                         TGSI_INTERPOLATE_CONSTANT,\r
-                                         TGSI_WRITEMASK_XY,\r
-                                         TGSI_SEMANTIC_POSITION, 0 );\r
+         fulldecl = make_input_decl(i,\r
+                                    TGSI_INTERPOLATE_CONSTANT,\r
+                                    TGSI_WRITEMASK_XY,\r
+                                    TGSI_SEMANTIC_POSITION, 0 );\r
          ti += tgsi_build_full_declaration(\r
                                            &fulldecl,\r
                                            &tokens[ti],\r
                                            header,\r
                                            maxTokens - ti );\r
          /* Fragment ZW pos */\r
-         fulldecl = make_frag_input_decl(i,\r
-                                         TGSI_INTERPOLATE_LINEAR,\r
-                                         TGSI_WRITEMASK_ZW,\r
-                                         TGSI_SEMANTIC_POSITION, 0 );\r
+         fulldecl = make_input_decl(i,\r
+                                    TGSI_INTERPOLATE_LINEAR,\r
+                                    TGSI_WRITEMASK_ZW,\r
+                                    TGSI_SEMANTIC_POSITION, 0 );\r
          ti += tgsi_build_full_declaration(\r
                                            &fulldecl,\r
                                            &tokens[ti],\r
@@ -581,11 +581,11 @@ tgsi_mesa_compile_fp_program(
                                            maxTokens - ti );\r
          break;\r
       default:\r
-         fulldecl = make_frag_input_decl(i,\r
-                                         interpMode[i],\r
-                                         TGSI_WRITEMASK_XYZW,\r
-                                         inputSemanticName[i],\r
-                                         inputSemanticIndex[i]);\r
+         fulldecl = make_input_decl(i,\r
+                                    interpMode[i],\r
+                                    TGSI_WRITEMASK_XYZW,\r
+                                    inputSemanticName[i],\r
+                                    inputSemanticIndex[i]);\r
          ti += tgsi_build_full_declaration(&fulldecl,\r
                                            &tokens[ti],\r
                                            header,\r
@@ -682,7 +682,10 @@ tgsi_mesa_compile_fp_program(
 GLboolean\r
 tgsi_mesa_compile_vp_program(\r
    const struct gl_vertex_program *program,\r
+   GLuint numInputs,\r
    const GLuint inputMapping[],\r
+   const ubyte inputSemanticName[],\r
+   const ubyte inputSemanticIndex[],\r
    const GLuint outputMapping[],\r
    struct tgsi_token *tokens,\r
    GLuint maxTokens)\r
@@ -704,6 +707,19 @@ tgsi_mesa_compile_vp_program(
 \r
    /* XXX todo: input/output declarations\r
     */\r
+   for (i = 0; i < numInputs; i++) {\r
+      struct tgsi_full_declaration fulldecl;\r
+      fulldecl = make_input_decl(i,\r
+                                 TGSI_INTERPOLATE_CONSTANT, /* no interp */\r
+                                 TGSI_WRITEMASK_XYZW,\r
+                                 inputSemanticName[i],\r
+                                 inputSemanticIndex[i]);\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 b40331981ebbfb1e83bf05f77e3695728908aa04..dc020cefaa89287388fbac5125e24206abd1ea8a 100644 (file)
@@ -22,7 +22,10 @@ tgsi_mesa_compile_fp_program(
 GLboolean\r
 tgsi_mesa_compile_vp_program(\r
    const struct gl_vertex_program *program,\r
+   GLuint numInputs,\r
    const GLuint inputMapping[],\r
+   const ubyte inputSemanticName[],\r
+   const ubyte inputSemanticIndex[],\r
    const GLuint outputMapping[],\r
    struct tgsi_token *tokens,\r
    GLuint maxTokens );\r
index dcd3564252316503f2de42f161cb15f138bec6ff..cf0414dd1e658fefca710e744ebb3ef599b2ad6d 100644 (file)
@@ -183,7 +183,10 @@ st_translate_vertex_shader(struct st_context *st,
    /* XXX: fix static allocation of tokens:
     */
    tgsi_mesa_compile_vp_program( &stvp->Base,
+                                 vs.num_inputs,
                                  stvp->input_to_index,
+                                 vs.input_semantic_name,
+                                 vs.input_semantic_index,
                                  st->vertex_attrib_to_slot,
                                  stvp->tokens, ST_FP_MAX_TOKENS );