diff options
author | Tilman Sauerbeck <[email protected]> | 2006-06-29 18:36:51 +0000 |
---|---|---|
committer | Tilman Sauerbeck <[email protected]> | 2006-06-29 18:36:51 +0000 |
commit | f7f5b2c41516b11204ff2f253a822b3ac35dcbe0 (patch) | |
tree | 7330e5c3ca040bf8e9b3b37d5ea7957bc6413f0f /src | |
parent | ff3a5b1842bf26783a487674c5ff4cb40f405f25 (diff) |
destroy left-over VBOs on shutdown
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_context.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/radeon_context.c | 6 | ||||
-rw-r--r-- | src/mesa/main/context.c | 14 |
3 files changed, 25 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index d7f027dcb82..4dd1e8b5014 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -385,8 +385,12 @@ static void r300FreeGartAllocations(r300ContextPtr r300) if (r300->rmm->u_list[i].ptr == NULL) { continue; } - - assert(r300->rmm->u_list[i].pending); + + /* check whether this buffer is still in use */ + if (!r300->rmm->u_list[i].pending) { + continue; + } + assert(r300->rmm->u_list[i].h_pending == 0); tries = 0; diff --git a/src/mesa/drivers/dri/r300/radeon_context.c b/src/mesa/drivers/dri/r300/radeon_context.c index 4172fbcf834..5de16104f0a 100644 --- a/src/mesa/drivers/dri/r300/radeon_context.c +++ b/src/mesa/drivers/dri/r300/radeon_context.c @@ -202,9 +202,13 @@ GLboolean radeonInitContext(radeonContextPtr radeon, void radeonCleanupContext(radeonContextPtr radeon) { /* free the Mesa context */ - radeon->glCtx->DriverCtx = NULL; _mesa_destroy_context(radeon->glCtx); + /* the above call might result in calls to functions that depend on + * the DriverCtx. + */ + radeon->glCtx->DriverCtx = NULL; + if (radeon->state.scissor.pClipRects) { FREE(radeon->state.scissor.pClipRects); radeon->state.scissor.pClipRects = 0; diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 08020dbac88..40112ff8283 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -888,6 +888,20 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) #endif #if FEATURE_ARB_vertex_buffer_object + /* Free vertex buffer objects */ + while (1) { + GLuint name = _mesa_HashFirstEntry(ss->BufferObjects); + if (name) { + struct gl_buffer_object *bufObj = (struct gl_buffer_object *) + _mesa_HashLookup(ss->BufferObjects, name); + ASSERT(bufObj); + ctx->Driver.DeleteBuffer(ctx, bufObj); + _mesa_HashRemove(ss->BufferObjects, name); + } + else { + break; + } + } _mesa_DeleteHashTable(ss->BufferObjects); #endif |