mesa: Branch 'master' - 2 commits

Brian Paul brianp at kemper.freedesktop.org
Sat Apr 14 14:09:18 UTC 2007


 src/mesa/drivers/osmesa/osmesa.c |    9 +++++++--
 src/mesa/main/context.c          |   26 ++------------------------
 2 files changed, 9 insertions(+), 26 deletions(-)

New commits:
diff-tree 216eb81c53908c9ac774a378425691aa66205a88 (from 4fc46a6c82419ec379896a9b9992c3cb6721904f)
Author: Brian <brian at yutani.localnet.net>
Date:   Sat Apr 14 08:09:12 2007 -0600

    set osmesa renderbuffer refcount=1 upon creation, free renderbuffer in OSMesaDestroyContext()

diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c
index 3d7c850..ad8b202 100644
--- a/src/mesa/drivers/osmesa/osmesa.c
+++ b/src/mesa/drivers/osmesa/osmesa.c
@@ -1,8 +1,8 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.5.1
+ * Version:  6.5.3
  *
- * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -1041,6 +1041,7 @@ new_osmesa_renderbuffer(GLcontext *ctx, 
    const GLuint name = 0;
    struct gl_renderbuffer *rb = _mesa_new_renderbuffer(ctx, name);
    if (rb) {
+      rb->RefCount = 1;
       rb->Delete = osmesa_delete_renderbuffer;
       rb->AllocStorage = osmesa_renderbuffer_storage;
 
@@ -1237,6 +1238,7 @@ OSMesaCreateContextExt( GLenum format, G
       /* create front color buffer in user-provided memory (no back buffer) */
       osmesa->rb = new_osmesa_renderbuffer(&osmesa->mesa, format, type);
       _mesa_add_renderbuffer(osmesa->gl_buffer, BUFFER_FRONT_LEFT, osmesa->rb);
+      assert(osmesa->rb->RefCount == 2);
                         
       _mesa_add_soft_renderbuffers(osmesa->gl_buffer,
                                    GL_FALSE, /* color */
@@ -1297,6 +1299,9 @@ GLAPI void GLAPIENTRY
 OSMesaDestroyContext( OSMesaContext osmesa )
 {
    if (osmesa) {
+      if (osmesa->rb)
+         _mesa_reference_renderbuffer(&osmesa->rb, NULL);
+
       _swsetup_DestroyContext( &osmesa->mesa );
       _tnl_DestroyContext( &osmesa->mesa );
       _vbo_DestroyContext( &osmesa->mesa );
diff-tree 4fc46a6c82419ec379896a9b9992c3cb6721904f (from e19cfabb6ec091982cc92ec59aa5dedf3cdf2302)
Author: Brian <brian at yutani.localnet.net>
Date:   Sat Apr 14 08:06:54 2007 -0600

    more _mesa_unreference_framebuffer() calls, remove dead code

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 5917071..2041d26 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1450,30 +1450,6 @@ _mesa_make_current( GLcontext *newCtx, G
       }
    }
 
-#if 0 /** XXX enable this someday */
-   if (oldCtx && oldCtx != newCtx) {
-      /* unbind old context's draw/read buffers */
-      if (oldCtx->DrawBuffer && oldCtx->DrawBuffer->Name == 0) {
-         oldCtx->DrawBuffer->RefCount--;
-         oldCtx->DrawBuffer = NULL;
-      }
-      if (oldCtx->ReadBuffer && oldCtx->ReadBuffer->Name == 0) {
-         oldCtx->ReadBuffer->RefCount--;
-         oldCtx->ReadBuffer = NULL;
-      }
-      if (oldCtx->WinSysDrawBuffer) {
-         ASSERT(oldCtx->WinSysDrawBuffer->Name == 0);
-         oldCtx->WinSysDrawBuffer->RefCount--;
-         oldCtx->WinSysDrawBuffer = NULL;
-      }
-      if (oldCtx->WinSysReadBuffer) {
-         ASSERT(oldCtx->WinSysReadBuffer->Name == 0);
-         oldCtx->WinSysReadBuffer->RefCount--;
-         oldCtx->WinSysReadBuffer = NULL;
-      }
-   }
-#endif
-
    /* We used to call _glapi_check_multithread() here.  Now do it in drivers */
    _glapi_set_context((void *) newCtx);
    ASSERT(_mesa_get_current_context() == newCtx);
@@ -1481,6 +1457,8 @@ _mesa_make_current( GLcontext *newCtx, G
    if (oldCtx) {
       _mesa_unreference_framebuffer(&oldCtx->WinSysDrawBuffer);
       _mesa_unreference_framebuffer(&oldCtx->WinSysReadBuffer);
+      _mesa_unreference_framebuffer(&oldCtx->DrawBuffer);
+      _mesa_unreference_framebuffer(&oldCtx->ReadBuffer);
    }
          
    if (!newCtx) {



More information about the mesa-commit mailing list