Fix to do not update state of render task in case of uploadOnly 30/273930/3
authorseungho <sbsh.baek@samsung.com>
Mon, 18 Apr 2022 07:06:21 +0000 (16:06 +0900)
committerseungho <sbsh.baek@samsung.com>
Thu, 21 Apr 2022 01:08:33 +0000 (10:08 +0900)
 - And removed unused uploadOnly parameter in the render-manager

Change-Id: I18e1e403cedf58d6e7c5c510bda123ef8b4fe149
Signed-off-by: seungho <sbsh.baek@samsung.com>
automated-tests/src/dali/dali-test-suite-utils/test-application.cpp
automated-tests/src/dali/dali-test-suite-utils/test-application.h
automated-tests/src/dali/utc-Dali-RenderTask.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
dali/internal/update/manager/update-manager.cpp
dali/internal/update/manager/update-manager.h

index 2862284..873b7b3 100644 (file)
@@ -179,7 +179,7 @@ void TestApplication::SendNotification()
   mCore->ProcessEvents();
 }
 
-void TestApplication::DoUpdate(uint32_t intervalMilliseconds, const char* location)
+void TestApplication::DoUpdate(uint32_t intervalMilliseconds, const char* location, bool uploadOnly)
 {
   if(GetUpdateStatus() == 0 &&
      mRenderStatus.NeedsUpdate() == false &&
@@ -191,25 +191,28 @@ void TestApplication::DoUpdate(uint32_t intervalMilliseconds, const char* locati
   uint32_t nextVSyncTime  = mLastVSyncTime + intervalMilliseconds;
   float    elapsedSeconds = static_cast<float>(intervalMilliseconds) * 0.001f;
 
-  mCore->Update(elapsedSeconds, mLastVSyncTime, nextVSyncTime, mStatus, false, false);
+  mCore->Update(elapsedSeconds, mLastVSyncTime, nextVSyncTime, mStatus, false, false, uploadOnly);
 
   GetRenderController().Initialize();
 
   mLastVSyncTime = nextVSyncTime;
 }
 
-bool TestApplication::Render(uint32_t intervalMilliseconds, const char* location)
+bool TestApplication::Render(uint32_t intervalMilliseconds, const char* location, bool uploadOnly)
 {
-  DoUpdate(intervalMilliseconds, location);
+  DoUpdate(intervalMilliseconds, location, uploadOnly);
 
   // Reset the status
   mRenderStatus.SetNeedsUpdate(false);
   mRenderStatus.SetNeedsPostRender(false);
 
-  mCore->PreRender(mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/);
-  mCore->RenderScene(mRenderStatus, mScene, true /*render the off-screen buffers*/);
-  mCore->RenderScene(mRenderStatus, mScene, false /*render the surface*/);
-  mCore->PostRender(false /*do not skip rendering*/);
+  mCore->PreRender(mRenderStatus, false /*do not force clear*/);
+  if(!uploadOnly)
+  {
+    mCore->RenderScene(mRenderStatus, mScene, true /*render the off-screen buffers*/);
+    mCore->RenderScene(mRenderStatus, mScene, false /*render the surface*/);
+  }
+  mCore->PostRender();
 
   mFrame++;
 
@@ -220,7 +223,7 @@ bool TestApplication::PreRenderWithPartialUpdate(uint32_t intervalMilliseconds,
 {
   DoUpdate(intervalMilliseconds, location);
 
-  mCore->PreRender(mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/);
+  mCore->PreRender(mRenderStatus, false /*do not force clear*/);
   mCore->PreRender(mScene, damagedRects);
 
   return mStatus.KeepUpdating() || mRenderStatus.NeedsUpdate();
@@ -230,7 +233,7 @@ bool TestApplication::RenderWithPartialUpdate(std::vector<Rect<int>>& damagedRec
 {
   mCore->RenderScene(mRenderStatus, mScene, true /*render the off-screen buffers*/);
   mCore->RenderScene(mRenderStatus, mScene, false /*render the surface*/, clippingRect);
-  mCore->PostRender(false /*do not skip rendering*/);
+  mCore->PostRender();
 
   mFrame++;
 
@@ -261,10 +264,10 @@ bool TestApplication::GetRenderNeedsPostRender()
 bool TestApplication::RenderOnly()
 {
   // Update Time values
-  mCore->PreRender(mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/);
+  mCore->PreRender(mRenderStatus, false /*do not force clear*/);
   mCore->RenderScene(mRenderStatus, mScene, true /*render the off-screen buffers*/);
   mCore->RenderScene(mRenderStatus, mScene, false /*render the surface*/);
-  mCore->PostRender(false /*do not skip rendering*/);
+  mCore->PostRender();
 
   mFrame++;
 
index 02143a7..1b101c5 100644 (file)
@@ -72,7 +72,7 @@ public:
 
   void        ProcessEvent(const Integration::Event& event);
   void        SendNotification();
-  bool        Render(uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL, const char* location = NULL);
+  bool        Render(uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL, const char* location = NULL, bool uploadOnly = false);
   bool        PreRenderWithPartialUpdate(uint32_t intervalMilliseconds, const char* location, std::vector<Rect<int>>& damagedRects);
   bool        RenderWithPartialUpdate(std::vector<Rect<int>>& damagedRects, Rect<int>& clippingRect);
   uint32_t    GetUpdateStatus();
@@ -93,7 +93,7 @@ public:
   }
 
 private:
-  void DoUpdate(uint32_t intervalMilliseconds, const char* location = NULL);
+  void DoUpdate(uint32_t intervalMilliseconds, const char* location = NULL, bool uploadOnly = false);
 
 protected:
   TestPlatformAbstraction mPlatformAbstraction;
index 4909fe3..9b5e9de 100644 (file)
@@ -3480,3 +3480,48 @@ int UtcDaliRenderTaskClippingMode02(void)
 
   END_TEST;
 }
+
+int UtcDaliRenderTaskUploadOnly(void)
+{
+  TestApplication application;
+
+  tet_infoline("Testing RenderTask Render Once GlSync, using loaded image");
+
+  // SETUP AN OFFSCREEN RENDER TASK
+  application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
+  auto&           sync      = application.GetGraphicsSyncImpl();
+  TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
+  drawTrace.Enable(true);
+
+  Actor rootActor = Actor::New();
+  application.GetScene().Add(rootActor);
+
+  CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT));
+  application.GetScene().Add(offscreenCameraActor);
+  Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg");
+
+  application.GetScene().Add(secondRootActor);
+
+  RenderTask         newTask  = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ONCE, true);
+  bool               finished = false;
+  RenderTaskFinished renderTaskFinished(finished);
+  newTask.FinishedSignal().Connect(&application, renderTaskFinished);
+  application.SendNotification();
+
+  DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, true, __LINE__));
+
+  Integration::GraphicsSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject();
+  DALI_TEST_CHECK(lastSyncObj != NULL);
+  sync.SetObjectSynced(lastSyncObj, true);
+
+  application.SendNotification();
+  application.Render(16, nullptr, true);
+
+  DALI_TEST_CHECK(!finished);
+
+  application.Render(16, nullptr, true);
+  application.SendNotification();
+
+  DALI_TEST_CHECK(!finished);
+  END_TEST;
+}
\ No newline at end of file
index 99001f3..05f6d52 100644 (file)
@@ -100,14 +100,14 @@ uint32_t Core::GetMaximumUpdateCount() const
   return mImpl->GetMaximumUpdateCount();
 }
 
