nvc0/ir: reset the base offset for indirect images accesses

In presence of an indirect image access, the base offset should be
zeroed because the stride will be computed twice. This is a pretty
rare situation but it can happen when tex.r > 0.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
This commit is contained in:
Samuel Pitoiset 2016-07-05 00:08:03 +02:00
parent cb828b7b18
commit f3b9fff3c3
1 changed files with 4 additions and 2 deletions

View File

@ -1685,7 +1685,7 @@ NVC0LoweringPass::processSurfaceCoordsNVE4(TexInstruction *su)
const int idx = su->tex.r;
const int dim = su->tex.target.getDim();
const int arg = dim + (su->tex.target.isArray() || su->tex.target.isCube());
const uint16_t base = idx * NVE4_SU_INFO__STRIDE;
uint16_t base = idx * NVE4_SU_INFO__STRIDE;
int c;
Value *zero = bld.mkImm(0);
Value *p1 = NULL;
@ -1712,6 +1712,7 @@ NVC0LoweringPass::processSurfaceCoordsNVE4(TexInstruction *su)
}
ind = bld.mkOp2v(OP_AND, TYPE_U32, bld.getSSA(), ind, bld.mkImm(7));
ind = bld.mkOp2v(OP_SHL, TYPE_U32, bld.getSSA(), ind, bld.mkImm(6));
base = 0;
}
// calculate clamped coordinates
@ -2049,7 +2050,7 @@ NVC0LoweringPass::processSurfaceCoordsNVC0(TexInstruction *su)
const int idx = su->tex.r;
const int dim = su->tex.target.getDim();
const int arg = dim + (su->tex.target.isArray() || su->tex.target.isCube());
const uint16_t base = idx * NVE4_SU_INFO__STRIDE;
uint16_t base = idx * NVE4_SU_INFO__STRIDE;
int c;
Value *zero = bld.mkImm(0);
Value *src[3];
@ -2068,6 +2069,7 @@ NVC0LoweringPass::processSurfaceCoordsNVC0(TexInstruction *su)
}
ind = bld.mkOp2v(OP_AND, TYPE_U32, bld.getSSA(), ind, bld.mkImm(7));
ind = bld.mkOp2v(OP_SHL, TYPE_U32, bld.getSSA(), ind, bld.mkImm(6));
base = 0;
}
// get surface coordinates