From: Richard Huang Date: Fri, 5 Apr 2019 09:38:21 +0000 (+0100) Subject: Force the completion of all GL executions before switching the context X-Git-Tag: dali_1.4.15~1^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git;a=commitdiff_plain;h=cbc41a9b327649c3289cf312dbf39f6160762615 Force the completion of all GL executions before switching the context Change-Id: If09bfc187205bcd0f6f862f4774bcaf1f7a576c8 --- diff --git a/dali/internal/graphics/gles/egl-implementation.cpp b/dali/internal/graphics/gles/egl-implementation.cpp index dca3bd0..be463f7 100755 --- a/dali/internal/graphics/gles/egl-implementation.cpp +++ b/dali/internal/graphics/gles/egl-implementation.cpp @@ -64,6 +64,7 @@ EglImplementation::EglImplementation( int multiSamplingLevel, mEglConfig( 0 ), mEglContext( 0 ), mCurrentEglSurface( 0 ), + mCurrentEglContext( EGL_NO_CONTEXT ), mMultiSamplingLevel( multiSamplingLevel ), mColorDepth( COLOR_DEPTH_24 ), mGlesInitialized( false ), @@ -201,11 +202,20 @@ void EglImplementation::DestroySurface( EGLSurface& eglSurface ) void EglImplementation::MakeContextCurrent( EGLSurface eglSurface, EGLContext eglContext ) { + if (mCurrentEglContext == eglContext) + { + return; + } + mCurrentEglSurface = eglSurface; if(mIsOwnSurface) { + glFinish(); + eglMakeCurrent( mEglDisplay, eglSurface, eglSurface, eglContext ); + + mCurrentEglContext = eglContext; } EGLint error = eglGetError(); @@ -220,12 +230,21 @@ void EglImplementation::MakeContextCurrent( EGLSurface eglSurface, EGLContext eg void EglImplementation::MakeCurrent( EGLNativePixmapType pixmap, EGLSurface eglSurface ) { + if (mCurrentEglContext == mEglContext) + { + return; + } + mCurrentEglNativePixmap = pixmap; mCurrentEglSurface = eglSurface; if(mIsOwnSurface) { + glFinish(); + eglMakeCurrent( mEglDisplay, eglSurface, eglSurface, mEglContext ); + + mCurrentEglContext = mEglContext; } EGLint error = eglGetError(); @@ -242,6 +261,7 @@ void EglImplementation::MakeContextNull() { // clear the current context eglMakeCurrent( mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT ); + mCurrentEglContext = EGL_NO_CONTEXT; } void EglImplementation::TerminateGles() @@ -270,6 +290,7 @@ void EglImplementation::TerminateGles() mEglConfig = NULL; mEglContext = NULL; mCurrentEglSurface = NULL; + mCurrentEglContext = EGL_NO_CONTEXT; mGlesInitialized = false; } diff --git a/dali/internal/graphics/gles/egl-implementation.h b/dali/internal/graphics/gles/egl-implementation.h index e299da7..3c75e3b 100644 --- a/dali/internal/graphics/gles/egl-implementation.h +++ b/dali/internal/graphics/gles/egl-implementation.h @@ -205,6 +205,7 @@ private: EglWindowContextContainer mEglWindowContexts; ///< The EGL context for the window EGLSurface mCurrentEglSurface; + EGLContext mCurrentEglContext; typedef std::vector EglWindowSurfaceContainer; EglWindowSurfaceContainer mEglWindowSurfaces; ///< The EGL surface for the window