summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/tgsi/tgsi_exec.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2011-08-26 10:59:18 +0100
committerDave Airlie <airlied@redhat.com>2011-09-02 10:47:45 +0100
commit2083a276eb270b748d1c2668eb9faa5aadc8e700 (patch)
treefa03d01ecdba21bab656cf5e9f274ee2b0db7f83 /src/gallium/auxiliary/tgsi/tgsi_exec.c
parent49e24d3b8c0129e11fcc94b6e74dc2589d64c882 (diff)
downloadexternal_mesa3d-2083a276eb270b748d1c2668eb9faa5aadc8e700.zip
external_mesa3d-2083a276eb270b748d1c2668eb9faa5aadc8e700.tar.gz
external_mesa3d-2083a276eb270b748d1c2668eb9faa5aadc8e700.tar.bz2
tgsi: add support for texture offsets to the TGSI IR. (v2)
This adds tokens for texture offsets, to store 4 * swizzled vec 3 for use in TXF and other opcodes. It also contains TGSI exec changes for softpipe to use this code, along with GLSL->TGSI support for TXF. v2: add some more comments, add back padding I removed. Signed-off-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src/gallium/auxiliary/tgsi/tgsi_exec.c')
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_exec.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 38dc1ef..fd118c5 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -1929,11 +1929,28 @@ exec_txf(struct tgsi_exec_machine *mach,
const struct tgsi_full_instruction *inst)
{
struct tgsi_sampler *sampler;
- const uint unit = inst->Src[1].Register.Index;
+ const uint unit = inst->Src[2].Register.Index;
union tgsi_exec_channel r[4];
+ union tgsi_exec_channel offset[3];
uint chan;
float rgba[NUM_CHANNELS][QUAD_SIZE];
int j;
+ int8_t offsets[3];
+
+ if (inst->Texture.NumOffsets == 1) {
+ union tgsi_exec_channel index;
+ index.i[0] = index.i[1] = index.i[2] = index.i[3] = inst->TexOffsets[0].Index;
+ fetch_src_file_channel(mach, inst->TexOffsets[0].File,
+ inst->TexOffsets[0].SwizzleX, &index, &ZeroVec, &offset[0]);
+ fetch_src_file_channel(mach, inst->TexOffsets[0].File,
+ inst->TexOffsets[0].SwizzleY, &index, &ZeroVec, &offset[1]);
+ fetch_src_file_channel(mach, inst->TexOffsets[0].File,
+ inst->TexOffsets[0].SwizzleZ, &index, &ZeroVec, &offset[2]);
+ offsets[0] = offset[0].i[0];
+ offsets[1] = offset[1].i[0];
+ offsets[2] = offset[2].i[0];
+ } else
+ offsets[0] = offsets[1] = offsets[2] = 0;
IFETCH(&r[3], 0, CHAN_W);
@@ -1959,7 +1976,8 @@ exec_txf(struct tgsi_exec_machine *mach,
}
sampler = mach->Samplers[unit];
- sampler->get_texel(sampler, r[0].i, r[1].i, r[2].i, r[3].i, rgba);
+ sampler->get_texel(sampler, r[0].i, r[1].i, r[2].i, r[3].i,
+ offsets, rgba);
for (j = 0; j < QUAD_SIZE; j++) {
r[0].f[j] = rgba[0][j];