From a9e61cb6033d6887f9c74711812bed827a543685 Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Thu, 23 May 2024 17:27:59 +0900 Subject: [PATCH] Control core policy as one flag Let we collect core creation status, instead of parameter increasement. It will be useful when we add more features of Core. Change-Id: I746bdb714eac5dcbd792a1a33a93abd2b96fe4cb Signed-off-by: Eunki, Hong --- .../dali-test-suite-utils/test-application.cpp | 11 +++++++---- dali/integration-api/core-enumerations.h | 22 +++++++++++++++++++++- dali/integration-api/core.cpp | 16 +++++----------- dali/integration-api/core.h | 16 +++++----------- dali/internal/common/core-impl.cpp | 20 +++++++++----------- dali/internal/common/core-impl.h | 11 ++++------- 6 files changed, 51 insertions(+), 45 deletions(-) diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-application.cpp b/automated-tests/src/dali/dali-test-suite-utils/test-application.cpp index 496fc3b..71bc051 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-application.cpp +++ b/automated-tests/src/dali/dali-test-suite-utils/test-application.cpp @@ -55,13 +55,16 @@ void TestApplication::CreateCore() // We always need the first update! mStatus.keepUpdating = Integration::KeepUpdating::STAGE_KEEP_RENDERING; + Integration::CorePolicyFlags corePolicyFlags = Integration::CorePolicyFlags::DEPTH_BUFFER_AVAILABLE | Integration::CorePolicyFlags::STENCIL_BUFFER_AVAILABLE; + if(mPartialUpdateEnabled) + { + corePolicyFlags |= Integration::CorePolicyFlags::PARTIAL_UPDATE_AVAILABLE; + } + mCore = Dali::Integration::Core::New(mRenderController, mPlatformAbstraction, mGraphicsController, - Integration::RenderToFrameBuffer::FALSE, - Integration::DepthBufferAvailable::TRUE, - Integration::StencilBufferAvailable::TRUE, - mPartialUpdateEnabled ? Integration::PartialUpdateAvailable::TRUE : Integration::PartialUpdateAvailable::FALSE); + corePolicyFlags); mCore->ContextCreated(); diff --git a/dali/integration-api/core-enumerations.h b/dali/integration-api/core-enumerations.h index afe1112..ff67576 100644 --- a/dali/integration-api/core-enumerations.h +++ b/dali/integration-api/core-enumerations.h @@ -2,7 +2,7 @@ #define DALI_INTEGRATION_CORE_ENUMERATIONS_H /* - * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 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. @@ -19,6 +19,7 @@ */ // EXTERNAL INCLUDES +#include #include #include #include @@ -66,8 +67,27 @@ enum class PartialUpdateAvailable TRUE }; +/** + * The additional policy of core update / rendering process. + * @note Policy cannot be changed after the Core initialized. + */ +enum class CorePolicyFlags +{ + DEFAULT = 0, ///< Zero means that no additional policy is set. + RENDER_TO_FRAME_BUFFER = 1 << 0, ///< Whether we should render to the frame-buffer or not. + DEPTH_BUFFER_AVAILABLE = 1 << 1, ///< Whether the depth buffer is available or not. + STENCIL_BUFFER_AVAILABLE = 1 << 2, ///< Whether the stencil buffer is available or not. + PARTIAL_UPDATE_AVAILABLE = 1 << 3, ///< Whether the partial update is available or not. +}; + } // namespace Integration +// specialization has to be done in the same namespace +template<> +struct EnableBitMaskOperators +{ + static const bool ENABLE = true; +}; } // namespace Dali #endif // DALI_INTEGRATION_CORE_ENUMERATIONS_H diff --git a/dali/integration-api/core.cpp b/dali/integration-api/core.cpp index a1c47dc..02520f0 100644 --- a/dali/integration-api/core.cpp +++ b/dali/integration-api/core.cpp @@ -30,22 +30,16 @@ namespace Dali { namespace Integration { -Core* Core::New(RenderController& renderController, - PlatformAbstraction& platformAbstraction, - Graphics::Controller& graphicsController, - RenderToFrameBuffer renderToFboEnabled, - DepthBufferAvailable depthBufferAvailable, - StencilBufferAvailable stencilBufferAvailable, - PartialUpdateAvailable partialUpdateAvailable) +Core* Core::New(RenderController& renderController, + PlatformAbstraction& platformAbstraction, + Graphics::Controller& graphicsController, + CorePolicyFlags corePolicy) { Core* instance = new Core; instance->mImpl = new Internal::Core(renderController, platformAbstraction, graphicsController, - renderToFboEnabled, - depthBufferAvailable, - stencilBufferAvailable, - partialUpdateAvailable); + corePolicy); return instance; } diff --git a/dali/integration-api/core.h b/dali/integration-api/core.h index d570f9b..1075bc6 100644 --- a/dali/integration-api/core.h +++ b/dali/integration-api/core.h @@ -221,19 +221,13 @@ public: * @param[in] renderController The interface to an object which controls rendering. * @param[in] platformAbstraction The interface providing platform specific services. * @param[in] graphicsController The interface providing graphics services - * @param[in] renderToFboEnabled Whether rendering into the Frame Buffer Object is enabled. - * @param[in] depthBufferAvailable Whether the depth buffer is available - * @param[in] stencilBufferAvailable Whether the stencil buffer is available - * @param[in] partialUpdateAvailable Whether the partial update is available + * @param[in] corePolicy Flag list of update / rendering policies. * @return A newly allocated Core. */ - static Core* New(RenderController& renderController, - PlatformAbstraction& platformAbstraction, - Graphics::Controller& graphicsController, - RenderToFrameBuffer renderToFboEnabled, - DepthBufferAvailable depthBufferAvailable, - StencilBufferAvailable stencilBufferAvailable, - PartialUpdateAvailable partialUpdateAvailable); + static Core* New(RenderController& renderController, + PlatformAbstraction& platformAbstraction, + Graphics::Controller& graphicsController, + CorePolicyFlags corePolicy); /** * Non-virtual destructor. Core is not intended as a base class. diff --git a/dali/internal/common/core-impl.cpp b/dali/internal/common/core-impl.cpp index 3717aa7..6143a31 100644 --- a/dali/internal/common/core-impl.cpp +++ b/dali/internal/common/core-impl.cpp @@ -75,13 +75,10 @@ using Integration::RenderController; using Integration::RenderStatus; using Integration::UpdateStatus; -Core::Core(RenderController& renderController, - PlatformAbstraction& platform, - Graphics::Controller& graphicsController, - Integration::RenderToFrameBuffer renderToFboEnabled, - Integration::DepthBufferAvailable depthBufferAvailable, - Integration::StencilBufferAvailable stencilBufferAvailable, - Integration::PartialUpdateAvailable partialUpdateAvailable) +Core::Core(RenderController& renderController, + PlatformAbstraction& platform, + Graphics::Controller& graphicsController, + Integration::CorePolicyFlags corePolicy) : mRenderController(renderController), mPlatform(platform), mGraphicsController(graphicsController), @@ -104,7 +101,10 @@ Core::Core(RenderController& renderController, mRenderTaskProcessor = new SceneGraph::RenderTaskProcessor(); - mRenderManager = RenderManager::New(graphicsController, depthBufferAvailable, stencilBufferAvailable, partialUpdateAvailable); + mRenderManager = RenderManager::New(graphicsController, + (corePolicy & Integration::CorePolicyFlags::DEPTH_BUFFER_AVAILABLE) ? Integration::DepthBufferAvailable::TRUE : Integration::DepthBufferAvailable::FALSE, + (corePolicy & Integration::CorePolicyFlags::STENCIL_BUFFER_AVAILABLE) ? Integration::StencilBufferAvailable::TRUE : Integration::StencilBufferAvailable::FALSE, + (corePolicy & Integration::CorePolicyFlags::PARTIAL_UPDATE_AVAILABLE) ? Integration::PartialUpdateAvailable::TRUE : Integration::PartialUpdateAvailable::FALSE); RenderQueue& renderQueue = mRenderManager->GetRenderQueue(); @@ -132,9 +132,7 @@ Core::Core(RenderController& renderController, GetImplementation(Dali::TypeRegistry::Get()).CallInitFunctions(); - DALI_LOG_RELEASE_INFO("Node size: %lu\n", sizeof(Dali::Internal::SceneGraph::Node)); - DALI_LOG_RELEASE_INFO("Renderer size: %lu\n", sizeof(Dali::Internal::SceneGraph::Renderer)); - DALI_LOG_RELEASE_INFO("RenderItem size: %lu\n", sizeof(Dali::Internal::SceneGraph::RenderItem)); + DALI_LOG_RELEASE_INFO("Core policy enum : 0x%x\n", static_cast(corePolicy)); } Core::~Core() diff --git a/dali/internal/common/core-impl.h b/dali/internal/common/core-impl.h index 4c69743..f393e83 100644 --- a/dali/internal/common/core-impl.h +++ b/dali/internal/common/core-impl.h @@ -76,13 +76,10 @@ public: /** * Create and initialise a new Core instance */ - Core(Integration::RenderController& renderController, - Integration::PlatformAbstraction& platform, - Graphics::Controller& graphicsController, - Integration::RenderToFrameBuffer renderToFboEnabled, - Integration::DepthBufferAvailable depthBufferAvailable, - Integration::StencilBufferAvailable stencilBufferAvailable, - Integration::PartialUpdateAvailable partialUpdateAvailable); + Core(Integration::RenderController& renderController, + Integration::PlatformAbstraction& platform, + Graphics::Controller& graphicsController, + Integration::CorePolicyFlags corePolicy); /** * Destructor -- 2.7.4