summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGert Wollny <[email protected]>2019-04-24 09:53:56 +0200
committerGert Wollny <[email protected]>2019-05-01 08:40:16 +0200
commitc3df4e0601baa5786787a1c8f2537d635aa1913b (patch)
tree3fb0c1e5e08a4542302e2ad7f305e497bd167f53 /src
parent27bfd57bc72b63fb97e6fcc34348552db344535c (diff)
softpipe: Add support for TGSI_OPCODE_INTERP_OFFSET
Since for this opcode the offsets are given manually the function should actually also work for non-zero offsets, but the related piglits only ever test with offset 0. Accordingly the patch satisfies "fs-interpolateatoffset-*". Signed-off-by: Gert Wollny <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_exec.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 9c219abf01d..8fe46f780ab 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -5205,6 +5205,35 @@ exec_interp_at_sample(struct tgsi_exec_machine *mach,
store_dest(mach, &result[chan], &inst->Dst[0], inst, chan, TGSI_EXEC_DATA_FLOAT);
}
}
+
+
+static void
+exec_interp_at_offset(struct tgsi_exec_machine *mach,
+ const struct tgsi_full_instruction *inst)
+{
+ union tgsi_exec_channel index;
+ union tgsi_exec_channel index2D;
+ union tgsi_exec_channel ofsx;
+ union tgsi_exec_channel ofsy;
+ const struct tgsi_full_src_register *reg = &inst->Src[0];
+
+ assert(reg->Register.File == TGSI_FILE_INPUT);
+
+ get_index_registers(mach, reg, &index, &index2D);
+ unsigned pos = index2D.i[0] * TGSI_EXEC_MAX_INPUT_ATTRIBS + index.i[0];
+
+ fetch_source(mach, &ofsx, &inst->Src[1], TGSI_CHAN_X, TGSI_EXEC_DATA_FLOAT);
+ fetch_source(mach, &ofsy, &inst->Src[1], TGSI_CHAN_Y, TGSI_EXEC_DATA_FLOAT);
+
+ for (int chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
+ if (!(inst->Dst[0].Register.WriteMask & (1 << chan)))
+ continue;
+ union tgsi_exec_channel result;
+ fetch_src_file_channel(mach, TGSI_FILE_INPUT, chan, &index, &index2D, &result);
+ mach->InputSampleOffsetApply[pos](mach, pos, chan, ofsx.f[chan], ofsy.f[chan], &result);
+ store_dest(mach, &result, &inst->Dst[0], inst, chan, TGSI_EXEC_DATA_FLOAT);
+ }
+}
/**
* Execute a TGSI instruction.
* Returns TRUE if a barrier instruction is hit,
@@ -6252,6 +6281,9 @@ exec_instruction(
case TGSI_OPCODE_INTERP_SAMPLE:
exec_interp_at_sample(mach, inst);
break;
+ case TGSI_OPCODE_INTERP_OFFSET:
+ exec_interp_at_offset(mach, inst);
+ break;
default:
assert( 0 );
}