summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian <[email protected]>2008-02-04 13:23:07 -0700
committerBrian <[email protected]>2008-02-04 13:23:07 -0700
commit8f924e4df06a5d45dda338e7a0a87308e48df57e (patch)
tree5c213a426dddbe138204b65c6e315b44dfe72410 /src
parentca1d2fc5f6fb138025f6848591e3494e4b881930 (diff)
Cell: choose bilinear vs. nearest filtering according to sampler state
Diffstat (limited to 'src')
-rw-r--r--src/mesa/pipe/cell/spu/spu_main.c4
-rw-r--r--src/mesa/pipe/cell/spu/spu_main.h2
-rw-r--r--src/mesa/pipe/cell/spu/spu_texture.c2
-rw-r--r--src/mesa/pipe/cell/spu/spu_texture.h2
-rw-r--r--src/mesa/pipe/cell/spu/spu_tri.c8
5 files changed, 12 insertions, 6 deletions
diff --git a/src/mesa/pipe/cell/spu/spu_main.c b/src/mesa/pipe/cell/spu/spu_main.c
index 412661061ab..48e016fc8b4 100644
--- a/src/mesa/pipe/cell/spu/spu_main.c
+++ b/src/mesa/pipe/cell/spu/spu_main.c
@@ -252,6 +252,10 @@ cmd_state_sampler(const struct pipe_sampler_state *state)
spu.init.id);
memcpy(&spu.sampler[0], state, sizeof(*state));
+ if (spu.sampler[0].min_img_filter == PIPE_TEX_FILTER_LINEAR)
+ spu.sample_texture = sample_texture_bilinear;
+ else
+ spu.sample_texture = sample_texture_nearest;
}
diff --git a/src/mesa/pipe/cell/spu/spu_main.h b/src/mesa/pipe/cell/spu/spu_main.h
index 02b62ee5cd5..fb98b0d8897 100644
--- a/src/mesa/pipe/cell/spu/spu_main.h
+++ b/src/mesa/pipe/cell/spu/spu_main.h
@@ -114,6 +114,8 @@ struct spu_global
vector float tex_size;
vector unsigned int tex_size_mask; /**< == int(size - 1) */
+ uint (*sample_texture)(vector float texcoord);
+
} ALIGN16_ATTRIB;
diff --git a/src/mesa/pipe/cell/spu/spu_texture.c b/src/mesa/pipe/cell/spu/spu_texture.c
index 6e243f7fa3a..ecacf2ec887 100644
--- a/src/mesa/pipe/cell/spu/spu_texture.c
+++ b/src/mesa/pipe/cell/spu/spu_texture.c
@@ -131,7 +131,7 @@ get_tex_tile(vector unsigned int ij)
* XXX this is extremely primitive for now.
*/
uint
-sample_texture(vector float texcoord)
+sample_texture_nearest(vector float texcoord)
{
vector float tc = spu_mul(texcoord, spu.tex_size);
vector unsigned int itc = spu_convtu(tc, 0); /* convert to int */
diff --git a/src/mesa/pipe/cell/spu/spu_texture.h b/src/mesa/pipe/cell/spu/spu_texture.h
index 25cbe9b3c64..0e000bfebfd 100644
--- a/src/mesa/pipe/cell/spu/spu_texture.h
+++ b/src/mesa/pipe/cell/spu/spu_texture.h
@@ -37,7 +37,7 @@ invalidate_tex_cache(void);
extern uint
-sample_texture(vector float texcoord);
+sample_texture_nearest(vector float texcoord);
extern uint
diff --git a/src/mesa/pipe/cell/spu/spu_tri.c b/src/mesa/pipe/cell/spu/spu_tri.c
index c148c75dd61..7b422f71a8d 100644
--- a/src/mesa/pipe/cell/spu/spu_tri.c
+++ b/src/mesa/pipe/cell/spu/spu_tri.c
@@ -309,13 +309,13 @@ emit_quad( int x, int y, mask_t mask )
eval_coeff(2, (float) x, (float) y, texcoords);
if (spu_extract(mask, 0))
- spu.ctile.ui[iy][ix] = sample_texture(texcoords[0].v);
+ spu.ctile.ui[iy][ix] = spu.sample_texture(texcoords[0].v);
if (spu_extract(mask, 1))
- spu.ctile.ui[iy][ix+1] = sample_texture(texcoords[1].v);
+ spu.ctile.ui[iy][ix+1] = spu.sample_texture(texcoords[1].v);
if (spu_extract(mask, 2))
- spu.ctile.ui[iy+1][ix] = sample_texture(texcoords[2].v);
+ spu.ctile.ui[iy+1][ix] = spu.sample_texture(texcoords[2].v);
if (spu_extract(mask, 3))
- spu.ctile.ui[iy+1][ix+1] = sample_texture(texcoords[3].v);
+ spu.ctile.ui[iy+1][ix+1] = spu.sample_texture(texcoords[3].v);
}
else {
/* simple shading */