nvc0/ir: fix images indirect access on Fermi
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Sun, 10 Jul 2016 14:19:46 +0000 (16:19 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 11 Jul 2016 19:01:21 +0000 (21:01 +0200)
This fixes the following piglits:

arb_arrays_of_arrays-basic-imagestore-mixed-const-non-const-uniform-index
arb_arrays_of_arrays-basic-imagestore-mixed-const-non-const-uniform-index2

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: 12.0 <mesa-stable@lists.freedesktop.org>
src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp

index 973577353ce55c1bcf88fbffb4affd590ea94d51..18955eb2e183250b3d7297e55a111af51dee197f 100644 (file)
@@ -2008,6 +2008,13 @@ NVC0LoweringPass::processSurfaceCoordsNVC0(TexInstruction *su)
 
    adjustCoordinatesMS(su);
 
+   if (ind) {
+      Value *ptr;
+      ptr = bld.mkOp2v(OP_ADD, TYPE_U32, bld.getSSA(), ind, bld.mkImm(su->tex.r));
+      ptr = bld.mkOp2v(OP_AND, TYPE_U32, bld.getSSA(), ptr, bld.mkImm(7));
+      su->setIndirectR(ptr);
+   }
+
    // get surface coordinates
    for (c = 0; c < arg; ++c)
       src[c] = su->getSrc(c);