Destroy the GL context after driDestroyTextureHeap, because the driver's
[mesa.git] / src / mesa / drivers / dri / r128 / r128_context.c
index c0036c14908ce74ee6a9ed7b692912f02e59896d..6194d128f4bb62977079a498501cecc7749d32de 100644 (file)
@@ -69,9 +69,11 @@ int R128_DEBUG = 0;
 #define need_GL_ARB_multisample
 #define need_GL_ARB_texture_compression
 #define need_GL_EXT_blend_minmax
+#define need_GL_EXT_fog_coord
+#define need_GL_EXT_secondary_color
 #include "extension_helper.h"
 
-static const struct dri_extension card_extensions[] =
+const struct dri_extension card_extensions[] =
 {
     { "GL_ARB_multisample",                GL_ARB_multisample_functions },
     { "GL_ARB_multitexture",               NULL },
@@ -79,7 +81,10 @@ static const struct dri_extension card_extensions[] =
     { "GL_ARB_texture_env_add",            NULL },
     { "GL_ARB_texture_mirrored_repeat",    NULL },
     { "GL_EXT_blend_subtract",             GL_EXT_blend_minmax_functions },
+    { "GL_EXT_fog_coord",                  GL_EXT_fog_coord_functions },
     { "GL_EXT_texture_edge_clamp",         NULL },
+    { "GL_EXT_secondary_color",            GL_EXT_secondary_color_functions },
+    { "GL_EXT_stencil_wrap",               NULL },
     { "GL_MESA_ycbcr_texture",             NULL },
     { "GL_NV_blend_square",                NULL },
     { "GL_SGIS_generate_mipmap",           NULL },
@@ -205,7 +210,8 @@ GLboolean r128CreateContext( const __GLcontextModes *glVisual,
                                 0,  /* cube textures unsupported. */
                                 0,  /* texture rectangles unsupported. */
                                 11,
-                                GL_FALSE );
+                                GL_FALSE,
+                                0 );
 
    /* No wide points.
     */
@@ -290,10 +296,6 @@ void r128DestroyContext( __DRIcontextPrivate *driContextPriv  )
       _ac_DestroyContext( rmesa->glCtx );
       _swrast_DestroyContext( rmesa->glCtx );
 
-      /* free the Mesa context */
-      rmesa->glCtx->DriverCtx = NULL;
-      _mesa_destroy_context(rmesa->glCtx);
-
       if ( release_texture_heaps ) {
          /* This share group is about to go away, free our private
           * texture object data.
@@ -308,6 +310,10 @@ void r128DestroyContext( __DRIcontextPrivate *driContextPriv  )
         assert( is_empty_list( & rmesa->swapped ) );
       }
 
+      /* free the Mesa context */
+      rmesa->glCtx->DriverCtx = NULL;
+      _mesa_destroy_context(rmesa->glCtx);
+
       /* free the option cache */
       driDestroyOptionCache (&rmesa->optionCache);