Let we make some interface whether given scene rendered previous frame or not.
Until now, we only had "current" scene has render instruction to scene or not.
But also, we should clear the scene if "previous" scene had render instruction
but not now.
Since it could not be known by single boolean value, we make another class
to communicate the PreRender result.
By this infomation, we should determine whether we should call
ClearScene() or not even if fullSwap keyword not applied.
Furthermore, Let we make PreRender(Scene) API name as PreRenderScene,
pairwise with RenderScene().
Change-Id: Iab820942aff1d136cef1ab111901dc99c7ccdcf7
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
{
for(auto&& scene : mScenes)
{
+ std::vector<Rect<int>> damagedRects;
+
+ mCore->PreRenderScene(scene, mScenePreRenderStatus, damagedRects);
mCore->RenderScene(mRenderStatus, scene, true /*render the off-screen buffers*/);
mCore->RenderScene(mRenderStatus, scene, false /*render the surface*/);
}
DoUpdate(intervalMilliseconds, location);
mCore->PreRender(mRenderStatus, false /*do not force clear*/);
- mCore->PreRender(mScene, damagedRects);
+ mCore->PreRenderScene(mScene, mScenePreRenderStatus, damagedRects);
return mStatus.KeepUpdating() || mRenderStatus.NeedsUpdate();
}
std::vector<Rect<int>> damagedRects;
Rect<int> clippingRect{};
- mCore->PreRender(scene, damagedRects);
+ mCore->PreRenderScene(scene, mScenePreRenderStatus, damagedRects);
mCore->RenderScene(mRenderStatus, scene, true /*render the off-screen buffers*/);
for(auto&& iter : damagedRects)
{
bool TestApplication::RenderOnly()
{
+ std::vector<Rect<int>> damagedRects;
+
// Update Time values
mCore->PreRender(mRenderStatus, false /*do not force clear*/);
+ mCore->PreRenderScene(mScene, mScenePreRenderStatus, damagedRects);
mCore->RenderScene(mRenderStatus, mScene, true /*render the off-screen buffers*/);
mCore->RenderScene(mRenderStatus, mScene, false /*render the surface*/);
mCore->PostRender();
#define DALI_TEST_APPLICATION_H
/*
- * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// INTERNAL INCLUDES
#include <dali/integration-api/resource-policies.h>
+#include <dali/integration-api/scene-pre-render-status.h>
#include <dali/integration-api/scene.h>
#include <dali/integration-api/trace.h>
TestGraphicsController mGraphicsController;
TestRenderSurface* mRenderSurface;
- Integration::UpdateStatus mStatus;
- Integration::RenderStatus mRenderStatus;
+ Integration::UpdateStatus mStatus;
+ Integration::RenderStatus mRenderStatus;
+ Integration::ScenePreRenderStatus mScenePreRenderStatus;
Integration::Core* mCore;
Dali::Integration::Scene mScene;
// INTERNAL INCLUDES
#include <dali/integration-api/events/event.h>
#include <dali/integration-api/processor-interface.h>
+#include <dali/integration-api/scene-pre-render-status.h>
#include <dali/internal/common/core-impl.h>
#include <dali/public-api/actors/layer.h>
#include <dali/public-api/common/dali-common.h>
mImpl->PreRender(status, forceClear);
}
-bool Core::PreRender(Integration::Scene& scene, std::vector<Rect<int>>& damagedRects)
+void Core::PreRenderScene(Integration::Scene& scene, Integration::ScenePreRenderStatus& status, std::vector<Rect<int>>& damagedRects)
{
- return mImpl->PreRender(scene, damagedRects);
+ mImpl->PreRenderScene(scene, status, damagedRects);
}
void Core::RenderScene(RenderStatus& status, Integration::Scene& scene, bool renderToFbo)
class Processor;
class RenderController;
class Scene;
+class ScenePreRenderStatus;
struct Event;
struct TouchEvent;
* 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] scene The scene to be rendered.
+ * @param[out] status The status of pre render operation.
* @param[out] damagedRects containing damaged render items rects for this pass.
* @return true if the scene has something to render, false if there is nothing to render
*/
- bool PreRender(Integration::Scene& scene, std::vector<Rect<int>>& damagedRects);
+ void PreRenderScene(Integration::Scene& scene, Integration::ScenePreRenderStatus& status, std::vector<Rect<int>>& damagedRects);
/**
* Render a scene in the next frame. This method should be preceded by a call up PreRender.
${platform_abstraction_src_dir}/resource-policies.h
${platform_abstraction_src_dir}/resource-types.h
${platform_abstraction_src_dir}/scene.h
+ ${platform_abstraction_src_dir}/scene-pre-render-status.h
${platform_abstraction_src_dir}/shader-integ.h
${platform_abstraction_src_dir}/testing.h
${platform_abstraction_src_dir}/texture-integ.h
--- /dev/null
+#ifndef DALI_SCENE_PRE_RENDER_STATUS_H
+#define DALI_SCENE_PRE_RENDER_STATUS_H
+
+/*
+ * Copyright (c) 2025 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <memory>
+
+// INTERNAL INCLUDES
+#include <dali/graphics-api/graphics-controller.h>
+#include <dali/graphics-api/graphics-render-target-create-info.h>
+#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/public-api/events/gesture-enumerations.h>
+#include <dali/public-api/math/vector2.h>
+#include <dali/public-api/math/vector4.h>
+#include <dali/public-api/object/handle.h>
+
+namespace Dali::Integration
+{
+/**
+* The status of the Core::PreRenderScene operation.
+*/
+class DALI_CORE_API ScenePreRenderStatus
+{
+public:
+ /**
+ * Constructor
+ */
+ ScenePreRenderStatus()
+ : hasRenderInstructionToScene(false),
+ hadRenderInstructionToScene(false)
+ {
+ }
+
+ void SetHasRenderInstructionToScene(bool renderInstructionExist)
+ {
+ hasRenderInstructionToScene = renderInstructionExist;
+ }
+
+ bool HasRenderInstructionToScene() const
+ {
+ return hasRenderInstructionToScene;
+ }
+
+ void SetHadRenderInstructionToScene(bool renderInstructionExisted)
+ {
+ hadRenderInstructionToScene = renderInstructionExisted;
+ }
+
+ bool HadRenderInstructionToScene() const
+ {
+ return hadRenderInstructionToScene;
+ }
+
+private:
+ bool hasRenderInstructionToScene : 1; ///< True if has render instruction to the scene.
+ bool hadRenderInstructionToScene : 1; ///< True if had render instruction to the scene.
+};
+
+} // namespace Dali::Integration
+
+#endif // DALI_SCENE_PRE_RENDER_STATUS_H
#include <dali/integration-api/platform-abstraction.h>
#include <dali/integration-api/processor-interface.h>
#include <dali/integration-api/render-controller.h>
+#include <dali/integration-api/scene-pre-render-status.h>
#include <dali/integration-api/trace.h>
#include <dali/internal/event/actors/actor-impl.h>
mRenderManager->PreRender(status, forceClear);
}
-bool Core::PreRender(Integration::Scene& scene, std::vector<Rect<int>>& damagedRects)
+void Core::PreRenderScene(Integration::Scene& scene, Integration::ScenePreRenderStatus& status, std::vector<Rect<int>>& damagedRects)
{
- return mRenderManager->PreRender(scene, damagedRects);
+ mRenderManager->PreRenderScene(scene, status, damagedRects);
}
void Core::RenderScene(RenderStatus& status, Integration::Scene& scene, bool renderToFbo)
class PlatformAbstraction;
class UpdateStatus;
class RenderStatus;
+class ScenePreRenderStatus;
struct Event;
struct TouchEvent;
} // namespace Integration
void PreRender(Integration::RenderStatus& status, bool forceClear);
/**
- * @copydoc Dali::Integration::Core::PreRender()
+ * @copydoc Dali::Integration::Core::PreRenderScene()
*/
- bool PreRender(Integration::Scene& scene, std::vector<Rect<int>>& damagedRects);
+ void PreRenderScene(Integration::Scene& scene, Integration::ScenePreRenderStatus& status, std::vector<Rect<int>>& damagedRects);
/**
* @copydoc Dali::Integration::Core::RenderScene()
// INTERNAL INCLUDES
#include <dali/integration-api/core.h>
#include <dali/integration-api/ordered-set.h>
+#include <dali/integration-api/scene-pre-render-status.h>
#include <dali/integration-api/trace.h>
#include <dali/public-api/common/vector-wrapper.h>
mImpl->commandBufferSubmitted = false;
}
-bool RenderManager::PreRender(Integration::Scene& scene, std::vector<Rect<int>>& damagedRects)
+void RenderManager::PreRenderScene(Integration::Scene& scene, Integration::ScenePreRenderStatus& status, std::vector<Rect<int>>& damagedRects)
{
- bool renderToScene = false;
Internal::Scene& sceneInternal = GetImplementation(scene);
Scene* sceneObject = sceneInternal.GetSceneObject();
if(!sceneObject)
{
// May not be a scene object if the window is being removed.
- return renderToScene;
+ return;
}
+ bool renderToScene = false;
const uint32_t instructionCount = sceneObject->GetRenderInstructions().Count(mImpl->renderBufferIndex);
for(uint32_t i = instructionCount; i > 0; --i)
{
}
}
+ status.SetHadRenderInstructionToScene(sceneObject->HasRenderInstructionToScene());
+ status.SetHasRenderInstructionToScene(renderToScene);
+ sceneObject->SetHasRenderInstructionToScene(renderToScene);
+
if(mImpl->partialUpdateAvailable != Integration::PartialUpdateAvailable::TRUE)
{
- return renderToScene;
+ return;
}
if(!sceneObject || sceneObject->IsRenderingSkipped())
{
DALI_LOG_RELEASE_INFO("RenderingSkipped was set true. Skip pre-rendering\n");
}
- return renderToScene;
+ return;
}
class DamagedRectsCleaner
// Clear all dirty rects
// The rects will be added when partial updated is enabled again
itemsDirtyRects.clear();
- return renderToScene;
+ return;
}
// Mark previous dirty rects in the std::unordered_map.
{
damagedRectCleaner.SetCleanOnReturn(false);
}
- return renderToScene;
}
void RenderManager::RenderScene(Integration::RenderStatus& status, Integration::Scene& scene, bool renderToFbo)
{
class RenderStatus;
class Scene;
+class ScenePreRenderStatus;
} // namespace Integration
struct Vector4;
* by a call up Update.
* Multi-threading note: this method should be called from a dedicated rendering thread.
* @pre The graphics implementation must be initialized
+ * @param[out] status The status of pre render operation.
* @param[in] scene The scene to be rendered.
* @param[out] damagedRects The list of damaged rects for the current render pass.
* @return True if this scene will present, false otherwise.
*/
- bool PreRender(Integration::Scene& scene, std::vector<Rect<int>>& damagedRects);
+ void PreRenderScene(Integration::Scene& scene, Integration::ScenePreRenderStatus& status, std::vector<Rect<int>>& damagedRects);
// This method should be called from Core::RenderScene()
mRotationCompletedAcknowledgement(false),
mSkipRendering(false),
mNeedFullUpdate(false),
- mPartialUpdateEnabled(true)
+ mPartialUpdateEnabled(true),
+ mHasRenderInstructionToScene(false)
{
}
return mNeedFullUpdate;
}
+ void SetHasRenderInstructionToScene(bool renderInstructionExist)
+ {
+ mHasRenderInstructionToScene = renderInstructionExist;
+ }
+
+ bool HasRenderInstructionToScene() const
+ {
+ return mHasRenderInstructionToScene;
+ }
+
/**
* Get the render target created for the scene
*
float mKeepRenderingSeconds{0.0f}; ///< Time to keep rendering
- bool mRotationCompletedAcknowledgement; ///< The flag of sending the acknowledgement to complete window rotation.
- bool mSkipRendering; ///< A flag to skip rendering
- bool mNeedFullUpdate; ///< A flag to update full area
- bool mPartialUpdateEnabled; ///< True if the partial update is enabled
+ bool mRotationCompletedAcknowledgement : 1; ///< The flag of sending the acknowledgement to complete window rotation.
+ bool mSkipRendering : 1; ///< A flag to skip rendering
+ bool mNeedFullUpdate : 1; ///< A flag to update full area
+ bool mPartialUpdateEnabled : 1; ///< True if the partial update is enabled
+ bool mHasRenderInstructionToScene : 1; ///< True if has render instruction to the scene. Update at PreRender time.
// Render target, command buffer and render passes