From ad02bfe41d03370f884107e75154bb100adab34f Mon Sep 17 00:00:00 2001 From: GKraats Date: Sun, 14 Jul 2024 23:20:00 +0200 Subject: [PATCH] i915g: fix max_lod at mipmap-sampling At update_map at i915_state_sampler.c max_lod is no longer set to 1 for npots. This almost totally disabled mipmapping. Max_lod should still be set to 1, but only if it is still 0, because no mipmap-levels are present. According to existing comment at update_map this is needed, to avoid problems at sampling, if MIN_FILTER and MAX_FILTER differ. Cc: mesa-stable Signed-off-by: GKraats Part-of: --- src/gallium/drivers/i915/i915_state_sampler.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/gallium/drivers/i915/i915_state_sampler.c b/src/gallium/drivers/i915/i915_state_sampler.c index c95eab91768..74acbabf45b 100644 --- a/src/gallium/drivers/i915/i915_state_sampler.c +++ b/src/gallium/drivers/i915/i915_state_sampler.c @@ -289,20 +289,8 @@ update_map(struct i915_context *i915, uint32_t unit, int first_level = view->u.tex.first_level; const uint32_t num_levels = pt->last_level - first_level; unsigned max_lod = num_levels * 4; - bool is_npot = (!util_is_power_of_two_or_zero(pt->width0) || - !util_is_power_of_two_or_zero(pt->height0)); uint32_t format, pitch; - /* - * This is a bit messy. i915 doesn't support NPOT with mipmaps, but we can - * still texture from a single level. This is useful to make u_blitter work. - */ - if (is_npot) { - width = u_minify(width, first_level); - height = u_minify(height, first_level); - max_lod = 1; - } - assert(tex); assert(width); assert(height); @@ -323,6 +311,8 @@ update_map(struct i915_context *i915, uint32_t unit, * XXX When min_filter != mag_filter and there's just one mipmap level, * set max_lod = 1 to make sure i915 chooses between min/mag filtering. */ + if (max_lod == 0) + max_lod = 1; /* See note at the top of file */ if (max_lod > (sampler->maxlod >> 2)) @@ -333,10 +323,7 @@ update_map(struct i915_context *i915, uint32_t unit, ((max_lod) << MS4_MAX_LOD_SHIFT) | ((depth - 1) << MS4_VOLUME_DEPTH_SHIFT)); - if (is_npot) - state[2] = i915_texture_offset(tex, first_level, 0); - else - state[2] = 0; + state[2] = 0; } static void