Avoid showing garbage when dali-demo is launched
authorPaul Wisbey <p.wisbey@samsung.com>
Wed, 28 May 2014 08:09:55 +0000 (17:09 +0900)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 10 Jun 2014 14:55:35 +0000 (15:55 +0100)
[problem]     When window transition effect is disabled, dali-demo shows
random framebuffer contents when launched.
[cause]       First glClear is delayed until renderers are ready.
[solution]    Always do the first glClear regardless of renderers.

dali/internal/render/common/render-manager.cpp

index 045bdfa91047a2efdcbf378656a8da6e2e0e6b6e..4dab63244d40b3070e21958552b3802210bd54c3 100644 (file)
@@ -101,7 +101,8 @@ struct RenderManager::Impl
     defaultSurfaceRect(),
     rendererContainer(),
     materials(),
-    renderersAdded( false )
+    renderersAdded( false ),
+    firstRenderCompleted( false )
   {
   }
 
@@ -168,6 +169,8 @@ struct RenderManager::Impl
   bool                                renderersAdded;
 
   RenderTrackerContainer              mRenderTrackers;     ///< List of render trackers
+
+  bool                                firstRenderCompleted; ///< False until the first render is done
 };
 
 RenderManager* RenderManager::New( Integration::GlAbstraction& glAbstraction, ResourcePostProcessList& resourcePostProcessQ )
@@ -349,8 +352,8 @@ bool RenderManager::Render( Integration::RenderStatus& status )
   // Process messages queued during previous update
   mImpl->renderQueue.ProcessMessages( mImpl->renderBufferIndex );
 
-  //No need to make any gl calls if we don't have any renderers to render during startup.
-  if(mImpl->renderersAdded)
+  // No need to make any gl calls if we've done 1st glClear & don't have any renderers to render during startup.
+  if( !mImpl->firstRenderCompleted || mImpl->renderersAdded )
   {
     // switch rendering to adaptor provided (default) buffer
     mImpl->context.BindFramebuffer( GL_FRAMEBUFFER, 0 );
@@ -402,6 +405,8 @@ bool RenderManager::Render( Integration::RenderStatus& status )
     mImpl->context.InvalidateFramebuffer(GL_FRAMEBUFFER, 2, attachments);
 
     mImpl->UpdateTrackers();
+
+    mImpl->firstRenderCompleted = true;
   }
 
   PERF_MONITOR_END(PerformanceMonitor::DRAW_NODES);