summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-09-24 12:41:14 -0600
committerBrian Paul <[email protected]>2009-09-24 12:41:14 -0600
commitb849c6f1b3b38a68fae32d4dea16dd7431e41b6e (patch)
treef1c3c59b35c4836e052a9b0ac901076018609a9d
parentf0339f502cf96499bc5cac8c0611f76f3fd39461 (diff)
intel: use default array/element buffers in intel_generate_mipmap()
If there happened to be a bound VBO when intel_generate_mipmap() was called we blew up because of a bad vertex array pointer. Fixes regnumonline, bug 23859.
-rw-r--r--src/mesa/drivers/dri/intel/intel_generatemipmap.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_generatemipmap.c b/src/mesa/drivers/dri/intel/intel_generatemipmap.c
index fe986092db6..12059e122ca 100644
--- a/src/mesa/drivers/dri/intel/intel_generatemipmap.c
+++ b/src/mesa/drivers/dri/intel/intel_generatemipmap.c
@@ -125,6 +125,8 @@ intel_generate_mipmap_2d(GLcontext *ctx,
GLuint fb_name;
GLboolean success = GL_FALSE;
struct gl_framebuffer *saved_fbo = NULL;
+ struct gl_buffer_object *saved_array_buffer = NULL;
+ struct gl_buffer_object *saved_element_buffer = NULL;
_mesa_PushAttrib(GL_ENABLE_BIT | GL_TEXTURE_BIT |
GL_CURRENT_BIT | GL_COLOR_BUFFER_BIT |
@@ -133,6 +135,16 @@ intel_generate_mipmap_2d(GLcontext *ctx,
old_active_texture = ctx->Texture.CurrentUnit;
_mesa_reference_framebuffer(&saved_fbo, ctx->DrawBuffer);
+ /* use default array/index buffers */
+ _mesa_reference_buffer_object(ctx, &saved_array_buffer,
+ ctx->Array.ArrayBufferObj);
+ _mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj,
+ ctx->Shared->NullBufferObj);
+ _mesa_reference_buffer_object(ctx, &saved_element_buffer,
+ ctx->Array.ElementArrayBufferObj);
+ _mesa_reference_buffer_object(ctx, &ctx->Array.ElementArrayBufferObj,
+ ctx->Shared->NullBufferObj);
+
_mesa_Disable(GL_POLYGON_STIPPLE);
_mesa_Disable(GL_DEPTH_TEST);
_mesa_Disable(GL_STENCIL_TEST);
@@ -205,6 +217,15 @@ fail:
meta_restore_fragment_program(&intel->meta);
meta_restore_vertex_program(&intel->meta);
+ /* restore array/index buffers */
+ _mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj,
+ saved_array_buffer);
+ _mesa_reference_buffer_object(ctx, &saved_array_buffer, NULL);
+ _mesa_reference_buffer_object(ctx, &ctx->Array.ElementArrayBufferObj,
+ saved_element_buffer);
+ _mesa_reference_buffer_object(ctx, &saved_element_buffer, NULL);
+
+
_mesa_DeleteFramebuffersEXT(1, &fb_name);
_mesa_ActiveTextureARB(GL_TEXTURE0_ARB + old_active_texture);
if (saved_fbo)