This patch removes PIPE_TEX_FILTER_ANISO.
Anisotropic filtering is enabled if and only if max_anisotropy > 1.0.
Values between 0.0 and 1.0, inclusive, of max_anisotropy are to be
considered equivalent, and meaning to turn off anisotropic filtering.
This approach has the small drawback of eliminating the possibility of
enabling anisotropic filter on either minification or magnification
separately, which Radeon hardware seems to support, is currently
support by Gallium but not exposed to OpenGL. If this is actually
useful it could be handled by splitting max_anisotropy in two values
and adding an appropriate OpenGL extension.
NOTE: some fiddling & reformatting by keithw to get this patch to
apply. Hopefully nothing broken in the process.
static const char *
debug_dump_tex_filter_names[] = {
"PIPE_TEX_FILTER_NEAREST",
- "PIPE_TEX_FILTER_LINEAR",
- "PIPE_TEX_FILTER_ANISO"
+ "PIPE_TEX_FILTER_LINEAR"
};
static const char *
debug_dump_tex_filter_short_names[] = {
"nearest",
- "linear",
- "aniso"
+ "linear"
};
DEFINE_DEBUG_DUMP_CONTINUOUS(tex_filter)
case PIPE_TEX_FILTER_LINEAR:
spu.min_sample_texture_2d[unit] = sample_texture_2d_bilinear;
break;
- case PIPE_TEX_FILTER_ANISO:
- /* fall-through, for now */
case PIPE_TEX_FILTER_NEAREST:
spu.min_sample_texture_2d[unit] = sample_texture_2d_nearest;
break;
case PIPE_TEX_FILTER_LINEAR:
spu.mag_sample_texture_2d[unit] = sample_texture_2d_bilinear;
break;
- case PIPE_TEX_FILTER_ANISO:
- /* fall-through, for now */
case PIPE_TEX_FILTER_NEAREST:
spu.mag_sample_texture_2d[unit] = sample_texture_2d_nearest;
break;
return FILTER_NEAREST;
case PIPE_TEX_FILTER_LINEAR:
return FILTER_LINEAR;
- case PIPE_TEX_FILTER_ANISO:
- return FILTER_ANISOTROPIC;
default:
assert(0);
return FILTER_NEAREST;
minFilt = translate_img_filter( sampler->min_img_filter );
magFilt = translate_img_filter( sampler->mag_img_filter );
+ if (sampler->max_anisotropy > 1.0)
+ minFilt = magFilt = FILTER_ANISOTROPIC;
+
if (sampler->max_anisotropy > 2.0) {
cso->state[0] |= SS2_MAX_ANISO_4;
}
return BRW_MAPFILTER_NEAREST;
case PIPE_TEX_FILTER_LINEAR:
return BRW_MAPFILTER_LINEAR;
- case PIPE_TEX_FILTER_ANISO:
- return BRW_MAPFILTER_ANISOTROPIC;
default:
assert(0);
return BRW_MAPFILTER_NEAREST;
lp_build_sample_2d_nearest_soa(&bld, s, t, width, height, stride, data_ptr, texel);
break;
case PIPE_TEX_FILTER_LINEAR:
- case PIPE_TEX_FILTER_ANISO:
if(lp_format_is_rgba8(bld.format_desc))
lp_build_sample_2d_linear_aos(&bld, s, t, width, height, stride, data_ptr, texel);
else
}
break;
case PIPE_TEX_FILTER_LINEAR:
- case PIPE_TEX_FILTER_ANISO:
{
int x0[4], y0[4], x1[4], y1[4];
float xw[4], yw[4]; /* weights */
}
break;
case PIPE_TEX_FILTER_LINEAR:
- case PIPE_TEX_FILTER_ANISO:
{
int x0[4], x1[4], y0[4], y1[4], z0[4], z1[4];
float xw[4], yw[4], zw[4]; /* interpolation weights */
}
break;
case PIPE_TEX_FILTER_LINEAR:
- case PIPE_TEX_FILTER_ANISO:
{
int x0[4], y0[4], x1[4], y1[4];
float xw[4], yw[4]; /* weights */
(wrap_mode(cso->wrap_r) << 6));
switch (cso->mag_img_filter) {
- case PIPE_TEX_FILTER_ANISO:
case PIPE_TEX_FILTER_LINEAR:
tsc[1] |= NV50TSC_1_1_MAGF_LINEAR;
break;
}
switch (cso->min_img_filter) {
- case PIPE_TEX_FILTER_ANISO:
case PIPE_TEX_FILTER_LINEAR:
tsc[1] |= NV50TSC_1_1_MINF_LINEAR;
break;
sampler->filter0 |= r300_translate_tex_filters(state->min_img_filter,
state->mag_img_filter,
- state->min_mip_filter);
+ state->min_mip_filter,
+ state->max_anisotropy > 1.0);
/* Unfortunately, r300-r500 don't support floating-point mipmap lods. */
/* We must pass these to the emit function to clamp them properly. */
static INLINE uint32_t r300_translate_tex_filters(int min, int mag, int mip)
{
uint32_t retval = 0;
- switch (min) {
+ if (is_anisotropic)
+ retval |= R300_TX_MIN_FILTER_ANISO | R300_TX_MAG_FILTER_ANISO;
+ else {
+ switch (min) {
case PIPE_TEX_FILTER_NEAREST:
retval |= R300_TX_MIN_FILTER_NEAREST;
break;
case PIPE_TEX_FILTER_LINEAR:
retval |= R300_TX_MIN_FILTER_LINEAR;
break;
- case PIPE_TEX_FILTER_ANISO:
- retval |= R300_TX_MIN_FILTER_ANISO;
- break;
default:
debug_printf("r300: Unknown texture filter %d\n", min);
assert(0);
break;
- }
- switch (mag) {
+ }
+ switch (mag) {
case PIPE_TEX_FILTER_NEAREST:
retval |= R300_TX_MAG_FILTER_NEAREST;
break;
case PIPE_TEX_FILTER_LINEAR:
retval |= R300_TX_MAG_FILTER_LINEAR;
break;
- case PIPE_TEX_FILTER_ANISO:
- retval |= R300_TX_MAG_FILTER_ANISO;
- break;
default:
debug_printf("r300: Unknown texture filter %d\n", mag);
assert(0);
break;
+ }
}
switch (mip) {
case PIPE_TEX_MIPFILTER_NONE:
switch (filter) {
case PIPE_TEX_FILTER_NEAREST: return SVGA3D_TEX_FILTER_NEAREST;
case PIPE_TEX_FILTER_LINEAR: return SVGA3D_TEX_FILTER_LINEAR;
- case PIPE_TEX_FILTER_ANISO: return SVGA3D_TEX_FILTER_ANISOTROPIC;
default:
assert(0);
return SVGA3D_TEX_FILTER_NEAREST;
cso->magfilter = translate_img_filter( sampler->mag_img_filter );
cso->minfilter = translate_img_filter( sampler->min_img_filter );
cso->aniso_level = MAX2( (unsigned) sampler->max_anisotropy, 1 );
+ if(cso->aniso_level != 1)
+ cso->magfilter = cso->minfilter = SVGA3D_TEX_FILTER_ANISOTROPIC;
cso->lod_bias = sampler->lod_bias;
cso->addressu = translate_wrap_mode(sampler->wrap_s);
cso->addressv = translate_wrap_mode(sampler->wrap_t);
*/
#define PIPE_TEX_FILTER_NEAREST 0
#define PIPE_TEX_FILTER_LINEAR 1
-#define PIPE_TEX_FILTER_ANISO 2
-
#define PIPE_TEX_COMPARE_NONE 0
#define PIPE_TEX_COMPARE_R_TO_TEXTURE 1
return PIPE_TEX_FILTER_NEAREST;
break;
case VG_IMAGE_QUALITY_BETTER:
- /*return PIPE_TEX_FILTER_ANISO;*/
+ /* possibly use anisotropic filtering */
return PIPE_TEX_FILTER_LINEAR;
break;
default:
sampler->border_color);
sampler->max_anisotropy = texobj->MaxAnisotropy;
- if (sampler->max_anisotropy > 1.0) {
- sampler->min_img_filter = PIPE_TEX_FILTER_ANISO;
- sampler->mag_img_filter = PIPE_TEX_FILTER_ANISO;
- }
/* only care about ARB_shadow, not SGI shadow */
if (texobj->CompareMode == GL_COMPARE_R_TO_TEXTURE) {