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 <vd.kraats@hccnet.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28638>
This commit is contained in:
GKraats
2024-07-14 23:20:00 +02:00
committed by Marge Bot
parent bb95d744ca
commit ad02bfe41d

View File

@@ -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