diff options
author | Brian <[email protected]> | 2007-09-21 10:40:18 -0600 |
---|---|---|
committer | Brian <[email protected]> | 2007-09-21 11:14:49 -0600 |
commit | ed10ece932162ac7c3c5ee125a0ca35c805240ad (patch) | |
tree | 5d085ec1fda017c4b26b21c5fdf246aefff4b494 | |
parent | 562c9410630c7faeb3b04bd8b4fa8d29c9193eaa (diff) |
Pass vertex program input semantics into tgsi_mesa_compile_vp_program() to produce DCLs.
-rw-r--r-- | src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c | 44 | ||||
-rw-r--r-- | src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h | 3 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_atom_vs.c | 3 |
3 files changed, 36 insertions, 14 deletions
diff --git a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c index c7b62c9b848..ea6716f1a21 100644 --- a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c +++ b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c @@ -469,7 +469,7 @@ compile_instruction( }
static struct tgsi_full_declaration
-make_frag_input_decl(
+make_input_decl(
GLuint index,
GLuint interpolate,
GLuint usage_mask,
@@ -560,20 +560,20 @@ tgsi_mesa_compile_fp_program( switch (inputSemanticName[i]) {
case TGSI_SEMANTIC_POSITION:
/* Fragment XY pos */
- fulldecl = make_frag_input_decl(i,
- TGSI_INTERPOLATE_CONSTANT,
- TGSI_WRITEMASK_XY,
- TGSI_SEMANTIC_POSITION, 0 );
+ fulldecl = make_input_decl(i,
+ TGSI_INTERPOLATE_CONSTANT,
+ TGSI_WRITEMASK_XY,
+ TGSI_SEMANTIC_POSITION, 0 );
ti += tgsi_build_full_declaration(
&fulldecl,
&tokens[ti],
header,
maxTokens - ti );
/* Fragment ZW pos */
- fulldecl = make_frag_input_decl(i,
- TGSI_INTERPOLATE_LINEAR,
- TGSI_WRITEMASK_ZW,
- TGSI_SEMANTIC_POSITION, 0 );
+ fulldecl = make_input_decl(i,
+ TGSI_INTERPOLATE_LINEAR,
+ TGSI_WRITEMASK_ZW,
+ TGSI_SEMANTIC_POSITION, 0 );
ti += tgsi_build_full_declaration(
&fulldecl,
&tokens[ti],
@@ -581,11 +581,11 @@ tgsi_mesa_compile_fp_program( maxTokens - ti );
break;
default:
- fulldecl = make_frag_input_decl(i,
- interpMode[i],
- TGSI_WRITEMASK_XYZW,
- inputSemanticName[i],
- inputSemanticIndex[i]);
+ fulldecl = make_input_decl(i,
+ interpMode[i],
+ TGSI_WRITEMASK_XYZW,
+ inputSemanticName[i],
+ inputSemanticIndex[i]);
ti += tgsi_build_full_declaration(&fulldecl,
&tokens[ti],
header,
@@ -682,7 +682,10 @@ tgsi_mesa_compile_fp_program( GLboolean
tgsi_mesa_compile_vp_program(
const struct gl_vertex_program *program,
+ GLuint numInputs,
const GLuint inputMapping[],
+ const ubyte inputSemanticName[],
+ const ubyte inputSemanticIndex[],
const GLuint outputMapping[],
struct tgsi_token *tokens,
GLuint maxTokens)
@@ -704,6 +707,19 @@ tgsi_mesa_compile_vp_program( /* XXX todo: input/output declarations
*/
+ for (i = 0; i < numInputs; i++) {
+ struct tgsi_full_declaration fulldecl;
+ fulldecl = make_input_decl(i,
+ TGSI_INTERPOLATE_CONSTANT, /* no interp */
+ TGSI_WRITEMASK_XYZW,
+ inputSemanticName[i],
+ inputSemanticIndex[i]);
+ ti += tgsi_build_full_declaration(&fulldecl,
+ &tokens[ti],
+ header,
+ maxTokens - ti );
+ }
+
for( i = 0; i < program->Base.NumInstructions; i++ ) {
if( compile_instruction(
diff --git a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h index b40331981eb..dc020cefaa8 100644 --- a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h +++ b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h @@ -22,7 +22,10 @@ tgsi_mesa_compile_fp_program( GLboolean
tgsi_mesa_compile_vp_program(
const struct gl_vertex_program *program,
+ GLuint numInputs,
const GLuint inputMapping[],
+ const ubyte inputSemanticName[],
+ const ubyte inputSemanticIndex[],
const GLuint outputMapping[],
struct tgsi_token *tokens,
GLuint maxTokens );
diff --git a/src/mesa/state_tracker/st_atom_vs.c b/src/mesa/state_tracker/st_atom_vs.c index dcd35642523..cf0414dd1e6 100644 --- a/src/mesa/state_tracker/st_atom_vs.c +++ b/src/mesa/state_tracker/st_atom_vs.c @@ -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 ); |