svga: fix max_lod clamping in update_tss_binding()

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>
This commit is contained in:
Brian Paul 2012-02-29 07:52:18 -07:00
parent fce888a706
commit 83fed5e130
1 changed files with 2 additions and 2 deletions

View File

@ -87,8 +87,8 @@ update_tss_binding(struct svga_context *svga,
/* 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;