nvc0/ir: support 2d constbuf indexing
authorIlia Mirkin <imirkin@alum.mit.edu>
Sun, 6 Jul 2014 06:06:04 +0000 (02:06 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Thu, 24 Jul 2014 12:26:42 +0000 (08:26 -0400)
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp

index cc4808c0010e113d777a15fd9f2b527e7ba66b44..f010767e18ad35b433ab04b8f1826432f6acd07e 100644 (file)
@@ -1610,6 +1610,20 @@ NVC0LoweringPass::visit(Instruction *i)
             i->op = OP_VFETCH;
             assert(prog->getType() != Program::TYPE_FRAGMENT); // INTERP
          }
+      } else if (i->src(0).getFile() == FILE_MEMORY_CONST) {
+         if (i->src(0).isIndirect(1)) {
+            Value *ptr;
+            if (i->src(0).isIndirect(0))
+               ptr = bld.mkOp3v(OP_INSBF, TYPE_U32, bld.getSSA(),
+                                i->getIndirect(0, 1), bld.mkImm(0x1010),
+                                i->getIndirect(0, 0));
+            else
+               ptr = bld.mkOp2v(OP_SHL, TYPE_U32, bld.getSSA(),
+                                i->getIndirect(0, 1), bld.mkImm(16));
+            i->setIndirect(0, 1, NULL);
+            i->setIndirect(0, 0, ptr);
+            i->subOp = NV50_IR_SUBOP_LDC_IS;
+         }
       }
       break;
    case OP_ATOM: