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;
}
* 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 */
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 */