mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 11:20:11 +01:00
etnaviv: add anisotropic filter support
I have not seen any usage of TEXTURE_FILTER_ANISOTROPIC in the cmd streams from the binary blob. Maybe it gets used on some model/rev combinations. Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2888>
This commit is contained in:
parent
1d4c191572
commit
7aaa0e5908
3 changed files with 8 additions and 2 deletions
|
|
@ -47,6 +47,7 @@ struct etna_sampler_state_desc {
|
|||
uint32_t SAMP_CTRL1;
|
||||
uint32_t SAMP_LOD_MINMAX;
|
||||
uint32_t SAMP_LOD_BIAS;
|
||||
uint32_t SAMP_ANISOTROPY;
|
||||
};
|
||||
|
||||
static inline struct etna_sampler_state_desc *
|
||||
|
|
@ -77,6 +78,7 @@ etna_create_sampler_state_desc(struct pipe_context *pipe,
|
|||
const struct pipe_sampler_state *ss)
|
||||
{
|
||||
struct etna_sampler_state_desc *cs = CALLOC_STRUCT(etna_sampler_state_desc);
|
||||
const bool ansio = ss->max_anisotropy > 1;
|
||||
|
||||
if (!cs)
|
||||
return NULL;
|
||||
|
|
@ -107,6 +109,8 @@ etna_create_sampler_state_desc(struct pipe_context *pipe,
|
|||
cs->SAMP_LOD_BIAS =
|
||||
VIVS_NTE_DESCRIPTOR_SAMP_LOD_BIAS_BIAS(etna_float_to_fixp88(ss->lod_bias)) |
|
||||
COND(ss->lod_bias != 0.0, VIVS_NTE_DESCRIPTOR_SAMP_LOD_BIAS_ENABLE);
|
||||
cs->SAMP_ANISOTROPY =
|
||||
VIVS_NTE_DESCRIPTOR_SAMP_ANISOTROPY(COND(ansio, etna_log2_fixp88(ss->max_anisotropy)));
|
||||
|
||||
return cs;
|
||||
}
|
||||
|
|
@ -298,6 +302,7 @@ etna_emit_texture_desc(struct etna_context *ctx)
|
|||
etna_set_state(stream, VIVS_NTE_DESCRIPTOR_SAMP_CTRL1(x), ss->SAMP_CTRL1 | sv->SAMP_CTRL1);
|
||||
etna_set_state(stream, VIVS_NTE_DESCRIPTOR_SAMP_LOD_MINMAX(x), ss->SAMP_LOD_MINMAX);
|
||||
etna_set_state(stream, VIVS_NTE_DESCRIPTOR_SAMP_LOD_BIAS(x), ss->SAMP_LOD_BIAS);
|
||||
etna_set_state(stream, VIVS_NTE_DESCRIPTOR_SAMP_ANISOTROPY(x), ss->SAMP_ANISOTROPY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ etna_create_sampler_state_state(struct pipe_context *pipe,
|
|||
const struct pipe_sampler_state *ss)
|
||||
{
|
||||
struct etna_sampler_state *cs = CALLOC_STRUCT(etna_sampler_state);
|
||||
const bool ansio = ss->max_anisotropy > 1;
|
||||
|
||||
if (!cs)
|
||||
return NULL;
|
||||
|
|
@ -95,7 +96,8 @@ etna_create_sampler_state_state(struct pipe_context *pipe,
|
|||
VIVS_TE_SAMPLER_CONFIG0_VWRAP(translate_texture_wrapmode(ss->wrap_t)) |
|
||||
VIVS_TE_SAMPLER_CONFIG0_MIN(translate_texture_filter(ss->min_img_filter)) |
|
||||
VIVS_TE_SAMPLER_CONFIG0_MIP(translate_texture_mipfilter(ss->min_mip_filter)) |
|
||||
VIVS_TE_SAMPLER_CONFIG0_MAG(translate_texture_filter(ss->mag_img_filter));
|
||||
VIVS_TE_SAMPLER_CONFIG0_MAG(translate_texture_filter(ss->mag_img_filter)) |
|
||||
VIVS_TE_SAMPLER_CONFIG0_ANISOTROPY(COND(ansio, etna_log2_fixp55(ss->max_anisotropy)));
|
||||
|
||||
/* ROUND_UV improves precision - but not compatible with NEAREST filter */
|
||||
if (ss->min_img_filter != PIPE_TEX_FILTER_NEAREST &&
|
||||
|
|
|
|||
|
|
@ -227,7 +227,6 @@ translate_texture_filter(unsigned filter)
|
|||
return TEXTURE_FILTER_NEAREST;
|
||||
case PIPE_TEX_FILTER_LINEAR:
|
||||
return TEXTURE_FILTER_LINEAR;
|
||||
/* What about anisotropic? */
|
||||
default:
|
||||
DBG("Unhandled texture filter: %i", filter);
|
||||
return ETNA_NO_MATCH;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue