From 9f96c5d619a478a61c809e88ef53e59005471054 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 21 Sep 2007 10:56:32 -0600 Subject: pass vs output semantics to tgsi_mesa_compile_vp_program() to generate output DECs --- src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c | 19 +++++++++++++++++-- src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h | 3 +++ src/mesa/state_tracker/st_atom_vs.c | 7 +++++-- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c index ea6716f1a2..8a3fda2c63 100644 --- a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c +++ b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c @@ -686,7 +686,10 @@ tgsi_mesa_compile_vp_program( const GLuint inputMapping[], const ubyte inputSemanticName[], const ubyte inputSemanticIndex[], + GLuint numOutputs, const GLuint outputMapping[], + const ubyte outputSemanticName[], + const ubyte outputSemanticIndex[], struct tgsi_token *tokens, GLuint maxTokens) { @@ -705,8 +708,7 @@ tgsi_mesa_compile_vp_program( ti = 3; - /* XXX todo: input/output declarations - */ + /* input decls */ for (i = 0; i < numInputs; i++) { struct tgsi_full_declaration fulldecl; fulldecl = make_input_decl(i, @@ -720,6 +722,19 @@ tgsi_mesa_compile_vp_program( maxTokens - ti ); } + /* output decls */ + for (i = 0; i < numOutputs; i++) { + struct tgsi_full_declaration fulldecl; + fulldecl = make_frag_output_decl(i, + outputSemanticName[i], + outputSemanticIndex[i], + TGSI_WRITEMASK_XYZW ); + 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 dc020cefaa..cf85eb9c0b 100644 --- a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h +++ b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h @@ -26,7 +26,10 @@ tgsi_mesa_compile_vp_program( const GLuint inputMapping[], const ubyte inputSemanticName[], const ubyte inputSemanticIndex[], + GLuint numOutputs, const GLuint outputMapping[], + const ubyte outputSemanticName[], + const ubyte outputSemanticIndex[], 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 d9ae0cdfac..c1bcdbe5a1 100644 --- a/src/mesa/state_tracker/st_atom_vs.c +++ b/src/mesa/state_tracker/st_atom_vs.c @@ -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]; -- cgit v1.2.3