From 578962d6240252567cb9725a71e9854ad0dc72a0 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 9 Oct 2007 16:20:00 -0600 Subject: Finish up decls for packed fragment program outputs. --- src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c | 52 ++++++++++++++++++---------------- src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h | 3 ++ src/mesa/state_tracker/st_program.c | 3 ++ 3 files changed, 34 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c index 5a1ec3553e..66b8db07f9 100644 --- a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c +++ b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c @@ -516,7 +516,10 @@ tgsi_mesa_compile_fp_program( const ubyte inputSemanticName[], const ubyte inputSemanticIndex[], const GLuint interpMode[], + GLuint numOutputs, const GLuint outputMapping[], + const ubyte outputSemanticName[], + const ubyte outputSemanticIndex[], struct tgsi_token *tokens, GLuint maxTokens ) { @@ -580,30 +583,31 @@ tgsi_mesa_compile_fp_program( /* * Declare output attributes. */ - assert( - program->Base.OutputsWritten == - (program->Base.OutputsWritten & ((1 << FRAG_RESULT_COLR) | (1 << FRAG_RESULT_DEPR))) ); - - fulldecl = make_output_decl( - 0, - TGSI_SEMANTIC_POSITION, 0, /* Z / Depth */ - TGSI_WRITEMASK_Z ); - ti += tgsi_build_full_declaration( - &fulldecl, - &tokens[ti], - header, - maxTokens - ti ); - - if( program->Base.OutputsWritten & (1 << FRAG_RESULT_COLR) ) { - fulldecl = make_output_decl( - 1, - TGSI_SEMANTIC_COLOR, 0, - TGSI_WRITEMASK_XYZW ); - ti += tgsi_build_full_declaration( - &fulldecl, - &tokens[ti], - header, - maxTokens - ti ); + for (i = 0; i < numOutputs; i++) { + switch (outputSemanticName[i]) { + case TGSI_SEMANTIC_POSITION: + fulldecl = make_output_decl(i, + TGSI_SEMANTIC_POSITION, 0, /* Z / Depth */ + TGSI_WRITEMASK_Z ); + ti += tgsi_build_full_declaration( + &fulldecl, + &tokens[ti], + header, + maxTokens - ti ); + break; + case TGSI_SEMANTIC_COLOR: + fulldecl = make_output_decl(i, + TGSI_SEMANTIC_COLOR, 0, + TGSI_WRITEMASK_XYZW ); + ti += tgsi_build_full_declaration( + &fulldecl, + &tokens[ti], + header, + maxTokens - ti ); + break; + default: + abort(); + } } /* diff --git a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h index cf85eb9c0b..29e8053369 100644 --- a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h +++ b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h @@ -15,7 +15,10 @@ tgsi_mesa_compile_fp_program( const ubyte inputSemanticName[], const ubyte inputSemanticIndex[], const GLuint interpMode[], + 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_program.c b/src/mesa/state_tracker/st_program.c index 0b14830353..1c5af7b75f 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -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); -- cgit v1.2.3