mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 06:48:06 +02:00
gallium: remove PIPE_TEX_FILTER_ANISO
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.
This commit is contained in:
parent
a6975507ad
commit
f023473748
13 changed files with 17 additions and 36 deletions
|
|
@ -255,15 +255,13 @@ DEFINE_DEBUG_DUMP_CONTINUOUS(tex_mipfilter)
|
|||
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)
|
||||
|
|
|
|||
|
|
@ -405,8 +405,6 @@ cmd_state_sampler(const struct cell_command_sampler *sampler)
|
|||
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;
|
||||
|
|
@ -418,8 +416,6 @@ cmd_state_sampler(const struct cell_command_sampler *sampler)
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -74,8 +74,6 @@ static unsigned translate_img_filter( unsigned filter )
|
|||
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;
|
||||
|
|
@ -221,6 +219,9 @@ i915_create_sampler_state(struct pipe_context *pipe,
|
|||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,8 +48,6 @@ static GLuint translate_img_filter( unsigned filter )
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -577,7 +577,6 @@ lp_build_sample_soa(LLVMBuilderRef builder,
|
|||
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
|
||||
|
|
|
|||
|
|
@ -1131,7 +1131,6 @@ lp_get_samples_2d_common(struct tgsi_sampler *tgsi_sampler,
|
|||
}
|
||||
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 */
|
||||
|
|
@ -1283,7 +1282,6 @@ lp_get_samples_3d(struct tgsi_sampler *tgsi_sampler,
|
|||
}
|
||||
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 */
|
||||
|
|
@ -1414,7 +1412,6 @@ lp_get_samples_rect(struct tgsi_sampler *tgsi_sampler,
|
|||
}
|
||||
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 */
|
||||
|
|
|
|||
|
|
@ -146,7 +146,6 @@ nv50_sampler_state_create(struct pipe_context *pipe,
|
|||
(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;
|
||||
|
|
@ -157,7 +156,6 @@ nv50_sampler_state_create(struct pipe_context *pipe,
|
|||
}
|
||||
|
||||
switch (cso->min_img_filter) {
|
||||
case PIPE_TEX_FILTER_ANISO:
|
||||
case PIPE_TEX_FILTER_LINEAR:
|
||||
tsc[1] |= NV50TSC_1_1_MINF_LINEAR;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -556,7 +556,8 @@ static void*
|
|||
|
||||
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. */
|
||||
|
|
|
|||
|
|
@ -260,35 +260,33 @@ static INLINE uint32_t r300_translate_wrap(int wrap)
|
|||
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:
|
||||
|
|
|
|||
|
|
@ -76,7 +76,6 @@ static INLINE unsigned translate_img_filter( unsigned filter )
|
|||
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;
|
||||
|
|
@ -107,6 +106,8 @@ svga_create_sampler_state(struct pipe_context *pipe,
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -171,8 +171,6 @@ enum pipe_texture_target {
|
|||
*/
|
||||
#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
|
||||
|
|
|
|||
|
|
@ -644,7 +644,7 @@ VGint image_sampler_filter(struct vg_context *ctx)
|
|||
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:
|
||||
|
|
|
|||
|
|
@ -213,10 +213,6 @@ update_samplers(struct st_context *st)
|
|||
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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue