summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c52
-rw-r--r--src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h3
-rw-r--r--src/mesa/state_tracker/st_program.c3
3 files changed, 34 insertions, 24 deletions
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);