diff --git a/src/gallium/drivers/v3d/v3dx_emit.c b/src/gallium/drivers/v3d/v3dx_emit.c index 32f3010c71c..04eb27618e7 100644 --- a/src/gallium/drivers/v3d/v3dx_emit.c +++ b/src/gallium/drivers/v3d/v3dx_emit.c @@ -177,7 +177,8 @@ emit_one_texture(struct v3d_context *v3d, struct v3d_texture_stateobj *stage_tex MAX2(psampler->min_lod, 0), psview->u.tex.last_level), .max_level_of_detail = MIN2(psview->u.tex.first_level + - psampler->max_lod, + MAX2(psampler->max_lod, + psampler->min_lod), psview->u.tex.last_level), .texture_base_pointer = cl_address(rsc->bo, diff --git a/src/gallium/drivers/v3d/v3dx_state.c b/src/gallium/drivers/v3d/v3dx_state.c index e9033d250d7..4c553988b8b 100644 --- a/src/gallium/drivers/v3d/v3dx_state.c +++ b/src/gallium/drivers/v3d/v3dx_state.c @@ -550,7 +550,8 @@ v3d_upload_sampler_state_variant(void *map, sampler.min_level_of_detail = MIN2(MAX2(0, cso->min_lod), 15); - sampler.max_level_of_detail = MIN2(cso->max_lod, 15); + sampler.max_level_of_detail = MIN2(MAX2(cso->max_lod, + cso->min_lod), 15); /* If we're not doing inter-miplevel filtering, we need to * clamp the LOD so that we only sample from baselevel. diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c index 5a49b06bc1a..9f1b2fd72f6 100644 --- a/src/mesa/state_tracker/st_atom_sampler.c +++ b/src/mesa/state_tracker/st_atom_sampler.c @@ -169,15 +169,6 @@ st_convert_sampler(const struct st_context *st, sampler->min_lod = MAX2(msamp->Attrib.MinLod, 0.0f); sampler->max_lod = msamp->Attrib.MaxLod; - if (sampler->max_lod < sampler->min_lod) { - /* The GL spec doesn't seem to specify what to do in this case. - * Swap the values. - */ - float tmp = sampler->max_lod; - sampler->max_lod = sampler->min_lod; - sampler->min_lod = tmp; - assert(sampler->min_lod <= sampler->max_lod); - } /* Check that only wrap modes using the border color have the first bit * set.