summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/nir
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2019-07-31 17:31:52 -0400
committerMarek Olšák <[email protected]>2019-08-12 14:52:17 -0400
commit70fd85172ba6b6af56398cd956fa56bbf345a1bb (patch)
tree51f25effafe9c3381f10467923fe90cc17ffd830 /src/gallium/auxiliary/nir
parent028dbd35bab1b9dba6911f3bf9b3a02a87e176ac (diff)
tgsi_to_nir: add support for TXF_LZ
Reviewed-By: Timur Kristóf <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/nir')
-rw-r--r--src/gallium/auxiliary/nir/tgsi_to_nir.c17
1 files changed, 13 insertions, 4 deletions
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);