gallium/ttn: fix TXF
authorRob Clark <robclark@freedesktop.org>
Thu, 16 Apr 2015 19:16:12 +0000 (15:16 -0400)
committerRob Clark <robclark@freedesktop.org>
Fri, 17 Apr 2015 14:34:15 +0000 (10:34 -0400)
There is a level param stashed away in the .w component of the first
src.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/gallium/auxiliary/nir/tgsi_to_nir.c

index 6c8d3fc504b3abcb79486e9287e2bd330fa2612b..59aaf67788848842b3a075319e3ebd5e983f72a2 100644 (file)
@@ -1053,7 +1053,7 @@ ttn_tex(struct ttn_compile *c, nir_alu_dest dest, nir_ssa_def **src)
       break;
    case TGSI_OPCODE_TXF:
       op = nir_texop_txf;
-      num_srcs = 1;
+      num_srcs = 2;
       break;
    case TGSI_OPCODE_TXD:
       op = nir_texop_txd;
@@ -1138,6 +1138,12 @@ 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));
+      instr->src[src_number].src_type = nir_tex_src_lod;
+      src_number++;
+   }
+
    if (tgsi_inst->Instruction.Opcode == TGSI_OPCODE_TXD) {
       instr->src[src_number].src =
          nir_src_for_ssa(nir_swizzle(b, src[1], SWIZ(X, Y, Z, W),