fix some issues with texture/mipmap_tree state tracking
authorBrian <brian.paul@tungstengraphics.com>
Mon, 13 Aug 2007 21:20:08 +0000 (15:20 -0600)
committerBrian <brian.paul@tungstengraphics.com>
Mon, 13 Aug 2007 21:20:08 +0000 (15:20 -0600)
src/mesa/state_tracker/st_atom_texture.c
src/mesa/state_tracker/st_cb_drawpixels.c
src/mesa/state_tracker/st_context.h

index eeaf68b001251d6ccdf0e2efb3e38691667a1130..bafd38695f621ff48183c2df02a94a31f04b99f9 100644 (file)
@@ -51,8 +51,8 @@ update_textures(struct st_context *st)
    for (u = 0; u < st->ctx->Const.MaxTextureImageUnits; u++) {
       struct gl_texture_object *texObj
          = st->ctx->Texture.Unit[u]._Current;
+      struct pipe_mipmap_tree *mt;
       if (texObj) {
-         struct pipe_mipmap_tree *mt;
          GLboolean flush, retval;
 
          retval = st_finalize_mipmap_tree(st->ctx, st->pipe, u, &flush);
@@ -60,12 +60,13 @@ update_textures(struct st_context *st)
                 retval, flush);
 
          mt = st_get_texobj_mipmap_tree(texObj);
-
-         st->pipe->set_texture_state(st->pipe, u, mt);
       }
       else {
-         st->pipe->set_texture_state(st->pipe, u, NULL);
+         mt = NULL;
       }
+
+      st->state.texture[u] = mt;
+      st->pipe->set_texture_state(st->pipe, u, mt);
    }
 }
 
index cdb9ebc3ff24aa76ab92f10c624ab8df566752f8..7a89e853ee5a12b12d65a5350d7754086be6bd8c 100644 (file)
@@ -315,8 +315,8 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
    /* restore GL state */
    pipe->set_setup_state(pipe, &ctx->st->state.setup);
    pipe->set_fs_state(pipe, &ctx->st->state.fs);
-   /* XXX FIX: pipe->set_texture_state(pipe, unit, ???); */
-   pipe->set_sampler_state(pipe, unit, &ctx->st->state.sampler[0]);
+   pipe->set_texture_state(pipe, unit, ctx->st->state.texture[unit]);
+   pipe->set_sampler_state(pipe, unit, &ctx->st->state.sampler[unit]);
 
    free_mipmap_tree(pipe, mt);
 }
index 8ce85cddaaacc145346a97e50093669b9c112f35..8d82d53133fa73ae7e10c42fbc884c5dfdf54feb 100644 (file)
@@ -79,6 +79,7 @@ struct st_context
       struct pipe_scissor_state scissor;
       struct pipe_setup_state  setup;
       struct pipe_stencil_state stencil;
+      struct pipe_mipmap_tree *texture[PIPE_MAX_SAMPLERS];
       struct pipe_viewport_state viewport;
    } state;