diff options
author | Dave Airlie <[email protected]> | 2014-11-18 09:54:39 +1000 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2014-11-19 00:50:00 +0000 |
commit | c44aa54d2c6a89774e06f13cb46d4afee40c3824 (patch) | |
tree | d33e0ffc32c36d1241d3e1f2ab0a29796ffc2556 | |
parent | 864f604bb1c1746c8ae1222c1dff701e4e3a235a (diff) |
r600g/cayman: fix integer multiplication output overwrite (v2)
This fixes tests/spec/glsl-1.10/execution/fs-op-assign-mult-ivec2-ivec2-overwrite.shader_test.
hopeful fix for fd.o bug 85376
Reported-by: ghallberg
Cc: "10.3 10.4" <[email protected]>
Reviewed-by: Glenn Kennard <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
(cherry picked from commit 4a128d5a16a575faaac969468a3aaafce48504cf)
-rw-r--r-- | src/gallium/drivers/r600/r600_shader.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 3f089b4f7d9..b4673f39bb4 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -2493,8 +2493,10 @@ static int cayman_mul_int_instr(struct r600_shader_ctx *ctx) struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; int i, j, k, r; struct r600_bytecode_alu alu; - int last_slot = (inst->Dst[0].Register.WriteMask & 0x8) ? 4 : 3; - for (k = 0; k < last_slot; k++) { + int lasti = tgsi_last_instruction(inst->Dst[0].Register.WriteMask); + int t1 = ctx->temp_reg; + + for (k = 0; k <= lasti; k++) { if (!(inst->Dst[0].Register.WriteMask & (1 << k))) continue; @@ -2504,7 +2506,8 @@ static int cayman_mul_int_instr(struct r600_shader_ctx *ctx) for (j = 0; j < inst->Instruction.NumSrcRegs; j++) { r600_bytecode_src(&alu.src[j], &ctx->src[j], k); } - tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst); + alu.dst.sel = t1; + alu.dst.chan = i; alu.dst.write = (i == k); if (i == 3) alu.last = 1; @@ -2513,6 +2516,23 @@ static int cayman_mul_int_instr(struct r600_shader_ctx *ctx) return r; } } + + for (i = 0 ; i <= lasti; i++) { + if (!(inst->Dst[0].Register.WriteMask & (1 << i))) + continue; + memset(&alu, 0, sizeof(struct r600_bytecode_alu)); + alu.op = ALU_OP1_MOV; + alu.src[0].sel = t1; + alu.src[0].chan = i; + tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst); + alu.dst.write = 1; + if (i == lasti) + alu.last = 1; + r = r600_bytecode_add_alu(ctx->bc, &alu); + if (r) + return r; + } + return 0; } |