r500: Redirect TEX writes to output registers
authorNicolai Haehnle <nhaehnle@gmail.com>
Sun, 27 Jul 2008 13:14:07 +0000 (15:14 +0200)
committerNicolai Haehnle <nhaehnle@gmail.com>
Sun, 27 Jul 2008 13:14:07 +0000 (15:14 +0200)
While R500 fragment program texture instructions appear to support writemasks,
they cannot write to the output FIFO immediately, so we need to insert a MOV
for these instructions.

This fixes piglit's fp-fragment-position and fp-incomplete-tex tests.

src/mesa/drivers/dri/r300/r500_fragprog.c

index 7b18efa69d6365f805785e4557f7edc93af6ba6f..c78deab2ace68dfcad9dce19128afe15b9ca37bc 100644 (file)
@@ -74,6 +74,13 @@ static GLboolean transform_TEX(
                inst.DstReg.File = PROGRAM_TEMPORARY;
                inst.DstReg.Index = radeonFindFreeTemporary(t);
                inst.DstReg.WriteMask = WRITEMASK_XYZW;
+       } else if (inst.Opcode != OPCODE_KIL && inst.DstReg.File != PROGRAM_TEMPORARY) {
+               int tempreg = radeonFindFreeTemporary(t);
+
+               inst.DstReg.File = PROGRAM_TEMPORARY;
+               inst.DstReg.Index = tempreg;
+               inst.DstReg.WriteMask = WRITEMASK_XYZW;
+               destredirect = GL_TRUE;
        }
 
        tgt = radeonAppendInstructions(t->Program, 1);