egl: Unbind the old context in _eglBindContext.

The last commit incorrectly moved the code under an "else".
This commit is contained in:
Chia-I Wu 2010-04-06 11:51:25 +08:00
parent bbe459b14d
commit 848945e5d6
1 changed files with 10 additions and 11 deletions

View File

@ -378,19 +378,18 @@ _eglBindContext(_EGLContext **ctx, _EGLSurface **draw, _EGLSurface **read)
/* bind the new context */
oldCtx = _eglBindContextToThread(newCtx, t);
if (newCtx) {
if (newCtx)
_eglBindContextToSurfaces(newCtx, draw, read);
}
else {
assert(!*draw && !*read);
if (oldCtx) {
*draw = oldCtx->DrawSurface;
*read = oldCtx->ReadSurface;
assert(*draw && *read);
/* unbind the old context from its surfaces */
_eglBindContextToSurfaces(NULL, draw, read);
}
/* unbind the old context from its binding surfaces */
if (oldCtx && oldCtx != newCtx) {
assert(!*draw && !*read);
*draw = oldCtx->DrawSurface;
*read = oldCtx->ReadSurface;
assert(*draw && *read);
_eglBindContextToSurfaces(NULL, draw, read);
}
*ctx = oldCtx;