gallium: sync up texture/sampler changes with master
authorBrian Paul <brian.paul@tungstengraphics.com>
Tue, 6 May 2008 14:37:28 +0000 (08:37 -0600)
committerBrian Paul <brian.paul@tungstengraphics.com>
Tue, 6 May 2008 14:37:28 +0000 (08:37 -0600)
src/mesa/state_tracker/st_atom_sampler.c
src/mesa/state_tracker/st_cb_texture.c

index 4ce7c41e90beeac830819f4191eb8829d3abdce5..10283d31a19eda552a4e46e56bcc8c36f1b89170 100644 (file)
@@ -150,7 +150,7 @@ update_samplers(struct st_context *st)
             sampler->normalized_coords = 1;
 
          sampler->lod_bias = st->ctx->Texture.Unit[su].LodBias;
-         sampler->min_lod = MAX2(0.0f, texobj->MinLod - texobj->BaseLevel);
+         sampler->min_lod = MAX2(0.0f, texobj->MinLod);
          sampler->max_lod = MIN2(texobj->MaxLevel - texobj->BaseLevel,
                                  texobj->MaxLod);
 
index 1a1ab99f238a81b26a9ab34a67d560b2cb79e96c..a77b16e0ab8779950456d41055a3e636565b66d7 100644 (file)
@@ -1476,17 +1476,19 @@ st_finalize_texture(GLcontext *ctx,
    /* If we already have a gallium texture, check that it matches the texture
     * object's format, target, size, num_levels, etc.
     */
-   if (stObj->pt &&
-       (stObj->pt->target != gl_target_to_pipe(stObj->base.Target) ||
-       stObj->pt->format !=
-       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);
+   if (stObj->pt) {
+      const enum pipe_format fmt =
+         st_mesa_format_to_pipe_format(firstImage->base.TexFormat->MesaFormat);
+      if (stObj->pt->target != gl_target_to_pipe(stObj->base.Target) ||
+          stObj->pt->format != fmt ||
+          stObj->pt->last_level < stObj->lastLevel ||
+          stObj->pt->width[0] != firstImage->base.Width2 ||
+          stObj->pt->height[0] != firstImage->base.Height2 ||
+          stObj->pt->depth[0] != firstImage->base.Depth2 ||
+          stObj->pt->cpp != cpp ||
+          stObj->pt->compressed != firstImage->base.IsCompressed) {
+         pipe_texture_release(&stObj->pt);
+      }
    }
 
    /* May need to create a new gallium texture: