- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = (r200ContextPtr) driContextPriv->driverPrivate;
- r200ContextPtr current = ctx ? R200_CONTEXT(ctx) : NULL;
-
- /* check if we're deleting the currently bound context */
- if (rmesa == current) {
- radeon_firevertices(&rmesa->radeon);
- _mesa_make_current(NULL, NULL, NULL);
- }
-
- /* Free r200 context resources */
- assert(rmesa); /* should never be null */
- if ( rmesa ) {
- GLboolean release_texture_heaps;
-
-
- release_texture_heaps = (rmesa->radeon.glCtx->Shared->RefCount == 1);
- _swsetup_DestroyContext( rmesa->radeon.glCtx );
- _tnl_DestroyContext( rmesa->radeon.glCtx );
- _vbo_DestroyContext( rmesa->radeon.glCtx );
- _swrast_DestroyContext( rmesa->radeon.glCtx );
-
- r200DestroySwtcl( rmesa->radeon.glCtx );
- r200ReleaseArrays( rmesa->radeon.glCtx, ~0 );
-
- if (rmesa->radeon.dma.current) {
- rcommonFlushCmdBuf( &rmesa->radeon, __FUNCTION__ );
- }
-
- if (rmesa->radeon.state.scissor.pClipRects) {
- FREE(rmesa->radeon.state.scissor.pClipRects);
- rmesa->radeon.state.scissor.pClipRects = NULL;
- }
-
-
- if ( release_texture_heaps ) {
- /* This share group is about to go away, free our private
- * texture object data.
- */
- int i;
-
- for ( i = 0 ; i < rmesa->radeon.nr_heaps ; i++ ) {
- driDestroyTextureHeap( rmesa->radeon.texture_heaps[ i ] );
- rmesa->radeon.texture_heaps[ i ] = NULL;
- }
-
- assert( is_empty_list( & rmesa->radeon.swapped ) );
- }
-
- radeonCleanupContext(&rmesa->radeon);
-
- FREE( rmesa );
- }
-}
-
-
-
-/* Force the context `c' to be unbound from its buffer.
- */
-GLboolean
-r200UnbindContext( __DRIcontextPrivate *driContextPriv )
-{
- r200ContextPtr rmesa = (r200ContextPtr) driContextPriv->driverPrivate;
-
- if (R200_DEBUG & DEBUG_DRI)
- fprintf(stderr, "%s ctx %p\n", __FUNCTION__, (void *)rmesa->radeon.glCtx);
-
- return GL_TRUE;