From a849923aea378bcd928581e15267ac8136a46b25 Mon Sep 17 00:00:00 2001 From: Axel Davy Date: Thu, 18 Mar 2021 23:36:28 +0100 Subject: [PATCH] st/nine: Clamp max_anisotropy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GL does the same. Fixes the low texture quality issue of https://github.com/iXit/wine-nine-standalone/issues/21 The are some indications it might not be the native behaviour (which makes sense, the native filtering of states seems more to not update internal states when the passed value is invalid). However it's better visually to have anisotropic filtering enabled in these buggy cases. Signed-off-by: Axel Davy Acked-by: Timur Kristóf Part-of: --- src/gallium/frontends/nine/nine_pipe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/frontends/nine/nine_pipe.c b/src/gallium/frontends/nine/nine_pipe.c index 8f4f11827f5..4792e784a65 100644 --- a/src/gallium/frontends/nine/nine_pipe.c +++ b/src/gallium/frontends/nine/nine_pipe.c @@ -240,7 +240,7 @@ nine_convert_sampler_state(struct cso_context *ctx, int idx, const DWORD *ss) samp.mag_img_filter = (ss[D3DSAMP_MAGFILTER] == D3DTEXF_POINT && !ss[NINED3DSAMP_SHADOW]) ? PIPE_TEX_FILTER_NEAREST : PIPE_TEX_FILTER_LINEAR; if (ss[D3DSAMP_MINFILTER] == D3DTEXF_ANISOTROPIC || ss[D3DSAMP_MAGFILTER] == D3DTEXF_ANISOTROPIC) - samp.max_anisotropy = ss[D3DSAMP_MAXANISOTROPY]; + samp.max_anisotropy = MIN2(16, ss[D3DSAMP_MAXANISOTROPY]); samp.compare_mode = ss[NINED3DSAMP_SHADOW] ? PIPE_TEX_COMPARE_R_TO_TEXTURE : PIPE_TEX_COMPARE_NONE; samp.compare_func = PIPE_FUNC_LEQUAL; samp.normalized_coords = 1;