Revert "[Tizen] Add screen and client rotation itself function"
[platform/core/uifw/dali-core.git] / dali / internal / render / common / render-manager.cpp
index b5a5011..a3e6db9 100644 (file)
@@ -459,7 +459,7 @@ ProgramCache* RenderManager::GetProgramCache()
   return &(mImpl->programController);
 }
 
-void RenderManager::Render( Integration::RenderStatus& status, bool forceClear )
+void RenderManager::Render( Integration::RenderStatus& status, bool forceClear, bool uploadOnly )
 {
   DALI_PRINT_RENDER_START( mImpl->renderBufferIndex );
 
@@ -486,8 +486,11 @@ void RenderManager::Render( Integration::RenderStatus& status, bool forceClear )
   {
     DALI_LOG_INFO( gLogFilter, Debug::General, "Render: Processing\n" );
 
-    // Mark that we will require a post-render step to be performed (includes swap-buffers).
-    status.SetNeedsPostRender( true );
+    if ( !uploadOnly )
+    {
+      // Mark that we will require a post-render step to be performed (includes swap-buffers).
+      status.SetNeedsPostRender( true );
+    }
 
     // Switch to the shared context
     if ( mImpl->currentContext != &mImpl->context )
@@ -539,23 +542,26 @@ void RenderManager::Render( Integration::RenderStatus& status, bool forceClear )
       }
     }
 
-    for( uint32_t i = 0; i < count; ++i )
+    if ( !uploadOnly )
     {
-      RenderInstruction& instruction = mImpl->instructions.At( mImpl->renderBufferIndex, i );
+      for( uint32_t i = 0; i < count; ++i )
+      {
+        RenderInstruction& instruction = mImpl->instructions.At( mImpl->renderBufferIndex, i );
 
-      DoRender( instruction );
-    }
+        DoRender( instruction );
+      }
 
-    if ( mImpl->currentContext->IsSurfacelessContextSupported() )
-    {
-      mImpl->glContextHelperAbstraction.MakeSurfacelessContextCurrent();
-    }
+      if ( mImpl->currentContext->IsSurfacelessContextSupported() )
+      {
+        mImpl->glContextHelperAbstraction.MakeSurfacelessContextCurrent();
+      }
 
-    GLenum attachments[] = { GL_DEPTH, GL_STENCIL };
-    mImpl->context.InvalidateFramebuffer(GL_FRAMEBUFFER, 2, attachments);
-    for ( auto&& context : mImpl->surfaceContextContainer )
-    {
-      context->InvalidateFramebuffer(GL_FRAMEBUFFER, 2, attachments);
+      GLenum attachments[] = { GL_DEPTH, GL_STENCIL };
+      mImpl->context.InvalidateFramebuffer(GL_FRAMEBUFFER, 2, attachments);
+      for ( auto&& context : mImpl->surfaceContextContainer )
+      {
+        context->InvalidateFramebuffer(GL_FRAMEBUFFER, 2, attachments);
+      }
     }
 
     //Notify RenderGeometries that rendering has finished
@@ -610,6 +616,12 @@ void RenderManager::DoRender( RenderInstruction& instruction )
     {
       surfaceFrameBuffer = static_cast<Render::SurfaceFrameBuffer*>( instruction.mFrameBuffer );
 
+      if ( !surfaceFrameBuffer->IsSurfaceValid() )
+      {
+        // Skip rendering the frame buffer if the render surface becomes invalid
+        return;
+      }
+
       if ( mImpl->currentContext->IsSurfacelessContextSupported() )
       {
         Context* surfaceContext = surfaceFrameBuffer->GetContext();