Control core policy as one flag 71/311671/1
authorEunki, Hong <eunkiki.hong@samsung.com>
Thu, 23 May 2024 08:27:59 +0000 (17:27 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Thu, 23 May 2024 08:27:59 +0000 (17:27 +0900)
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 <eunkiki.hong@samsung.com>
automated-tests/src/dali/dali-test-suite-utils/test-application.cpp
dali/integration-api/core-enumerations.h
dali/integration-api/core.cpp
dali/integration-api/core.h
dali/internal/common/core-impl.cpp
dali/internal/common/core-impl.h

index 496fc3b..71bc051 100644 (file)
@@ -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();
 
index afe1112..ff67576 100644 (file)
@@ -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 <dali/devel-api/common/bitwise-enum.h>
 #include <dali/integration-api/context-notifier.h>
 #include <dali/integration-api/resource-policies.h>
 #include <dali/public-api/common/dali-common.h>
@@ -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<Integration::CorePolicyFlags>
+{
+  static const bool ENABLE = true;
+};
 } // namespace Dali
 
 #endif // DALI_INTEGRATION_CORE_ENUMERATIONS_H
index a1c47dc..02520f0 100644 (file)
@@ -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;
 }
index d570f9b..1075bc6 100644 (file)
@@ -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.
index 3717aa7..6143a31 100644 (file)
@@ -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<uint32_t>(corePolicy));
 }
 
 Core::~Core()
index 4c69743..f393e83 100644 (file)
@@ -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