[Mesa-dev] r300/compiler: Peephole optimizer.

Tom Stellard tstellar at gmail.com
Fri May 14 10:13:53 PDT 2010


On Fri, May 14, 2010 at 02:46:36AM +0200, Marek Olšák wrote:
> Hi Tom,
> 
> your patch helps but glean/texCube still fails here (it doesn't fail on
> master).
>

Oops, I forgot about the non-shader tests.  Here is a patch that
should fix glean/texCube.

-Tom
-------------- next part --------------
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c b/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c
index 73ece66..fd608cc 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c
@@ -82,6 +82,18 @@ static void peephole_scan_read(void * data, struct rc_instruction * inst,
 	if (file != RC_FILE_TEMPORARY || index != s->Mov->U.I.DstReg.Index)
 		return;
 
+	/* These instructions cannot read from the constants file.
+	 * see radeonTransformTEX()
+	 */
+	if(s->Mov->U.I.SrcReg[0].File != RC_FILE_TEMPORARY &&
+			s->Mov->U.I.SrcReg[0].File != RC_FILE_INPUT &&
+				(inst->U.I.Opcode == RC_OPCODE_TEX ||
+				inst->U.I.Opcode == RC_OPCODE_TXB ||
+				inst->U.I.Opcode == RC_OPCODE_TXP ||
+				inst->U.I.Opcode == RC_OPCODE_KIL)){
+		s->Conflict = 1;
+		return;
+	}
 	if ((mask & s->MovMask) == mask) {
 		if (s->SourceClobbered) {
 			s->Conflict = 1;


More information about the mesa-dev mailing list