r300/compiler: fix the saturate modifier when applied to TEX instructions
authorMarek Olšák <maraeo@gmail.com>
Sat, 12 Mar 2011 05:07:24 +0000 (06:07 +0100)
committerMarek Olšák <maraeo@gmail.com>
Sat, 12 Mar 2011 06:54:23 +0000 (07:54 +0100)
This bug can only be triggered if the source texture is either signed or float.

src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c

index 0403b8bb1f2a8276a7f9c17f780bc44fd34e8f6d..1cf77d9cf735241dc8ec9f7b45ad98ed4004a100 100644 (file)
@@ -425,17 +425,21 @@ int radeonTransformTEX(
                scale_texcoords(compiler, inst, RC_STATE_R300_TEXSCALE_FACTOR);
        }
 
-       /* Cannot write texture to output registers (all chips) or with masks (non-r500) */
+       /* Cannot write texture to output registers or with saturate (all chips),
+        * or with masks (non-r500). */
        if (inst->U.I.Opcode != RC_OPCODE_KIL &&
                (inst->U.I.DstReg.File != RC_FILE_TEMPORARY ||
+                inst->U.I.SaturateMode ||
                 (!c->is_r500 && inst->U.I.DstReg.WriteMask != RC_MASK_XYZW))) {
                struct rc_instruction * inst_mov = rc_insert_new_instruction(c, inst);
 
                inst_mov->U.I.Opcode = RC_OPCODE_MOV;
+               inst_mov->U.I.SaturateMode = inst->U.I.SaturateMode;
                inst_mov->U.I.DstReg = inst->U.I.DstReg;
                inst_mov->U.I.SrcReg[0].File = RC_FILE_TEMPORARY;
                inst_mov->U.I.SrcReg[0].Index = rc_find_free_temporary(c);
 
+               inst->U.I.SaturateMode = 0;
                inst->U.I.DstReg.File = RC_FILE_TEMPORARY;
                inst->U.I.DstReg.Index = inst_mov->U.I.SrcReg[0].Index;
                inst->U.I.DstReg.WriteMask = RC_MASK_XYZW;