-void Core::Update(float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo)
+void Core::Update(float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo, bool uploadOnly)
 {
-  mImpl->Update(elapsedSeconds, lastVSyncTimeMilliseconds, nextVSyncTimeMilliseconds, status, renderToFboEnabled, isRenderingToFbo);
+  mImpl->Update(elapsedSeconds, lastVSyncTimeMilliseconds, nextVSyncTimeMilliseconds, status, renderToFboEnabled, isRenderingToFbo, uploadOnly);
 }
 
-void Core::PreRender(RenderStatus& status, bool forceClear, bool uploadOnly)
+void Core::PreRender(RenderStatus& status, bool forceClear)
 {
-  mImpl->PreRender(status, forceClear, uploadOnly);
+  mImpl->PreRender(status, forceClear);
 }
 
 void Core::PreRender(Integration::Scene& scene, std::vector<Rect<int>>& damagedRects)
@@ -125,9 +125,9 @@ void Core::RenderScene(RenderStatus& status, Integration::Scene& scene, bool ren
   mImpl->RenderScene(status, scene, renderToFbo, clippingRect);
 }
 
-void Core::PostRender(bool uploadOnly)
+void Core::PostRender()
 {
-  mImpl->PostRender(uploadOnly);
+  mImpl->PostRender();
 }
 
 void Core::RegisterProcessor(Processor& processor, bool postProcessor)
index 1dd070d..0a4ce07 100644 (file)
@@ -324,13 +324,15 @@ public:
    * whether a Notification event should be sent, regardless of whether the multi-threading is used.
    * @param[in] renderToFboEnabled Whether rendering into the Frame Buffer Object is enabled.
    * @param[in] isRenderingToFbo Whether this frame is being rendered into the Frame Buffer Object.
