Value *s = tex->getSrc(arg - 1);
Value *tx = bld.getSSA(), *ty = bld.getSSA(), *ts = bld.getSSA();
+ Value *ind = NULL;
- Value *ms_x = loadSuInfo32(NULL, base + NVE4_SU_INFO_MS(0));
- Value *ms_y = loadSuInfo32(NULL, base + NVE4_SU_INFO_MS(1));
+ if (tex->tex.rIndirectSrc >= 0) {
+ assert(tex->tex.r == 0);
+ // FIXME: out of bounds
+ ind = bld.mkOp2v(OP_SHL, TYPE_U32, bld.getSSA(),
+ tex->getIndirectR(), bld.mkImm(6));
+ }
+
+ Value *ms_x = loadSuInfo32(ind, base + NVE4_SU_INFO_MS(0));
+ Value *ms_y = loadSuInfo32(ind, base + NVE4_SU_INFO_MS(1));
bld.mkOp2(OP_SHL, TYPE_U32, tx, x, ms_x);
bld.mkOp2(OP_SHL, TYPE_U32, ty, y, ms_y);
Value *src[3];
Value *bf, *eau, *off;
Value *addr, *pred;
+ Value *ind = NULL;
off = bld.getScratch(4);
bf = bld.getScratch(4);
adjustCoordinatesMS(su);
+ if (su->tex.rIndirectSrc >= 0) {
+ // FIXME: out of bounds
+ assert(su->tex.r == 0);
+ ind = bld.mkOp2v(OP_SHL, TYPE_U32, bld.getSSA(),
+ su->getIndirectR(), bld.mkImm(6));
+ }
+
// calculate clamped coordinates
for (c = 0; c < arg; ++c) {
int dimc = c;
src[c] = bld.getScratch();
if (c == 0 && raw)
- v = loadSuInfo32(NULL, base + NVE4_SU_INFO_RAW_X);
+ v = loadSuInfo32(ind, base + NVE4_SU_INFO_RAW_X);
else
- v = loadSuInfo32(NULL, base + NVE4_SU_INFO_DIM(dimc));
+ v = loadSuInfo32(ind, base + NVE4_SU_INFO_DIM(dimc));
bld.mkOp3(OP_SUCLAMP, TYPE_S32, src[c], su->getSrc(c), v, zero)
->subOp = getSuClampSubOp(su, dimc);
}
bld.mkOp2(OP_AND, TYPE_U32, off, src[0], bld.loadImm(NULL, 0xffff));
} else
if (dim == 3) {
- v = loadSuInfo32(NULL, base + NVE4_SU_INFO_UNK1C);
+ v = loadSuInfo32(ind, base + NVE4_SU_INFO_UNK1C);
bld.mkOp3(OP_MADSP, TYPE_U32, off, src[2], v, src[1])
->subOp = NV50_IR_SUBOP_MADSP(4,2,8); // u16l u16l u16l
- v = loadSuInfo32(NULL, base + NVE4_SU_INFO_PITCH);
+ v = loadSuInfo32(ind, base + NVE4_SU_INFO_PITCH);
bld.mkOp3(OP_MADSP, TYPE_U32, off, off, v, src[0])
->subOp = NV50_IR_SUBOP_MADSP(0,2,8); // u32 u16l u16l
} else {
assert(dim == 2);
- v = loadSuInfo32(NULL, base + NVE4_SU_INFO_PITCH);
+ v = loadSuInfo32(ind, base + NVE4_SU_INFO_PITCH);
bld.mkOp3(OP_MADSP, TYPE_U32, off, src[1], v, src[0])
->subOp = (su->tex.target.isArray() || su->tex.target.isCube()) ?
NV50_IR_SUBOP_MADSP_SD : NV50_IR_SUBOP_MADSP(4,2,8); // u16l u16l u16l
if (raw) {
bf = src[0];
} else {
- v = loadSuInfo32(NULL, base + NVE4_SU_INFO_FMT);
+ v = loadSuInfo32(ind, base + NVE4_SU_INFO_FMT);
bld.mkOp3(OP_VSHL, TYPE_U32, bf, src[0], v, zero)
->subOp = NV50_IR_SUBOP_V1(7,6,8|2);
}
case 2:
z = off;
if (!su->tex.target.isArray() && !su->tex.target.isCube()) {
- z = loadSuInfo32(NULL, base + NVE4_SU_INFO_UNK1C);
+ z = loadSuInfo32(ind, base + NVE4_SU_INFO_UNK1C);
subOp = NV50_IR_SUBOP_SUBFM_3D;
}
break;
}
// part 2
- v = loadSuInfo32(NULL, base + NVE4_SU_INFO_ADDR);
+ v = loadSuInfo32(ind, base + NVE4_SU_INFO_ADDR);
if (su->tex.target == TEX_TARGET_BUFFER) {
eau = v;
}
// add array layer offset
if (su->tex.target.isArray() || su->tex.target.isCube()) {
- v = loadSuInfo32(NULL, base + NVE4_SU_INFO_ARRAY);
+ v = loadSuInfo32(ind, base + NVE4_SU_INFO_ARRAY);
if (dim == 1)
bld.mkOp3(OP_MADSP, TYPE_U32, eau, src[1], v, eau)
->subOp = NV50_IR_SUBOP_MADSP(4,0,0); // u16 u24 u32
// let's just set it 0 for raw access and hope it works
v = raw ?
- bld.mkImm(0) : loadSuInfo32(NULL, base + NVE4_SU_INFO_FMT);
+ bld.mkImm(0) : loadSuInfo32(ind, base + NVE4_SU_INFO_FMT);
// get rid of old coordinate sources, make space for fmt info and predicate
su->moveSources(arg, 3 - arg);