Mesa (master): nvc0/ir: output base for reading is based on laneid

Ilia Mirkin imirkin at kemper.freedesktop.org
Wed Jul 29 13:41:31 UTC 2015


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

Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date:   Wed Jul 29 09:37:14 2015 -0400

nvc0/ir: output base for reading is based on laneid

PFETCH retrieves the address for incoming vertices, not output vertices
in TCS. For output vertices, we must use the laneid as a base.

Fixes barrier piglit test, which was failing for entirely non-barrier
reasons, but rather that it was (a) trying to draw multiple patches and
(b) the incoming patch size was not the same as the outgoing patch size.

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

---

 .../drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp  |   25 ++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
index 88078b1..3c558e9 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
@@ -1296,6 +1296,7 @@ private:
 
    Value *shiftAddress(Value *);
    Value *getVertexBase(int s);
+   Value *getOutputBase(int s);
    DataArray *getArrayForFile(unsigned file, int idx);
    Value *fetchSrc(int s, int c);
    Value *acquireDst(int d, int c);
@@ -1526,6 +1527,28 @@ Converter::getVertexBase(int s)
 }
 
 Value *
+Converter::getOutputBase(int s)
+{
+   assert(s < 5);
+   if (!(vtxBaseValid & (1 << s))) {
+      Value *offset = loadImm(NULL, tgsi.getSrc(s).getIndex(1));
+      if (tgsi.getSrc(s).isIndirect(1))
+         offset = mkOp2v(OP_ADD, TYPE_U32, getSSA(),
+                         fetchSrc(tgsi.getSrc(s).getIndirect(1), 0, NULL),
+                         offset);
+      vtxBaseValid |= 1 << s;
+      vtxBase[s] = mkOp2v(
+         OP_ADD, TYPE_U32, getSSA(),
+         mkOp2v(
+            OP_SUB, TYPE_U32, getSSA(),
+            mkOp1v(OP_RDSV, TYPE_U32, getSSA(), mkSysVal(SV_LANEID, 0)),
+            mkOp1v(OP_RDSV, TYPE_U32, getSSA(), mkSysVal(SV_INVOCATION_ID, 0))),
+         offset);
+   }
+   return vtxBase[s];
+}
+
+Value *
 Converter::fetchSrc(int s, int c)
 {
    Value *res;
@@ -1539,6 +1562,8 @@ Converter::fetchSrc(int s, int c)
    if (src.is2D()) {
       switch (src.getFile()) {
       case TGSI_FILE_OUTPUT:
+         dimRel = getOutputBase(s);
+         break;
       case TGSI_FILE_INPUT:
          dimRel = getVertexBase(s);
          break;




More information about the mesa-commit mailing list