+   * @param[in] uploadOnly uploadOnly Upload the resource only without rendering.
    */
   void Update(float         elapsedSeconds,
               uint32_t      lastVSyncTimeMilliseconds,
               uint32_t      nextVSyncTimeMilliseconds,
               UpdateStatus& status,
               bool          renderToFboEnabled,
-              bool          isRenderingToFbo);
+              bool          isRenderingToFbo,
+              bool          uploadOnly);
 
   /**
    * This is called before rendering any scene in the next frame. This method should be preceded
@@ -339,9 +341,8 @@ 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 PreRender(RenderStatus& status, bool forceClear, bool uploadOnly);
+  void PreRender(RenderStatus& status, bool forceClear);
 
   /**
    * This is called before rendering any scene in the next frame. This method should be preceded
@@ -383,9 +384,8 @@ public:
    * followed by a call up RenderScene.
    * Multi-threading note: this method should be called from a dedicated rendering thread.
    * @pre The GL context must have been created, and made current.
-   * @param[in] uploadOnly uploadOnly Upload the resource only without rendering.
    */
-  void PostRender(bool uploadOnly);
+  void PostRender();
 
   /**
    * @brief Register a processor
index 3b50a24..5e02c36 100644 (file)
@@ -185,7 +185,7 @@ void Core::ContextDestroyed()
 {
 }
 
-void Core::Update(float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, Integration::UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo)
+void Core::Update(float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, Integration::UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo, bool uploadOnly)
 {
   // set the time delta so adaptor can easily print FPS with a release build with 0 as
   // it is cached by frametime
@@ -197,7 +197,8 @@ void Core::Update(float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint
                                                lastVSyncTimeMilliseconds,
                                                nextVSyncTimeMilliseconds,
                                                renderToFboEnabled,
-                                               isRenderingToFbo);
+                                               isRenderingToFbo,
+                                               uploadOnly);
 
   // Check the Notification Manager message queue to set needsNotification
   status.needsNotification = mNotificationManager->MessagesToProcess();
@@ -206,9 +207,9 @@ void Core::Update(float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint
   // Any message to update will wake it up anyways
 }
 
-void Core::PreRender(RenderStatus& status, bool forceClear, bool uploadOnly)
+void Core::PreRender(RenderStatus& status, bool forceClear)
 {
-  mRenderManager->PreRender(status, forceClear, uploadOnly);
+  mRenderManager->PreRender(status, forceClear);
 }
 
 void Core::PreRender(Integration::Scene& scene, std::vector<Rect<int>>& damagedRects)
@@ -226,9 +227,9 @@ void Core::RenderScene(RenderStatus& status, Integration::Scene& scene, bool ren
   mRenderManager->RenderScene(status, scene, renderToFbo, clippingRect);
 }
 
-void Core::PostRender(bool uploadOnly)
+void Core::PostRender()
 {
-  mRenderManager->PostRender(uploadOnly);
+  mRenderManager->PostRender();
 }
 
 void Core::SceneCreated()
index 9744d0d..7313d26 100644 (file)
@@ -125,12 +125,12 @@ public:
   /**
    * @copydoc Dali::Integration::Core::Update()
    */
-  void Update(float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, Integration::UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo);
+  void Update(float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, Integration::UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo, bool uploadOnly);
 
   /**
    * @copydoc Dali::Integration::Core::PreRender()
    */
-  void PreRender(Integration::RenderStatus& status, bool forceClear, bool uploadOnly);
+  void PreRender(Integration::RenderStatus& status, bool forceClear);
 
   /**
    * @copydoc Dali::Integration::Core::PreRender()
@@ -150,7 +150,7 @@ public:
   /**
    * @copydoc Dali::Integration::Core::Render()
    */
-  void PostRender(bool uploadOnly);
+  void PostRender();
 
   /**
    * @copydoc Dali::Integration::Core::SceneCreated()
index 084db0e..b14261b 100644 (file)
@@ -436,7 +436,7 @@ void RenderManager::RemoveRenderTracker(Render::RenderTracker* renderTracker)
   mImpl->RemoveRenderTracker(renderTracker);
 }
 
-void RenderManager::PreRender(Integration::RenderStatus& status, bool forceClear, bool uploadOnly)
+void RenderManager::PreRender(Integration::RenderStatus& status, bool forceClear)
 {
   DALI_PRINT_RENDER_START(mImpl->renderBufferIndex);
 
@@ -994,7 +994,7 @@ void RenderManager::RenderScene(Integration::RenderStatus& status, Integration::
   }
 }
 
-void RenderManager::PostRender(bool uploadOnly)
+void RenderManager::PostRender()
 {
   // Notify RenderGeometries that rendering has finished
   for(auto&& iter : mImpl->geometryContainer)
index 8b96203..7ba572b 100644 (file)
@@ -323,9 +323,8 @@ public:
    * @pre The graphics implementation must be initialized
    * @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 PreRender(Integration::RenderStatus& status, bool forceClear, bool uploadOnly);
+  void PreRender(Integration::RenderStatus& status, bool forceClear);
 
   // This method should be called from Core::PreRender()
 
@@ -373,9 +372,8 @@ public:
    * followed by a call up RenderScene.
    * Multi-threading note: this method should be called from a dedicated rendering thread.
    * @pre The graphics implementation must be initialized
-   * @param[in] uploadOnly uploadOnly Upload the resource only without rendering.
    */
