Provide option to upload resource only without rendering 04/213804/3
authorRichard Huang <r.huang@samsung.com>
Wed, 11 Sep 2019 09:10:13 +0000 (10:10 +0100)
committerRichard Huang <r.huang@samsung.com>
Mon, 16 Sep 2019 16:10:39 +0000 (17:10 +0100)
Change-Id: If166043085496975f96355569bceb458d5292e08

automated-tests/src/dali/dali-test-suite-utils/test-application.cpp
dali/integration-api/core.cpp
dali/integration-api/core.h
dali/internal/common/core-impl.cpp
dali/internal/common/core-impl.h
dali/internal/render/common/render-manager.cpp
dali/internal/render/common/render-manager.h

index 338b71f..44b4964 100644 (file)
@@ -193,7 +193,7 @@ void TestApplication::DoUpdate( uint32_t intervalMilliseconds, const char* locat
 bool TestApplication::Render( uint32_t intervalMilliseconds, const char* location )
 {
   DoUpdate( intervalMilliseconds, location );
-  mCore->Render( mRenderStatus, false );
+  mCore->Render( mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/ );
 
   mFrame++;
 
@@ -219,7 +219,7 @@ bool TestApplication::GetRenderNeedsUpdate()
 bool TestApplication::RenderOnly( )
 {
   // Update Time values
-  mCore->Render( mRenderStatus, false );
+  mCore->Render( mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/ );
 
   mFrame++;
 
index 1f664e4..d154574 100644 (file)
@@ -119,9 +119,9 @@ void Core::Update( float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uin
   mImpl->Update( elapsedSeconds, lastVSyncTimeMilliseconds, nextVSyncTimeMilliseconds, status, renderToFboEnabled, isRenderingToFbo );
 }
 
-void Core::Render( RenderStatus& status, bool forceClear )
+void Core::Render( RenderStatus& status, bool forceClear, bool uploadOnly )
 {
-  mImpl->Render( status, forceClear );
+  mImpl->Render( status, forceClear, uploadOnly );
 }
 
 void Core::RegisterProcessor( Processor& processor )
index 2e57a76..e7644af 100644 (file)
@@ -355,8 +355,9 @@ public:
    * @pre The GL context must have been created, and made current.
    * @param[out] status showing whether update is required to run.
    * @param[in] forceClear force the Clear on the framebuffer even if nothing is rendered.
+   * @param[in] uploadOnly uploadOnly Upload the resource only without rendering.
    */
-  void Render( RenderStatus& status, bool forceClear );
+  void Render( RenderStatus& status, bool forceClear, bool uploadOnly );
 
   /**
    * @brief Register a processor
index 75e373b..b78b515 100644 (file)
@@ -230,9 +230,9 @@ void Core::Update( float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uin
   // Any message to update will wake it up anyways
 }
 
-void Core::Render( RenderStatus& status, bool forceClear )
+void Core::Render( RenderStatus& status, bool forceClear, bool uploadOnly )
 {
-  mRenderManager->Render( status, forceClear );
+  mRenderManager->Render( status, forceClear, uploadOnly );
 }
 
 void Core::SceneCreated()
index b37e454..4f137a5 100644 (file)
@@ -138,7 +138,7 @@ public:
   /**
    * @copydoc Dali::Integration::Core::Render()
    */
-  void Render( Integration::RenderStatus& status, bool forceClear );
+  void Render( Integration::RenderStatus& status, bool forceClear, bool uploadOnly );
 
   /**
    * @copydoc Dali::Integration::Core::SceneCreated()
index 7c56dfb..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
index fd3e35c..cc70287 100644 (file)
@@ -327,9 +327,10 @@ public:
   /**
    * Renders the results of the previous "update" traversal.
    * @param[out] status contains the rendering flags.
-   * @param[in] forceClear force the Clear on the framebuffer even if nothing is rendered.
+   * @param[in] forceClear Force the Clear on the framebuffer even if nothing is rendered.
+   * @param[in] uploadOnly Upload the resource only without rendering.
    */
-  void Render( Integration::RenderStatus& status, bool forceClear );
+  void Render( Integration::RenderStatus& status, bool forceClear, bool uploadOnly );
 
 private: