diff options
author | Brian <[email protected]> | 2007-03-09 11:43:53 -0700 |
---|---|---|
committer | Brian <[email protected]> | 2007-03-09 11:43:53 -0700 |
commit | 2cf5fd48d1586f961910a14324a457854cb66221 (patch) | |
tree | 6b8690b1e3ac2b59369356d692214cc7d6a889c6 /src/mesa/main/context.c | |
parent | 9f44247acf62b91669f77974a4bbad687d58859e (diff) | |
parent | f9f79c8d770e696249bd98c68b563f887562c974 (diff) |
Merge branch 'origin' into glsl-compiler-1
Conflicts:
src/mesa/main/context.c
Diffstat (limited to 'src/mesa/main/context.c')
-rw-r--r-- | src/mesa/main/context.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 9b043488068..0cff90c77a6 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -95,6 +95,7 @@ #include "fbobject.h" #include "feedback.h" #include "fog.h" +#include "framebuffer.h" #include "get.h" #include "glthread.h" #include "glapioffsets.h" @@ -1423,6 +1424,13 @@ _mesa_free_context_data( GLcontext *ctx ) if (ctx == _mesa_get_current_context()) { _mesa_make_current(NULL, NULL, NULL); } + else { + /* unreference WinSysDraw/Read buffers */ + _mesa_unreference_framebuffer(&ctx->WinSysDrawBuffer); + _mesa_unreference_framebuffer(&ctx->WinSysReadBuffer); + _mesa_unreference_framebuffer(&ctx->DrawBuffer); + _mesa_unreference_framebuffer(&ctx->ReadBuffer); + } _mesa_free_lighting_data( ctx ); _mesa_free_eval_data( ctx ); @@ -1682,9 +1690,7 @@ void _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer, GLframebuffer *readBuffer ) { -#if 0 GET_CURRENT_CONTEXT(oldCtx); -#endif if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(newCtx, "_mesa_make_current()\n"); @@ -1734,6 +1740,11 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer, _glapi_set_context((void *) newCtx); ASSERT(_mesa_get_current_context() == newCtx); + if (oldCtx) { + _mesa_unreference_framebuffer(&oldCtx->WinSysDrawBuffer); + _mesa_unreference_framebuffer(&oldCtx->WinSysReadBuffer); + } + if (!newCtx) { _glapi_set_dispatch(NULL); /* none current */ } @@ -1745,18 +1756,18 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer, ASSERT(drawBuffer->Name == 0); ASSERT(readBuffer->Name == 0); - newCtx->WinSysDrawBuffer = drawBuffer; - newCtx->WinSysReadBuffer = readBuffer; + _mesa_reference_framebuffer(&newCtx->WinSysDrawBuffer, drawBuffer); + _mesa_reference_framebuffer(&newCtx->WinSysReadBuffer, readBuffer); /* * Only set the context's Draw/ReadBuffer fields if they're NULL * or not bound to a user-created FBO. */ if (!newCtx->DrawBuffer || newCtx->DrawBuffer->Name == 0) { - newCtx->DrawBuffer = drawBuffer; + _mesa_reference_framebuffer(&newCtx->DrawBuffer, drawBuffer); } if (!newCtx->ReadBuffer || newCtx->ReadBuffer->Name == 0) { - newCtx->ReadBuffer = readBuffer; + _mesa_reference_framebuffer(&newCtx->ReadBuffer, readBuffer); } newCtx->NewState |= _NEW_BUFFERS; |