summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Girlin <[email protected]>2011-07-06 05:29:08 +0400
committerAlex Deucher <[email protected]>2011-07-08 17:21:32 -0400
commit86f8b4117f35c788c8a043c2e241eb19eaacae8c (patch)
tree79fd4ca2bef28b72342513634ea224398a3646a6
parent4df137691ee29bb812347fa2c5f19095243ede22 (diff)
r600g: LIT: swap MUL_LIT operands to fix 0^0
For 0^0 case result of "LOG_CLAMPED ...,0" is -MAX_FLOAT, and then result of "MUL_LIT ...,0,-MAX_FLOAT,..." is -MAX_FLOAT instead of 0 because of special src1 checks for -MAX_FLOAT. So swap src0/1: "MUL_LIT ...,-MAX_FLOAT,0,..." to get expected 0, then result of "EXP_IEEE ...,0" is 1 as expected for LIT. Signed-off-by: Vadim Girlin <[email protected]>
-rw-r--r--src/gallium/drivers/r600/r600_shader.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index f83d7079b29..f3cbf9807fd 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -1388,7 +1388,7 @@ static int tgsi_lit(struct r600_shader_ctx *ctx)
return r;
}
} else {
- /* dst.z = log(src.y) */
+ /* tmp.z = log(src.y) */
memset(&alu, 0, sizeof(struct r600_bc_alu));
alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_CLAMPED);
r600_bc_src(&alu.src[0], &ctx->src[0], 1);
@@ -1404,13 +1404,12 @@ static int tgsi_lit(struct r600_shader_ctx *ctx)
chan = alu.dst.chan;
sel = alu.dst.sel;
- /* tmp.x = amd MUL_LIT(src.w, dst.z, src.x ) */
+ /* tmp.x = amd MUL_LIT(tmp.z, src.w, src.x ) */
memset(&alu, 0, sizeof(struct r600_bc_alu));
alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MUL_LIT);
- r600_bc_src(&alu.src[0], &ctx->src[0], 3);
- alu.src[1].sel = sel;
- alu.src[1].chan = chan;
-
+ alu.src[0].sel = sel;
+ alu.src[0].chan = chan;
+ r600_bc_src(&alu.src[1], &ctx->src[0], 3);
r600_bc_src(&alu.src[2], &ctx->src[0], 0);
alu.dst.sel = ctx->temp_reg;
alu.dst.chan = 0;