summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/a3xx
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2014-12-02 00:27:09 -0500
committerRob Clark <[email protected]>2014-12-03 09:23:46 -0500
commit79f9a106b90bab7ff305b5f92cb8501d66c497ea (patch)
treebe9573f0583798e51721e036844e351609c4e355 /src/gallium/drivers/freedreno/a3xx
parentb491d1ca6e3681bdcbbb3ca0a8fe14c861fb7273 (diff)
freedreno/a3xx: implement anisotropic filtering
Signed-off-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/a3xx')
-rw-r--r--src/gallium/drivers/freedreno/a3xx/fd3_texture.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_texture.c b/src/gallium/drivers/freedreno/a3xx/fd3_texture.c
index c35f9b339ee..567f6c74aa1 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_texture.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_texture.c
@@ -68,13 +68,13 @@ tex_clamp(unsigned wrap, bool clamp_to_edge)
}
static enum a3xx_tex_filter
-tex_filter(unsigned filter)
+tex_filter(unsigned filter, bool aniso)
{
switch (filter) {
case PIPE_TEX_FILTER_NEAREST:
return A3XX_TEX_NEAREST;
case PIPE_TEX_FILTER_LINEAR:
- return A3XX_TEX_LINEAR;
+ return aniso ? A3XX_TEX_ANISO : A3XX_TEX_LINEAR;
default:
DBG("invalid filter: %u", filter);
return 0;
@@ -86,6 +86,7 @@ fd3_sampler_state_create(struct pipe_context *pctx,
const struct pipe_sampler_state *cso)
{
struct fd3_sampler_stateobj *so = CALLOC_STRUCT(fd3_sampler_stateobj);
+ unsigned aniso = util_last_bit(MIN2(cso->max_anisotropy >> 1, 8));
bool miplinear = false;
bool clamp_to_edge;
@@ -115,8 +116,9 @@ fd3_sampler_state_create(struct pipe_context *pctx,
so->texsamp0 =
COND(!cso->normalized_coords, A3XX_TEX_SAMP_0_UNNORM_COORDS) |
COND(miplinear, A3XX_TEX_SAMP_0_MIPFILTER_LINEAR) |
- A3XX_TEX_SAMP_0_XY_MAG(tex_filter(cso->mag_img_filter)) |
- A3XX_TEX_SAMP_0_XY_MIN(tex_filter(cso->min_img_filter)) |
+ A3XX_TEX_SAMP_0_XY_MAG(tex_filter(cso->mag_img_filter, aniso)) |
+ A3XX_TEX_SAMP_0_XY_MIN(tex_filter(cso->min_img_filter, aniso)) |
+ A3XX_TEX_SAMP_0_ANISO(aniso) |
A3XX_TEX_SAMP_0_WRAP_S(tex_clamp(cso->wrap_s, clamp_to_edge)) |
A3XX_TEX_SAMP_0_WRAP_T(tex_clamp(cso->wrap_t, clamp_to_edge)) |
A3XX_TEX_SAMP_0_WRAP_R(tex_clamp(cso->wrap_r, clamp_to_edge));