summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-01-18 10:06:42 -0700
committerBrian Paul <[email protected]>2012-01-18 10:44:05 -0700
commitfd890873b20de553078fc96d977fbd858238c7d9 (patch)
tree92cda60ae8ade079461fce85f0f29489b2d52bfd /src/gallium/drivers/svga
parent5abcd198b8e644c0d97c6766c6707e20fe22f0fb (diff)
svga: fix min/max lod clamping
The interaction between the mipmap lod min/max limits and the texture base/max level limits is kind of tricky. Changing the base level didn't work as expected before. NOTE: This is a candidate for the 8.0 branch. Reviewed-by: José Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/drivers/svga')
-rw-r--r--src/gallium/drivers/svga/svga_state_tss.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gallium/drivers/svga/svga_state_tss.c b/src/gallium/drivers/svga/svga_state_tss.c
index 3015a446fe2..8eb0dbf4708 100644
--- a/src/gallium/drivers/svga/svga_state_tss.c
+++ b/src/gallium/drivers/svga/svga_state_tss.c
@@ -82,12 +82,14 @@ update_tss_binding(struct svga_context *svga,
const struct svga_sampler_state *s = svga->curr.sampler[i];
struct svga_hw_view_state *view = &svga->state.hw_draw.views[i];
struct pipe_resource *texture = NULL;
+ struct pipe_sampler_view *sv = svga->curr.sampler_views[i];
/* get min max lod */
- if (svga->curr.sampler_views[i]) {
- min_lod = MAX2(s->view_min_lod, 0);
- max_lod = MIN2(s->view_max_lod, svga->curr.sampler_views[i]->texture->last_level);
- texture = svga->curr.sampler_views[i]->texture;
+ 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;
+ texture = sv->texture;
} else {
min_lod = 0;
max_lod = 0;