Mesa (master): nvc0/ir: unset s/ r indirect sources before moving everything

Ilia Mirkin imirkin at kemper.freedesktop.org
Thu Jul 10 01:32:44 UTC 2014


Module: Mesa
Branch: master
Commit: 9807a8ddaf3d0b6d8bf8b3e7c0b01cc4c7db4f30
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9807a8ddaf3d0b6d8bf8b3e7c0b01cc4c7db4f30

Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date:   Sun Jul  6 03:06:55 2014 -0400

nvc0/ir: unset s/r indirect sources before moving everything

With the current logic, it's very likely that s/r indirect sources are
right after the "regular" ones. Unset them before moving the texture
arguments over rather than after, as one of those arguments would
likely have assumed one of the s/r positions.

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>

---

 .../nouveau/codegen/nv50_ir_lowering_nvc0.cpp       |   19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
index e6bf1a0..c102bc5 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
@@ -600,14 +600,19 @@ NVC0LoweringPass::handleTEX(TexInstruction *i)
    if (i->tex.target.isArray() || i->tex.rIndirectSrc >= 0 || i->tex.sIndirectSrc >= 0) {
       LValue *src = new_LValue(func, FILE_GPR); // 0xttxsaaaa
 
+      Value *ticRel = i->getIndirectR();
+      Value *tscRel = i->getIndirectS();
+
+      if (ticRel)
+         i->setSrc(i->tex.rIndirectSrc, NULL);
+      if (tscRel)
+         i->setSrc(i->tex.sIndirectSrc, NULL);
+
       Value *arrayIndex = i->tex.target.isArray() ? i->getSrc(lyr) : NULL;
       for (int s = dim; s >= 1; --s)
          i->setSrc(s, i->getSrc(s - 1));
       i->setSrc(0, arrayIndex);
 
-      Value *ticRel = i->getIndirectR();
-      Value *tscRel = i->getIndirectS();
-
       if (arrayIndex) {
          int sat = (i->op == OP_TXF) ? 1 : 0;
          DataType sTy = (i->op == OP_TXF) ? TYPE_U32 : TYPE_F32;
@@ -616,14 +621,10 @@ NVC0LoweringPass::handleTEX(TexInstruction *i)
          bld.loadImm(src, 0);
       }
 
-      if (ticRel) {
-         i->setSrc(i->tex.rIndirectSrc, NULL);
+      if (ticRel)
          bld.mkOp3(OP_INSBF, TYPE_U32, src, ticRel, bld.mkImm(0x0917), src);
-      }
-      if (tscRel) {
-         i->setSrc(i->tex.sIndirectSrc, NULL);
+      if (tscRel)
          bld.mkOp3(OP_INSBF, TYPE_U32, src, tscRel, bld.mkImm(0x0710), src);
-      }
 
       i->setSrc(0, src);
    }




More information about the mesa-commit mailing list