From 8cc668a4a8d67af21af6883e18fe7423f28999f9 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 13 Aug 2007 15:20:08 -0600 Subject: [PATCH] fix some issues with texture/mipmap_tree state tracking --- src/mesa/state_tracker/st_atom_texture.c | 9 +++++---- src/mesa/state_tracker/st_cb_drawpixels.c | 4 ++-- src/mesa/state_tracker/st_context.h | 1 + 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c index eeaf68b0012..bafd38695f6 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -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); } } diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index cdb9ebc3ff2..7a89e853ee5 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -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); } diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 8ce85cddaaa..8d82d53133f 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -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; -- 2.30.2