After biasing we need to clamp to be sure we don't exceed the number of
levels in the mipmap. This fixes an assertion at svga_sampler_view.c:70
v2: simplify the biasing, clamping code per Jose's suggestion.
Reviewed-by: José Fonseca <jfonseca@vmware.com>
/* get min max lod */
if (sv) {
min_lod = MAX2(0, (s->view_min_lod + sv->u.tex.first_level));
- max_lod = MIN2(s->view_max_lod, sv->texture->last_level);
- max_lod += sv->u.tex.first_level;
+ max_lod = MIN2(s->view_max_lod + sv->u.tex.first_level,
+ sv->texture->last_level);
texture = sv->texture;
} else {
min_lod = 0;