Change the timing of Context::GlContextCreated() 14/239714/2
authorHeeyong Song <heeyong.song@samsung.com>
Wed, 29 Jul 2020 06:41:45 +0000 (15:41 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Wed, 29 Jul 2020 07:55:43 +0000 (16:55 +0900)
It should be called after eglMakeCurrent().

Change-Id: I88e06e443ee50c24dbfdc2a45beea66af7a1c53c

dali/internal/render/common/render-manager.cpp
dali/internal/render/gl-resources/context.cpp

index 504d6b9..3ec8755 100644 (file)
@@ -151,10 +151,6 @@ struct RenderManager::Impl
   Context* CreateSceneContext()
   {
     Context* context = new Context( glAbstraction );
-
-    //TODO: Need eglMakeCurrent first
-    context->GlContextCreated();
-
     sceneContextContainer.PushBack( context );
     return context;
   }
@@ -174,8 +170,6 @@ struct RenderManager::Impl
     Context* newContext = new Context( glAbstraction );
 
     oldSceneContext->GlContextDestroyed();
-    //TODO: Need eglMakeCurrent first
-    newContext->GlContextCreated();
 
     std::replace( sceneContextContainer.begin(), sceneContextContainer.end(), oldSceneContext, newContext );
     return newContext;
@@ -909,7 +903,8 @@ void RenderManager::RenderScene( Integration::RenderStatus& status, Integration:
       surfaceRect = Rect<int32_t>( 0, 0, static_cast<int32_t>( scene.GetSize().width ), static_cast<int32_t>( scene.GetSize().height ) );
     }
 
-    DALI_ASSERT_DEBUG( mImpl->currentContext->IsGlContextCreated() );
+    // Make sure that GL context must be created
+     mImpl->currentContext->GlContextCreated();
 
     // reset the program matrices for all programs once per frame
     // this ensures we will set view and projection matrix once per program per camera
index e045136..0cdc6f0 100644 (file)
@@ -119,16 +119,17 @@ void Context::GlContextCreated()
 {
   DALI_LOG_INFO(gContextLogFilter, Debug::Verbose, "Context::GlContextCreated()\n");
 
-  DALI_ASSERT_DEBUG(!mGlContextCreated);
-
-  mGlContextCreated = true;
+  if( !mGlContextCreated )
+  {
+    mGlContextCreated = true;
 
-  // Set the initial GL state, and check it.
-  InitializeGlState();
+    // Set the initial GL state, and check it.
+    InitializeGlState();
 
 #ifdef DEBUG_ENABLED
-  PrintCurrentState();
+    PrintCurrentState();
 #endif
+  }
 }
 
 void Context::GlContextDestroyed()