summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2015-04-10 14:19:22 -0400
committerRob Clark <[email protected]>2015-04-11 10:43:16 -0400
commit2faa878f13b414d3c6d1e4c3c7642f8db52d9550 (patch)
treef58877a955f9639a54d1095f815c1414c09f910f /src/gallium/auxiliary
parentca3ae90490d1df40d4a27c8a2d3171af528155b2 (diff)
gallium/ttn: fix TXD
With TXD we also have the ddx/ddy sources (before the sampler). Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/nir/tgsi_to_nir.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c
index 9acf0b99220..0e871642b88 100644
--- a/src/gallium/auxiliary/nir/tgsi_to_nir.c
+++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c
@@ -948,7 +948,7 @@ ttn_tex(struct ttn_compile *c, nir_alu_dest dest, nir_ssa_def **src)
struct tgsi_full_instruction *tgsi_inst = &c->token->FullInstruction;
nir_tex_instr *instr;
nir_texop op;
- unsigned num_srcs;
+ unsigned num_srcs, samp = 1;
switch (tgsi_inst->Instruction.Opcode) {
case TGSI_OPCODE_TEX:
@@ -974,6 +974,7 @@ ttn_tex(struct ttn_compile *c, nir_alu_dest dest, nir_ssa_def **src)
case TGSI_OPCODE_TXD:
op = nir_texop_txd;
num_srcs = 3;
+ samp = 3;
break;
default:
@@ -1016,8 +1017,8 @@ ttn_tex(struct ttn_compile *c, nir_alu_dest dest, nir_ssa_def **src)
if (instr->is_array)
instr->coord_components++;
- assert(tgsi_inst->Src[1].Register.File == TGSI_FILE_SAMPLER);
- instr->sampler_index = tgsi_inst->Src[1].Register.Index;
+ assert(tgsi_inst->Src[samp].Register.File == TGSI_FILE_SAMPLER);
+ instr->sampler_index = tgsi_inst->Src[samp].Register.Index;
unsigned src_number = 0;
@@ -1045,6 +1046,19 @@ ttn_tex(struct ttn_compile *c, nir_alu_dest dest, nir_ssa_def **src)
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),
+ instr->coord_components, false));
+ instr->src[src_number].src_type = nir_tex_src_ddx;
+ src_number++;
+ instr->src[src_number].src =
+ nir_src_for_ssa(nir_swizzle(b, src[2], SWIZ(X, Y, Z, W),
+ instr->coord_components, false));
+ instr->src[src_number].src_type = nir_tex_src_ddy;
+ src_number++;
+ }
+
if (instr->is_shadow) {
if (instr->coord_components < 3)
instr->src[src_number].src = nir_src_for_ssa(ttn_channel(b, src[0], Z));