From 70fd85172ba6b6af56398cd956fa56bbf345a1bb Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Wed, 31 Jul 2019 17:31:52 -0400 Subject: tgsi_to_nir: add support for TXF_LZ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-By: Timur Kristóf Reviewed-by: Eric Anholt Reviewed-by: Connor Abbott --- src/gallium/auxiliary/nir/tgsi_to_nir.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/gallium/auxiliary') diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c index ca805df8739..9e93f84855e 100644 --- a/src/gallium/auxiliary/nir/tgsi_to_nir.c +++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c @@ -1312,6 +1312,7 @@ ttn_tex(struct ttn_compile *c, nir_alu_dest dest, nir_ssa_def **src) samp = 2; break; case TGSI_OPCODE_TXF: + case TGSI_OPCODE_TXF_LZ: if (tgsi_inst->Texture.Texture == TGSI_TEXTURE_2D_MSAA || tgsi_inst->Texture.Texture == TGSI_TEXTURE_2D_ARRAY_MSAA) { op = nir_texop_txf_ms; @@ -1447,12 +1448,18 @@ ttn_tex(struct ttn_compile *c, nir_alu_dest dest, nir_ssa_def **src) src_number++; } - if (tgsi_inst->Instruction.Opcode == TGSI_OPCODE_TXF) { - instr->src[src_number].src = nir_src_for_ssa(ttn_channel(b, src[0], W)); - if (op == nir_texop_txf_ms) + if (tgsi_inst->Instruction.Opcode == TGSI_OPCODE_TXF || + tgsi_inst->Instruction.Opcode == TGSI_OPCODE_TXF_LZ) { + if (op == nir_texop_txf_ms) { + instr->src[src_number].src = nir_src_for_ssa(ttn_channel(b, src[0], W)); instr->src[src_number].src_type = nir_tex_src_ms_index; - else + } else { + if (tgsi_inst->Instruction.Opcode == TGSI_OPCODE_TXF_LZ) + instr->src[src_number].src = nir_src_for_ssa(nir_imm_int(b, 0)); + else + instr->src[src_number].src = nir_src_for_ssa(ttn_channel(b, src[0], W)); instr->src[src_number].src_type = nir_tex_src_lod; + } src_number++; } @@ -1596,6 +1603,7 @@ static const nir_op op_trans[TGSI_OPCODE_LAST] = { [TGSI_OPCODE_LRP] = 0, [TGSI_OPCODE_SQRT] = nir_op_fsqrt, [TGSI_OPCODE_FRC] = nir_op_ffract, + [TGSI_OPCODE_TXF_LZ] = 0, [TGSI_OPCODE_FLR] = nir_op_ffloor, [TGSI_OPCODE_ROUND] = nir_op_fround_even, [TGSI_OPCODE_EX2] = nir_op_fexp2, @@ -1885,6 +1893,7 @@ ttn_emit_instruction(struct ttn_compile *c) case TGSI_OPCODE_TXL2: case TGSI_OPCODE_TXB2: case TGSI_OPCODE_TXF: + case TGSI_OPCODE_TXF_LZ: case TGSI_OPCODE_TG4: case TGSI_OPCODE_LODQ: ttn_tex(c, dest, src); -- cgit v1.2.3