From 80d89aa0d28ca987d958c1033eeb7e4a3c10368b Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Fri, 16 Apr 2010 01:59:11 +0200 Subject: r300/compiler: fix repeat wrap mode for TXP and NPOTs No idea why st/mesa unnecessarily inserts TXP where TEX is sufficient. Also re-enabling the NPOT fallback for repeat in r300g. --- src/mesa/drivers/dri/r300/compiler/r500_fragprog.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'src/mesa/drivers/dri') diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c index 295e455d90..0caff487b0 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c @@ -200,12 +200,22 @@ int r500_transform_TEX( } if (wrapmode == RC_WRAP_REPEAT) { - inst_rect = rc_insert_new_instruction(c, inst->Prev); - - inst_rect->U.I.Opcode = RC_OPCODE_FRC; - inst_rect->U.I.DstReg.File = RC_FILE_TEMPORARY; - inst_rect->U.I.DstReg.Index = temp; - inst_rect->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; + /* Both instructions will be paired up. */ + struct rc_instruction *inst_frc = rc_insert_new_instruction(c, inst->Prev); + struct rc_instruction *inst_mov = rc_insert_new_instruction(c, inst_frc); + + inst_frc->U.I.Opcode = RC_OPCODE_FRC; + inst_frc->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_frc->U.I.DstReg.Index = temp; + inst_frc->U.I.DstReg.WriteMask = RC_MASK_XYZ; + inst_frc->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; + + /* Preserve W for TXP. */ + inst_mov->U.I.Opcode = RC_OPCODE_MOV; + inst_mov->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_mov->U.I.DstReg.Index = temp; + inst_mov->U.I.DstReg.WriteMask = RC_MASK_W; + inst_mov->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; reset_srcreg(&inst->U.I.SrcReg[0]); inst->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; -- cgit v1.2.3