am c0f900b7: am 5f326344: am 025c1f7f: Merge "emulator opengl: Fix bug when re-binding the same context"

* commit 'c0f900b70b108045e67178f714460b06fd1ca4a4':
  emulator opengl: Fix bug when re-binding the same context
This commit is contained in:
David Turner
2011-06-21 11:44:09 -07:00
committed by Android Git Automerger

View File

@@ -676,6 +676,7 @@ EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay display, EGLSurface draw
EGLSurface read, EGLContext context) { EGLSurface read, EGLContext context) {
VALIDATE_DISPLAY(display); VALIDATE_DISPLAY(display);
bool releaseContext = EglValidate::releaseContext(context,read,draw); bool releaseContext = EglValidate::releaseContext(context,read,draw);
if(!releaseContext && EglValidate::badContextMatch(context,read,draw)) { if(!releaseContext && EglValidate::badContextMatch(context,read,draw)) {
RETURN_ERROR(EGL_FALSE,EGL_BAD_MATCH); RETURN_ERROR(EGL_FALSE,EGL_BAD_MATCH);
@@ -701,6 +702,20 @@ EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay display, EGLSurface draw
EglSurface* newReadPtr = newReadSrfc.Ptr(); EglSurface* newReadPtr = newReadSrfc.Ptr();
EglContext* newCtx = ctx.Ptr(); EglContext* newCtx = ctx.Ptr();
if (newCtx && prevCtx) {
if (newCtx == prevCtx) {
if (newDrawPtr == prevCtx->draw().Ptr() &&
newReadPtr == prevCtx->read().Ptr()) {
// nothing to do
return EGL_TRUE;
}
}
else {
// Make sure previous context is detached from surfaces
releaseContext = true;
}
}
//surfaces compitability check //surfaces compitability check
if(!((*ctx->getConfig()).compitableWith((*newDrawPtr->getConfig()))) || if(!((*ctx->getConfig()).compitableWith((*newDrawPtr->getConfig()))) ||
!((*ctx->getConfig()).compitableWith((*newReadPtr->getConfig())))) { !((*ctx->getConfig()).compitableWith((*newReadPtr->getConfig())))) {
@@ -743,7 +758,7 @@ EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay display, EGLSurface draw
SurfacePtr prevRead; SurfacePtr prevRead;
SurfacePtr prevDraw; SurfacePtr prevDraw;
//removing terminated surfaces & context //removing terminated surfaces & context
if(prevCtx) { if(prevCtx && releaseContext) {
prevRead = prevCtx->read(); prevRead = prevCtx->read();
if(prevRead->destroy()){ if(prevRead->destroy()){
if(destroySurfaceIfNotCurrent(dpy,prevRead)) { //removes surface from the list if not current if(destroySurfaceIfNotCurrent(dpy,prevRead)) { //removes surface from the list if not current