[Mesa-dev] [PATCH v7 30/35] nvir/nir: implement nir_intrinsic_load_ubo

Karol Herbst kherbst at redhat.com
Mon Apr 16 13:26:10 UTC 2018


v4: use loadFrom helper

Signed-off-by: Karol Herbst <kherbst at redhat.com>
---
 src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp | 14 ++++++++++++++
 1 file changed, 14 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 618b9ccfcc4..d65754ec4f6 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
@@ -1938,6 +1938,20 @@ Converter::visit(nir_intrinsic_instr *insn)
       mkOp1(getOperation(op), TYPE_U32, NULL, mkImm(idx))->fixed = 1;
       break;
    }
+   case nir_intrinsic_load_ubo: {
+      const DataType dType = getDType(insn);
+      LValues &newDefs = convert(&insn->dest);
+      Value *indirectIndex;
+      Value *indirectOffset;
+      uint32_t index = getIndirect(&insn->src[0], 0, indirectIndex) + 1;
+      uint32_t offset = getIndirect(&insn->src[1], 0, indirectOffset);
+
+      for (auto i = 0u; i < insn->num_components; ++i) {
+         loadFrom(FILE_MEMORY_CONST, index, dType, newDefs[i], offset, i,
+                  indirectOffset, indirectIndex);
+      }
+      break;
+   }
    default:
       ERROR("unknown nir_intrinsic_op %s\n", nir_intrinsic_infos[op].name);
       return false;
-- 
2.14.3



More information about the mesa-dev mailing list