nv50/ir: add support for different sampler and resource index on nve4
[mesa.git] / src / gallium / drivers / nv50 / codegen / nv50_ir.cpp
index 3c05d05b81f871bd2b4d5c9db9054abe233852db..7788e51fd0db4bed555518d13e1ea51b1c3f5370 100644 (file)
@@ -687,6 +687,11 @@ Instruction::moveSources(const int s, const int delta)
    }
    moveSourcesAdjustIndex(predSrc, s, delta);
    moveSourcesAdjustIndex(flagsSrc, s, delta);
+   if (asTex()) {
+      TexInstruction *tex = asTex();
+      moveSourcesAdjustIndex(tex->tex.rIndirectSrc, s, delta);
+      moveSourcesAdjustIndex(tex->tex.sIndirectSrc, s, delta);
+   }
 
    if (delta > 0) {
       --k;
@@ -950,6 +955,28 @@ const struct TexInstruction::Target::Desc TexInstruction::Target::descTable[] =
    { "BUFFER",            1, 1, false, false, false },
 };
 
+void
+TexInstruction::setIndirectR(Value *v)
+{
+   int p = ((tex.rIndirectSrc < 0) && v) ? srcs.size() : tex.rIndirectSrc;
+   if (p >= 0) {
+      tex.rIndirectSrc = p;
+      setSrc(p, v);
+      srcs[p].usedAsPtr = !!v;
+   }
+}
+
+void
+TexInstruction::setIndirectS(Value *v)
+{
+   int p = ((tex.sIndirectSrc < 0) && v) ? srcs.size() : tex.sIndirectSrc;
+   if (p >= 0) {
+      tex.sIndirectSrc = p;
+      setSrc(p, v);
+      srcs[p].usedAsPtr = !!v;
+   }
+}
+
 CmpInstruction::CmpInstruction(Function *fn, operation op)
    : Instruction(fn, op, TYPE_F32)
 {