diff options
author | Karol Herbst <[email protected]> | 2019-01-31 12:33:03 +0100 |
---|---|---|
committer | Karol Herbst <[email protected]> | 2019-07-10 13:22:40 +0200 |
commit | 33a9b9fce5a660f19a7a79b34bb414f264abd49b (patch) | |
tree | 79360f32743917008bce2ac338e4b5985e3e1eda /src | |
parent | 2617c78fe298cebe85bec701c3b6a703ff3fbd60 (diff) |
nv50/ir/nir: handle kernel inputs
required by OpenCL
Signed-off-by: Karol Herbst <[email protected]>
Reviewed-by: Pierre Moreau <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
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 81956334c98..68d851f3ac9 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp @@ -96,7 +96,10 @@ private: // If the found value has not a constant part, the Value gets returned // through the Value parameter. uint32_t getIndirect(nir_src *, uint8_t, Value *&); - uint32_t getIndirect(nir_intrinsic_instr *, uint8_t s, uint8_t c, Value *&); + // isScalar indicates that the addressing is scalar, vec4 addressing is + // assumed otherwise + uint32_t getIndirect(nir_intrinsic_instr *, uint8_t s, uint8_t c, Value *&, + bool isScalar = false); uint32_t getSlotAddress(nir_intrinsic_instr *, uint8_t idx, uint8_t slot); @@ -785,10 +788,10 @@ Converter::getIndirect(nir_src *src, uint8_t idx, Value *&indirect) } uint32_t -Converter::getIndirect(nir_intrinsic_instr *insn, uint8_t s, uint8_t c, Value *&indirect) +Converter::getIndirect(nir_intrinsic_instr *insn, uint8_t s, uint8_t c, Value *&indirect, bool isScalar) { int32_t idx = nir_intrinsic_base(insn) + getIndirect(&insn->src[s], c, indirect); - if (indirect) + if (indirect && !isScalar) indirect = mkOp2v(OP_SHL, TYPE_U32, getSSA(4, FILE_ADDRESS), indirect, loadImm(NULL, 4)); return idx; } @@ -2055,6 +2058,18 @@ Converter::visit(nir_intrinsic_instr *insn) } break; } + case nir_intrinsic_load_kernel_input: { + assert(prog->getType() == Program::TYPE_COMPUTE); + assert(insn->num_components == 1); + + LValues &newDefs = convert(&insn->dest); + const DataType dType = getDType(insn); + Value *indirect; + uint32_t idx = getIndirect(insn, 0, 0, indirect, true); + + mkLoad(dType, newDefs[0], mkSymbol(FILE_SHADER_INPUT, 0, dType, idx), indirect); + break; + } case nir_intrinsic_load_barycentric_at_offset: case nir_intrinsic_load_barycentric_at_sample: case nir_intrinsic_load_barycentric_centroid: |