-  void PostRender(bool uploadOnly);
+  void PostRender();
 
 private:
   /**
index 02ce60f..e5b96d0 100644 (file)
@@ -899,7 +899,8 @@ uint32_t UpdateManager::Update(float    elapsedSeconds,
                                uint32_t lastVSyncTimeMilliseconds,
                                uint32_t nextVSyncTimeMilliseconds,
                                bool     renderToFboEnabled,
-                               bool     isRenderingToFbo)
+                               bool     isRenderingToFbo,
+                               bool     uploadOnly)
 {
   const BufferIndex bufferIndex = mSceneGraphBuffers.GetUpdateBufferIndex();
 
@@ -1047,36 +1048,39 @@ uint32_t UpdateManager::Update(float    elapsedSeconds,
     }
   }
 
-  for(auto&& scene : mImpl->scenes)
+  if(!uploadOnly)
   {
-    if(scene && scene->root && scene->taskList)
+    for(auto&& scene : mImpl->scenes)
     {
-      RenderTaskList::RenderTaskContainer& tasks = scene->taskList->GetTasks();
-
-      // check the countdown and notify
-      bool doRenderOnceNotify  = false;
-      mImpl->renderTaskWaiting = false;
-      for(auto&& renderTask : tasks)
+      if(scene && scene->root && scene->taskList)
       {
-        renderTask->UpdateState();
+        RenderTaskList::RenderTaskContainer& tasks = scene->taskList->GetTasks();
 
-        if(renderTask->IsWaitingToRender() &&
-           renderTask->ReadyToRender(bufferIndex) /*avoid updating forever when source actor is off-stage*/)
+        // check the countdown and notify
+        bool doRenderOnceNotify  = false;
+        mImpl->renderTaskWaiting = false;
+        for(auto&& renderTask : tasks)
         {
-          mImpl->renderTaskWaiting = true; // keep update/render threads alive
+          renderTask->UpdateState();
+
+          if(renderTask->IsWaitingToRender() &&
+             renderTask->ReadyToRender(bufferIndex) /*avoid updating forever when source actor is off-stage*/)
+          {
+            mImpl->renderTaskWaiting = true; // keep update/render threads alive
+          }
+
+          if(renderTask->HasRendered())
+          {
+            doRenderOnceNotify = true;
+          }
         }
 
-        if(renderTask->HasRendered())
+        if(doRenderOnceNotify)
         {
-          doRenderOnceNotify = true;
+          DALI_LOG_INFO(gRenderTaskLogFilter, Debug::General, "Notify a render task has finished\n");
+          mImpl->notificationManager.QueueCompleteNotification(scene->taskList->GetCompleteNotificationInterface());
         }
       }
-
-      if(doRenderOnceNotify)
-      {
-        DALI_LOG_INFO(gRenderTaskLogFilter, Debug::General, "Notify a render task has finished\n");
-        mImpl->notificationManager.QueueCompleteNotification(scene->taskList->GetCompleteNotificationInterface());
-      }
     }
   }
 
index 23c5143..9a4a0e6 100644 (file)
@@ -606,13 +606,15 @@ public:
    * @param[in] nextVSyncTimeMilliseconds The estimated time, in milliseconds, of the next VSync.
    * @param[in] renderToFboEnabled Whether rendering into the Frame Buffer Object is enabled.
    * @param[in] isRenderingToFbo   Whether this frame is being rendered into the Frame Buffer Object.
+   * @param[in] uploadOnly uploadOnly Upload the resource only without rendering.
    * @return True if further updates are required e.g. during animations.
    */
   uint32_t Update(float    elapsedSeconds,
                   uint32_t lastVSyncTimeMilliseconds,
                   uint32_t nextVSyncTimeMilliseconds,
                   bool     renderToFboEnabled,
-                  bool     isRenderingToFbo);
+                  bool     isRenderingToFbo,
+                  bool     uploadOnly);
 
   /**
    * @copydoc Dali::Stage::KeepRendering()