r200: Prevent TexGenMatrix from leaking when destroying r200 context.
authorPauli Nieminen <suokkos@gmail.com>
Tue, 4 Aug 2009 11:42:20 +0000 (14:42 +0300)
committerAlex Deucher <alexdeucher@gmail.com>
Wed, 12 Aug 2009 19:40:14 +0000 (15:40 -0400)
Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
src/mesa/drivers/dri/r200/r200_context.c
src/mesa/drivers/dri/radeon/radeon_screen.c

index 9a92a3207974b6b313fe245eb7e7b64666951a74..8cb287de26896529b814bf33a2394c7d5812dadf 100644 (file)
@@ -500,3 +500,15 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual,
 }
 
 
+void r200DestroyContext( __DRIcontextPrivate *driContextPriv )
+{
+       int i;
+       r200ContextPtr rmesa = (r200ContextPtr)driContextPriv->driverPrivate;
+       if (rmesa)
+       {
+               for ( i = 0 ; i < R200_MAX_TEXTURE_UNITS ; i++ ) {
+                       _math_matrix_dtr( &rmesa->TexGenMatrix[i] );
+               }
+       }
+       radeonDestroyContext(driContextPriv);
+}
index 507a620e68b1272575aff24966cdd21820af190d..89bb31ea181599cd701710795b952ecc8bb2b7ab 100644 (file)
@@ -1596,11 +1596,6 @@ static GLboolean radeonCreateContext(const __GLcontextModes * glVisual,
                return r300CreateContext(glVisual, driContextPriv, sharedContextPriv);
 #endif
 
-#if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200)
-       if (IS_R200_CLASS(screen))
-               return r200CreateContext(glVisual, driContextPriv, sharedContextPriv);
-#endif
-
 #if !RADEON_COMMON
        (void)screen;
        return r100CreateContext(glVisual, driContextPriv, sharedContextPriv);
@@ -1800,8 +1795,13 @@ getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo )
 const struct __DriverAPIRec driDriverAPI = {
    .InitScreen      = radeonInitScreen,
    .DestroyScreen   = radeonDestroyScreen,
+#if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200)
+   .CreateContext   = r200CreateContext,
+   .DestroyContext  = r200DestroyContext,
+#else
    .CreateContext   = radeonCreateContext,
    .DestroyContext  = radeonDestroyContext,
+#endif
    .CreateBuffer    = radeonCreateBuffer,
    .DestroyBuffer   = radeonDestroyBuffer,
    .SwapBuffers     = radeonSwapBuffers,