summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-05-03 17:01:20 -0600
committerBrian Paul <[email protected]>2008-05-03 17:01:20 -0600
commitffde4e03cf178719c06c300939f8f469d7fc5e9c (patch)
tree7e7e70592d9590fe3d060ea690885da7e0c426b9 /src/mesa
parent8e6a3807981bb96bb6747683dbc9f92ae7117dd2 (diff)
gallium: fix some BaseLevel, lastLevel bugs
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/state_tracker/st_atom_sampler.c5
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c5
2 files changed, 7 insertions, 3 deletions
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index 7515bb30cc7..0c22e03883a 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -148,8 +148,9 @@ update_samplers(struct st_context *st)
sampler->normalized_coords = 1;
sampler->lod_bias = st->ctx->Texture.Unit[su].LodBias;
- sampler->min_lod = MAX2(texobj->BaseLevel, texobj->MinLod);
- sampler->max_lod = MIN2(texobj->MaxLevel, texobj->MaxLod);
+ sampler->min_lod = MAX2(0.0f, texobj->MinLod - texobj->BaseLevel);
+ sampler->max_lod = MIN2(texobj->MaxLevel - texobj->BaseLevel,
+ texobj->MaxLod);
sampler->border_color[0] = texobj->BorderColor[RCOMP];
sampler->border_color[1] = texobj->BorderColor[GCOMP];
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 06caa06e776..21c0141ac3c 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -1363,7 +1363,7 @@ calculate_first_last_level(struct st_texture_object *stObj)
}
else {
firstLevel = 0;
- lastLevel = MIN2(tObj->MaxLevel, tObj->Image[0][0]->WidthLog2);
+ lastLevel = MIN2(tObj->MaxLevel, tObj->Image[0][tObj->BaseLevel]->WidthLog2);
}
break;
case GL_TEXTURE_RECTANGLE_NV:
@@ -1488,6 +1488,9 @@ st_finalize_texture(GLcontext *ctx,
st_mesa_format_to_pipe_format(firstImage->base.TexFormat->MesaFormat) ||
stObj->pt->last_level < stObj->lastLevel ||
stObj->pt->cpp != cpp ||
+ stObj->pt->width[0] != firstImage->base.Width2 ||
+ stObj->pt->height[0] != firstImage->base.Height2 ||
+ stObj->pt->depth[0] != firstImage->base.Depth2 ||
stObj->pt->compressed != firstImage->base.IsCompressed)) {
pipe_texture_release(&stObj->pt);
}