aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe
diff options
context:
space:
mode:
authormichal <michal@michal-laptop.(none)>2007-08-16 12:40:46 +0100
committermichal <michal@michal-laptop.(none)>2007-08-16 12:44:04 +0100
commitcbef86a6ea7fa2901d2a123544591932114ae603 (patch)
treef802f9df9265356a87530184e0fe53059fbd16f5 /src/mesa/pipe
parent59bd1e260bf40e4d2b1662cc4e68eff8235739e4 (diff)
Copy fragment z if the fragment shader does not write depth on its own.`
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r--src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c
index 2ac04e8d56f..2c8deac0346 100644
--- a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c
+++ b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c
@@ -4,7 +4,7 @@
#define TGSI_DEBUG 1
/*
- * Map mesa register file to SBIR register file.
+ * Map mesa register file to TGSI register file.
*/
static GLuint
map_register_file(
@@ -35,7 +35,7 @@ map_register_file(
}
/**
- * Map mesa register file index to SBIR index.
+ * Map mesa register file index to TGSI index.
* Take special care when processing input and output indices.
* \param processor either TGSI_PROCESSOR_FRAGMENT or TGSI_PROCESSOR_VERTEX
* \param file one of TGSI_FILE_x
@@ -101,7 +101,7 @@ map_register_file_index(
}
/*
- * Map mesa texture target to SBIR texture target.
+ * Map mesa texture target to TGSI texture target.
*/
static GLuint
map_texture_target(
@@ -609,6 +609,33 @@ tgsi_mesa_compile_fp_program(
maxTokens - ti );
}
+ /*
+ * Copy fragment z if the shader does not write it.
+ */
+ if( !(program->Base.OutputsWritten & (1 << FRAG_RESULT_DEPR)) ) {
+ fullinst = tgsi_default_full_instruction();
+
+ fullinst.Instruction.Opcode = TGSI_OPCODE_MOV;
+ fullinst.Instruction.NumDstRegs = 1;
+ fullinst.Instruction.NumSrcRegs = 1;
+
+ fulldst = &fullinst.FullDstRegisters[0];
+ fulldst->DstRegister.File = TGSI_FILE_OUTPUT;
+ fulldst->DstRegister.Index = 0;
+ fulldst->DstRegister.WriteMask = TGSI_WRITEMASK_Z;
+
+ fullsrc = &fullinst.FullSrcRegisters[0];
+ fullsrc->SrcRegister.File = TGSI_FILE_INPUT;
+ fullsrc->SrcRegister.Index = 0;
+
+ ti += tgsi_build_full_instruction(
+ &fullinst,
+ &tokens[ti],
+ header,
+ maxTokens - ti );
+ preamble_size++;
+ }
+
for( i = 0; i < program->Base.NumInstructions; i++ ) {
if( compile_instruction(
&program->Base.Instructions[i],