r600g: fix RSQ of negative value on Cayman
authorMarek Olšák <maraeo@gmail.com>
Tue, 25 Sep 2012 15:20:38 +0000 (17:20 +0200)
committerMarek Olšák <maraeo@gmail.com>
Thu, 27 Sep 2012 17:14:44 +0000 (19:14 +0200)
NOTE: This is a candidate for the stable branches.

src/gallium/drivers/r600/r600_shader.c

index 6e475933175c72145dd7010fa1e84074a1898437..7df549ba702cc02fcfcc117834bdca6cbb2c7931 100644 (file)
@@ -1888,6 +1888,11 @@ static int cayman_emit_float_instr(struct r600_shader_ctx *ctx)
                alu.inst = ctx->inst_info->r600_opcode;
                for (j = 0; j < inst->Instruction.NumSrcRegs; j++) {
                        r600_bytecode_src(&alu.src[j], &ctx->src[j], 0);
+
+                       /* RSQ should take the absolute value of src */
+                       if (ctx->inst_info->tgsi_opcode == TGSI_OPCODE_RSQ) {
+                               r600_bytecode_src_set_abs(&alu.src[j]);
+                       }
                }
                tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst);
                alu.dst.write = (inst->Dst[0].Register.WriteMask >> i) & 1;