[Mesa-dev] [PATCH v6 33/34] nvir/nir: implement load_per_vertex_output

Karol Herbst kherbst at redhat.com
Mon Mar 19 15:44:26 UTC 2018


v4: use smarter getIndirect helper
    use new getSlotAddress helper
v5: use loadFrom helper

Signed-off-by: Karol Herbst <kherbst at redhat.com>
---
 .../drivers/nouveau/codegen/nv50_ir_from_nir.cpp   | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
index bc0127bef84..19086157baa 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
@@ -2005,6 +2005,29 @@ Converter::visit(nir_intrinsic_instr *insn)
       }
       break;
    }
+   case nir_intrinsic_load_per_vertex_output: {
+      const DataType dType = getDType(insn);
+      LValues &newDefs = convert(&insn->dest);
+      Value *indirectVertex;
+      Value *indirectOffset;
+      auto baseVertex = getIndirect(&insn->src[0], 0, &indirectVertex);
+      auto idx = getIndirect(insn, 1, 0, &indirectOffset);
+      Value *vtxBase = nullptr;
+
+      if (indirectVertex)
+         vtxBase = indirectVertex;
+      else
+         vtxBase = loadImm(nullptr, baseVertex);
+
+      vtxBase = mkOp2v(OP_ADD, TYPE_U32, getSSA(4, FILE_ADDRESS), outBase, vtxBase);
+
+      for (auto i = 0u; i < insn->num_components; ++i) {
+         uint32_t address = getSlotAddress(insn, idx, i);
+         loadFrom(FILE_SHADER_OUTPUT, 0, dType, newDefs[i], address, 0,
+                  indirectOffset, vtxBase, info->in[idx].patch);
+      }
+      break;
+   }
    case nir_intrinsic_emit_vertex:
    case nir_intrinsic_end_primitive: {
       auto idx = nir_intrinsic_stream_id(insn);
-- 
2.14.3



More information about the mesa-dev mailing list