summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2006-03-24 23:43:16 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2006-03-24 23:43:16 +0000
commit1266e633cc09ca36a9416cffb74d4406f1ce0401 (patch)
tree2f559d4e3154d5ed1608c7c14cde821ac511804d
parent86042f53f2811c990a1144d96037329751d379ae (diff)
In i915/i830_update_tex_unit() get the firstImage pointer _after_ we've called
intel_finalize_mipmap_tree(). This fixes a problem where the wrong mipmap level was used when the texture's GL_TEXTURE_BASE_LEVEL value wasn't zero. But this only happened the first time the texture was used. That took a while to track down!
-rw-r--r--src/mesa/drivers/dri/i915/i830_texstate.c7
-rw-r--r--src/mesa/drivers/dri/i915/i915_texstate.c7
2 files changed, 12 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c b/src/mesa/drivers/dri/i915/i830_texstate.c
index 9c8508b574..dc9aca80fa 100644
--- a/src/mesa/drivers/dri/i915/i830_texstate.c
+++ b/src/mesa/drivers/dri/i915/i830_texstate.c
@@ -124,7 +124,7 @@ static GLboolean i830_update_tex_unit( struct intel_context *intel,
struct i830_context *i830 = i830_context(ctx);
struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
struct intel_texture_object *intelObj = intel_texture_object(tObj);
- struct gl_texture_image *firstImage = tObj->Image[0][intelObj->firstLevel];
+ struct gl_texture_image *firstImage;
GLuint *state = i830->state.Tex[unit];
memset(state, 0, sizeof(state));
@@ -132,6 +132,11 @@ static GLboolean i830_update_tex_unit( struct intel_context *intel,
if (!intel_finalize_mipmap_tree(intel, unit))
return GL_FALSE;
+ /* Get first image here, since intelObj->firstLevel will get set in
+ * the intel_finalize_mipmap_tree() call above.
+ */
+ firstImage = tObj->Image[0][intelObj->firstLevel];
+
i830->state.tex_buffer[unit] = intelObj->mt->region->buffer;
i830->state.tex_offset[unit] = intel_miptree_image_offset(intelObj->mt, 0,
intelObj->firstLevel);
diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c
index 6460f87156..19721190f4 100644
--- a/src/mesa/drivers/dri/i915/i915_texstate.c
+++ b/src/mesa/drivers/dri/i915/i915_texstate.c
@@ -118,7 +118,7 @@ static GLboolean i915_update_tex_unit( struct intel_context *intel,
struct i915_context *i915 = i915_context(ctx);
struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
struct intel_texture_object *intelObj = intel_texture_object(tObj);
- struct gl_texture_image *firstImage = tObj->Image[0][intelObj->firstLevel];
+ struct gl_texture_image *firstImage;
GLuint *state = i915->state.Tex[unit];
memset(state, 0, sizeof(state));
@@ -128,6 +128,11 @@ static GLboolean i915_update_tex_unit( struct intel_context *intel,
if (!intel_finalize_mipmap_tree(intel, unit))
return GL_FALSE;
+ /* Get first image here, since intelObj->firstLevel will get set in
+ * the intel_finalize_mipmap_tree() call above.
+ */
+ firstImage = tObj->Image[0][intelObj->firstLevel];
+
/* intel_region_reference(&i915->state.tex_region[unit], */
/* intelObj->mt->region); */