X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fgraphics%2Fgles%2Fegl-implementation.cpp;h=be463f7fab2f0768a05f2669e4bc90f05c7fcd36;hb=cbc41a9b327649c3289cf312dbf39f6160762615;hp=1e6ce246c96c1d6e33176d0cd36f6db559923527;hpb=09e6892adcddf6d2bf7c88dc8442a42da2ac57f5;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/graphics/gles/egl-implementation.cpp b/dali/internal/graphics/gles/egl-implementation.cpp index 1e6ce24..be463f7 100755 --- a/dali/internal/graphics/gles/egl-implementation.cpp +++ b/dali/internal/graphics/gles/egl-implementation.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -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 ), @@ -126,6 +127,17 @@ bool EglImplementation::InitializeGles( EGLNativeDisplayType display, bool isOwn mIsOwnSurface = isOwnSurface; } + // We want to display this information all the time, so use the LogMessage directly + Integration::Log::LogMessage(Integration::Log::DebugInfo, "EGL Information\n" + " Vendor: %s\n" + " Version: %s\n" + " Client APIs: %s\n" + " Extensions: %s\n", + eglQueryString( mEglDisplay, EGL_VENDOR ), + eglQueryString( mEglDisplay, EGL_VERSION ), + eglQueryString( mEglDisplay, EGL_CLIENT_APIS ), + eglQueryString( mEglDisplay, EGL_EXTENSIONS )); + return mGlesInitialized; } @@ -190,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(); @@ -205,27 +226,25 @@ void EglImplementation::MakeContextCurrent( EGLSurface eglSurface, EGLContext eg DALI_ASSERT_ALWAYS(false && "MakeContextCurrent failed!"); } - - // We want to display this information all the time, so use the LogMessage directly - Integration::Log::LogMessage(Integration::Log::DebugInfo, "EGL Information\n" - " Vendor: %s\n" - " Version: %s\n" - " Client APIs: %s\n" - " Extensions: %s\n", - eglQueryString(mEglDisplay, EGL_VENDOR), - eglQueryString(mEglDisplay, EGL_VERSION), - eglQueryString(mEglDisplay, EGL_CLIENT_APIS), - eglQueryString(mEglDisplay, EGL_EXTENSIONS)); } 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; }