#define TGSI_DEBUG 1\r
\r
/*\r
- * Map mesa register file to SBIR register file.\r
+ * Map mesa register file to TGSI register file.\r
*/\r
static GLuint\r
map_register_file(\r
}\r
\r
/**\r
- * Map mesa register file index to SBIR index.\r
+ * Map mesa register file index to TGSI index.\r
* Take special care when processing input and output indices.\r
* \param processor either TGSI_PROCESSOR_FRAGMENT or TGSI_PROCESSOR_VERTEX\r
* \param file one of TGSI_FILE_x\r
}\r
\r
/*\r
- * Map mesa texture target to SBIR texture target.\r
+ * Map mesa texture target to TGSI texture target.\r
*/\r
static GLuint\r
map_texture_target(\r
maxTokens - ti );\r
}\r
\r
+ /*\r
+ * Copy fragment z if the shader does not write it.\r
+ */\r
+ if( !(program->Base.OutputsWritten & (1 << FRAG_RESULT_DEPR)) ) {\r
+ fullinst = tgsi_default_full_instruction();\r
+\r
+ fullinst.Instruction.Opcode = TGSI_OPCODE_MOV;\r
+ fullinst.Instruction.NumDstRegs = 1;\r
+ fullinst.Instruction.NumSrcRegs = 1;\r
+\r
+ fulldst = &fullinst.FullDstRegisters[0];\r
+ fulldst->DstRegister.File = TGSI_FILE_OUTPUT;\r
+ fulldst->DstRegister.Index = 0;\r
+ fulldst->DstRegister.WriteMask = TGSI_WRITEMASK_Z;\r
+\r
+ fullsrc = &fullinst.FullSrcRegisters[0];\r
+ fullsrc->SrcRegister.File = TGSI_FILE_INPUT;\r
+ fullsrc->SrcRegister.Index = 0;\r
+\r
+ ti += tgsi_build_full_instruction(\r
+ &fullinst,\r
+ &tokens[ti],\r
+ header,\r
+ maxTokens - ti );\r
+ preamble_size++;\r
+ }\r
+\r
for( i = 0; i < program->Base.NumInstructions; i++ ) {\r
if( compile_instruction(\r
&program->Base.Instructions[i],\r