summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/softpipe
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2011-08-26 10:59:18 +0100
committerDave Airlie <[email protected]>2011-09-02 10:47:45 +0100
commit2083a276eb270b748d1c2668eb9faa5aadc8e700 (patch)
treefa03d01ecdba21bab656cf5e9f274ee2b0db7f83 /src/gallium/drivers/softpipe
parent49e24d3b8c0129e11fcc94b6e74dc2589d64c882 (diff)
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 <[email protected]> Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/drivers/softpipe')
-rw-r--r--src/gallium/drivers/softpipe/sp_tex_sample.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c
index 89c6536b1f4..dd33a10a1a6 100644
--- a/src/gallium/drivers/softpipe/sp_tex_sample.c
+++ b/src/gallium/drivers/softpipe/sp_tex_sample.c
@@ -2614,6 +2614,7 @@ sample_get_texels(struct tgsi_sampler *tgsi_sampler,
const int v_j[QUAD_SIZE],
const int v_k[QUAD_SIZE],
const int lod[QUAD_SIZE],
+ const int8_t offset[3],
float rgba[NUM_CHANNELS][QUAD_SIZE])
{
const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
@@ -2629,7 +2630,7 @@ sample_get_texels(struct tgsi_sampler *tgsi_sampler,
switch(texture->target) {
case PIPE_TEXTURE_1D:
for (j = 0; j < QUAD_SIZE; j++) {
- tx = get_texel_2d(samp, addr, v_i[j], 0);
+ tx = get_texel_2d(samp, addr, v_i[j] + offset[0], 0);
for (c = 0; c < 4; c++) {
rgba[c][j] = tx[c];
}
@@ -2637,7 +2638,8 @@ sample_get_texels(struct tgsi_sampler *tgsi_sampler,
break;
case PIPE_TEXTURE_1D_ARRAY:
for (j = 0; j < QUAD_SIZE; j++) {
- tx = get_texel_1d_array(samp, addr, v_i[j], v_j[j]);
+ tx = get_texel_1d_array(samp, addr, v_i[j] + offset[0],
+ v_j[j] + offset[1]);
for (c = 0; c < 4; c++) {
rgba[c][j] = tx[c];
}
@@ -2646,7 +2648,8 @@ sample_get_texels(struct tgsi_sampler *tgsi_sampler,
case PIPE_TEXTURE_2D:
case PIPE_TEXTURE_RECT:
for (j = 0; j < QUAD_SIZE; j++) {
- tx = get_texel_2d(samp, addr, v_i[j], v_j[j]);
+ tx = get_texel_2d(samp, addr, v_i[j] + offset[0],
+ v_j[j] + offset[1]);
for (c = 0; c < 4; c++) {
rgba[c][j] = tx[c];
}
@@ -2654,7 +2657,9 @@ sample_get_texels(struct tgsi_sampler *tgsi_sampler,
break;
case PIPE_TEXTURE_2D_ARRAY:
for (j = 0; j < QUAD_SIZE; j++) {
- tx = get_texel_2d_array(samp, addr, v_i[j], v_j[j], v_k[j]);
+ tx = get_texel_2d_array(samp, addr, v_i[j] + offset[0],
+ v_j[j] + offset[1],
+ v_k[j] + offset[2]);
for (c = 0; c < 4; c++) {
rgba[c][j] = tx[c];
}
@@ -2662,7 +2667,9 @@ sample_get_texels(struct tgsi_sampler *tgsi_sampler,
break;
case PIPE_TEXTURE_3D:
for (j = 0; j < QUAD_SIZE; j++) {
- tx = get_texel_3d(samp, addr, v_i[j], v_j[j], v_k[j]);
+ tx = get_texel_3d(samp, addr, v_i[j] + offset[0],
+ v_j[j] + offset[1],
+ v_k[j] + offset[2]);
for (c = 0; c < 4; c++) {
rgba[c][j] = tx[c];
}