mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 00:00:11 +01:00
Cell: choose bilinear vs. nearest filtering according to sampler state
This commit is contained in:
parent
ca1d2fc5f6
commit
8f924e4df0
5 changed files with 12 additions and 6 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ invalidate_tex_cache(void);
|
|||
|
||||
|
||||
extern uint
|
||||
sample_texture(vector float texcoord);
|
||||
sample_texture_nearest(vector float texcoord);
|
||||
|
||||
|
||||
extern uint
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue