diff options
author | Nian Wu <[email protected]> | 2007-02-27 14:42:16 -0500 |
---|---|---|
committer | Nian Wu <[email protected]> | 2007-02-27 14:42:16 -0500 |
commit | 381b4b0c91d476811420d8806eb8c058d0075927 (patch) | |
tree | f26f27eda373ad44bf9f3bf591a1c98a2da99c01 /src/mesa/main/context.c | |
parent | 675f7f627bec92315bf168a9c872ffc05f88c69c (diff) | |
parent | e21096b07c5854d01114b58f87d08709e370f8b7 (diff) |
Merge git://proxy01.pd.intel.com:9419/git/mesa/mesa into crestline
Diffstat (limited to 'src/mesa/main/context.c')
-rw-r--r-- | src/mesa/main/context.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 9b3759b6c82..1245c10cc2c 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" @@ -1666,6 +1667,8 @@ void _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer, GLframebuffer *readBuffer ) { + GET_CURRENT_CONTEXT(oldCtx); + if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(newCtx, "_mesa_make_current()\n"); @@ -1690,6 +1693,15 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer, _glapi_set_context((void *) newCtx); ASSERT(_mesa_get_current_context() == newCtx); + if (oldCtx) { + if (oldCtx->WinSysDrawBuffer) { + _mesa_dereference_framebuffer(&oldCtx->WinSysDrawBuffer); + } + if (oldCtx->WinSysReadBuffer) { + _mesa_dereference_framebuffer(&oldCtx->WinSysReadBuffer); + } + } + if (!newCtx) { _glapi_set_dispatch(NULL); /* none current */ } @@ -1703,6 +1715,8 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer, ASSERT(readBuffer->Name == 0); newCtx->WinSysDrawBuffer = drawBuffer; newCtx->WinSysReadBuffer = readBuffer; + drawBuffer->RefCount++; + readBuffer->RefCount++; /* * Only set the context's Draw/ReadBuffer fields if they're NULL |