From: Brian Paul Date: Wed, 29 Feb 2012 14:52:18 +0000 (-0700) Subject: svga: fix max_lod clamping in update_tss_binding() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=83fed5e13081f2f5c7156f4f706eabbd6a87c5ae;p=mesa.git 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 --- diff --git a/src/gallium/drivers/svga/svga_state_tss.c b/src/gallium/drivers/svga/svga_state_tss.c index 8eb0dbf4708..d5ed804b0c0 100644 --- a/src/gallium/drivers/svga/svga_state_tss.c +++ b/src/gallium/drivers/svga/svga_state_tss.c @@ -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;