diff options
Diffstat (limited to 'src/egl/main/eglcontext.c')
-rw-r--r-- | src/egl/main/eglcontext.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c index 80e316a10b1..d5a1e79a994 100644 --- a/src/egl/main/eglcontext.c +++ b/src/egl/main/eglcontext.c @@ -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 { + + /* unbind the old context from its binding surfaces */ + if (oldCtx && oldCtx != newCtx) { 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); - } + *draw = oldCtx->DrawSurface; + *read = oldCtx->ReadSurface; + assert(*draw && *read); + + _eglBindContextToSurfaces(NULL, draw, read); } *ctx = oldCtx; |