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 *
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;
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;
}
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);
}
}
}
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;
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 &&
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;