[Mesa-dev] [PATCH] svga: clamp max_lod to number of texture levels

Brian Paul brianp at vmware.com
Tue Feb 28 14:58:26 PST 2012


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
---
 src/gallium/drivers/svga/svga_state_tss.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_state_tss.c b/src/gallium/drivers/svga/svga_state_tss.c
index 8eb0dbf..3692783 100644
--- a/src/gallium/drivers/svga/svga_state_tss.c
+++ b/src/gallium/drivers/svga/svga_state_tss.c
@@ -89,6 +89,7 @@ update_tss_binding(struct svga_context *svga,
          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(max_lod, sv->texture->last_level);
          texture = sv->texture;
       } else {
          min_lod = 0;
-- 
1.7.3.4



More information about the mesa-dev mailing list