Emit TEXLD, TEXLDB, and TEXLDL instructions from nir_texop_tex, nir_texop_txb, and nir_texop_txl texture loads, respectively.
Signed-off-by: Philipp Zabel <p.za...@pengutronix.de> Signed-off-by: Michael Tretter <m.tret...@pengutronix.de> --- .../drivers/etnaviv/etnaviv_compiler.c | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler.c b/src/gallium/drivers/etnaviv/etnaviv_compiler.c index f17b9979b705..b2499a7e2f6c 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_compiler.c +++ b/src/gallium/drivers/etnaviv/etnaviv_compiler.c @@ -2186,6 +2186,68 @@ etna_emit_intr(struct etna_compile *c, nir_intrinsic_instr *intr) } } +static void +etna_emit_tex(struct etna_compile *c, nir_tex_instr *instr) +{ + struct etna_inst_dst dst; + struct etna_inst_tex tex; + struct etna_inst_src src; + + dst.use = 1; + dst.amode = 0; + dst.reg = instr->dest.is_ssa ? 0 : instr->dest.reg.reg->index; + /* nir_tex_instr does not support write mask */ + dst.comps = INST_COMPS_X | INST_COMPS_Y | INST_COMPS_Z | INST_COMPS_W; + + assert(!instr->texture); + assert(nir_tex_instr_src_index(instr, nir_tex_src_texture_offset) == -1); + tex.id = instr->texture_index; + tex.amode = 0; + tex.swiz = INST_SWIZ_IDENTITY; + + src.use = 1; + src.reg = instr->src[0].src.is_ssa ? 0 : instr->src[0].src.reg.reg->index; + src.swiz = INST_SWIZ_IDENTITY; + src.neg = 0; + src.abs = 0; + src.amode = 0; + src.rgroup = 0; + + switch (instr->op) { + case nir_texop_tex: + emit_inst(c, &(struct etna_inst) { + .opcode = INST_OPCODE_TEXLD, + .sat = 0, + .dst = dst, + .tex = tex, + .src[0] = src, + }); + break; + case nir_texop_txb: + emit_inst(c, &(struct etna_inst) { + .opcode = INST_OPCODE_TEXLDB, + .sat = 0, + .dst = dst, + .tex = tex, + .src[0] = src, + }); + break; + case nir_texop_txl: + emit_inst(c, &(struct etna_inst) { + .opcode = INST_OPCODE_TEXLDL, + .sat = 0, + .dst = dst, + .tex = tex, + .src[0] = src, + }); + break; + default: + BUG("Unhandled nir_tex_instr: %d\n", instr->op); + assert(0); + break; + } +} + static void etna_emit_instr(struct etna_compile *c, nir_instr *instr) { @@ -2193,6 +2255,9 @@ etna_emit_instr(struct etna_compile *c, nir_instr *instr) case nir_instr_type_alu: etna_emit_alu(c, nir_instr_as_alu(instr)); break; + case nir_instr_type_tex: + etna_emit_tex(c, nir_instr_as_tex(instr)); + break; case nir_instr_type_intrinsic: etna_emit_intr(c, nir_instr_as_intrinsic(instr)); break; -- 2.17.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev