summaryrefslogtreecommitdiff
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2009-05-06 13:58:57 -0700
committerEric Anholt <eric@anholt.net>2009-05-06 20:44:34 -0700
commit156a79f5bd7b3e79f219adf4619ec449a7c0ed1c (patch)
treea9d7717dc2b337db7c20ee4df8bb80ed10a00927 /src/mesa/drivers
parent58544a28ad561d7d9e16deb048443c2d2b5c12d8 (diff)
intel: Unmap buffers if needed at DeleteBuffer time.
This fixes a crash in glean's pbo test, which tripped over the assert when a context was destroyed while a buffer was still mapped (Mesa doesn't call UnmapBuffer in that case). Regression in c6bde8873fbda6d8467600b7491d8543c75b0509
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/intel/intel_buffer_objects.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
index c849e4869e..f6b0d769c6 100644
--- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
@@ -35,6 +35,9 @@
#include "intel_batchbuffer.h"
#include "intel_regions.h"
+static GLboolean
+intel_bufferobj_unmap(GLcontext * ctx,
+ GLenum target, struct gl_buffer_object *obj);
/** Allocates a new dri_bo to store the data for the buffer object. */
static void
@@ -100,7 +103,13 @@ intel_bufferobj_free(GLcontext * ctx, struct gl_buffer_object *obj)
struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
assert(intel_obj);
- assert(!obj->Pointer); /* Mesa should have unmapped it */
+
+ /* Buffer objects are automatically unmapped when deleting according
+ * to the spec, but Mesa doesn't do UnmapBuffer for us at context destroy
+ * (though it does if you call glDeleteBuffers)
+ */
+ if (obj->Pointer)
+ intel_bufferobj_unmap(ctx, 0, obj);
if (intel_obj->region) {
intel_bufferobj_release_region(intel, intel_obj);