diff options
author | Karol Herbst <[email protected]> | 2019-03-24 04:24:39 +0100 |
---|---|---|
committer | Karol Herbst <[email protected]> | 2019-04-12 09:02:59 +0200 |
commit | b286cdedb746a086a217155e41ac8249de9052a8 (patch) | |
tree | 8548218c719c78565827258770d4b29d8078f12e | |
parent | d62d434fe9205915649ed52d53c88df0e16a0fa7 (diff) |
nv50/ir/nir: handle bindless texture
Signed-off-by: Karol Herbst <[email protected]>
-rw-r--r-- | src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp | 20 |
1 files changed, 18 insertions, 2 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 1e4dd15d114..c550238fd31 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp @@ -3111,6 +3111,11 @@ Converter::visit(nir_tex_instr *insn) int projIdx = nir_tex_instr_src_index(insn, nir_tex_src_projector); int sampOffIdx = nir_tex_instr_src_index(insn, nir_tex_src_sampler_offset); int texOffIdx = nir_tex_instr_src_index(insn, nir_tex_src_texture_offset); + int sampHandleIdx = nir_tex_instr_src_index(insn, nir_tex_src_sampler_handle); + int texHandleIdx = nir_tex_instr_src_index(insn, nir_tex_src_texture_handle); + + bool bindless = sampHandleIdx != -1 || texHandleIdx != -1; + assert((sampHandleIdx != -1) == (texHandleIdx != -1)); if (projIdx != -1) proj = mkOp1v(OP_RCP, TYPE_F32, getScratch(), getSrc(&insn->src[projIdx].src, 0)); @@ -3154,9 +3159,19 @@ Converter::visit(nir_tex_instr *insn) srcs.push_back(getSrc(&insn->src[sampOffIdx].src, 0)); sampOffIdx = srcs.size() - 1; } + if (bindless) { + // currently we use the lower bits + Value *split[2]; + Value *handle = getSrc(&insn->src[sampHandleIdx].src, 0); + + mkSplit(split, 4, handle); + + srcs.push_back(split[0]); + texOffIdx = srcs.size() - 1; + } - r = insn->texture_index; - s = insn->sampler_index; + r = bindless ? 0xff : insn->texture_index; + s = bindless ? 0x1f : insn->sampler_index; defs.resize(newDefs.size()); for (uint8_t d = 0u; d < newDefs.size(); ++d) { @@ -3169,6 +3184,7 @@ Converter::visit(nir_tex_instr *insn) TexInstruction *texi = mkTex(op, target.getEnum(), r, s, defs, srcs); texi->tex.levelZero = lz; texi->tex.mask = mask; + texi->tex.bindless = bindless; if (texOffIdx != -1) texi->tex.rIndirectSrc = texOffIdx; |