From: Brian Date: Tue, 9 Oct 2007 22:20:00 +0000 (-0600) Subject: Finish up decls for packed fragment program outputs. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=578962d6240252567cb9725a71e9854ad0dc72a0;p=mesa.git Finish up decls for packed fragment program outputs. --- diff --git a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c index 5a1ec3553e3..66b8db07f95 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 cf85eb9c0b1..29e80533690 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 0b14830353c..1c5af7b75fa 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);