[Mesa-dev] [PATCH v2 17/31] nvir/nir: implement nir_intrinsic_load_uniform
Karol Herbst
kherbst at redhat.com
Thu Jan 4 15:02:03 UTC 2018
v2: use new getIndirect helper
fixes symbols for 64 bit types
Signed-off-by: Karol Herbst <kherbst at redhat.com>
---
src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp | 16 ++++++++++++++++
1 file changed, 16 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 c52688b1c9..9835b916bf 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
@@ -1313,6 +1313,22 @@ bool
Converter::visit(nir_intrinsic_instr *insn)
{
switch (insn->intrinsic) {
+ case nir_intrinsic_load_uniform: {
+ LValues &newDefs = convert(&insn->dest);
+ auto offset = nir_intrinsic_base(insn);
+ const DataType dType = getDType(insn);
+ auto dTypeSize = std::max(4u, typeSizeof(dType));
+ Value *indirect;
+ auto coffset = offset + getIndirect(&insn->src[0], 0, &indirect);
+ if (indirect)
+ // we have to multiply with 16
+ mkOp2(OP_MUL, TYPE_U32, indirect, indirect, loadImm(getScratch(), 16));
+
+ for (auto i = 0; i < insn->num_components; ++i) {
+ mkLoad(dType, newDefs[i], mkSymbol(FILE_MEMORY_CONST, 0, dType, (coffset * 4 + i * (dTypeSize / 4)) * 4), nullptr)->setIndirect(0, 0, indirect);
+ }
+ break;
+ }
default:
ERROR("unknown nir_intrinsic_op %s\n", nir_intrinsic_infos[insn->intrinsic].name);
return false;
--
2.14.3
More information about the mesa-dev
mailing list