Memory Pool Logging
[platform/core/uifw/dali-adaptor.git] / dali / internal / graphics / common / graphics-interface.h
index 5e80ef7..53fa462 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_BASE_GRAPHICS_INTERFACE_H
 
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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/internal/system/common/environment-options.h>
+#include <dali/graphics-api/graphics-controller.h>
 #include <dali/integration-api/core-enumerations.h>
+#include <dali/internal/system/common/environment-options.h>
 
 namespace Dali
 {
+class RenderSurfaceInterface;
 
 namespace Internal
 {
-
 namespace Adaptor
 {
+class ConfigurationManager;
 
 /**
  * Factory interface for creating Graphics Factory implementation
@@ -37,24 +39,78 @@ namespace Adaptor
 class GraphicsInterface
 {
 public:
-
   /**
    * Constructor
    */
   GraphicsInterface()
-: mDepthBufferRequired( Integration::DepthBufferAvailable::FALSE ),
-  mStencilBufferRequired( Integration::StencilBufferAvailable::FALSE )
-  {
-  };
+  : mDepthBufferRequired(Integration::DepthBufferAvailable::FALSE),
+    mStencilBufferRequired(Integration::StencilBufferAvailable::FALSE),
+    mPartialUpdateRequired(Integration::PartialUpdateAvailable::FALSE){};
+
+  /**
+   * Destructor
+   */
+  virtual ~GraphicsInterface() = default;
+
+  /**
+   * Returns controller object
+   * @return
+   */
+  virtual Dali::Graphics::Controller& GetController() = 0;
+
+  /**
+   * Initialize the graphics subsystem, configured from environment
+   */
+  virtual void Initialize() = 0;
+
+  /**
+   * Initialize the graphics subsystem, providing explicit parameters.
+   *
+   * @param[in] depth True if depth buffer is required
+   * @param[in] stencil True if stencil buffer is required
+   * @param[in] partialRendering True if partial rendering is required
+   * @param[in] msaa level of anti-aliasing required (-1 = off)
+   */
+  virtual void Initialize(bool depth, bool stencil, bool partialRendering, int msaa) = 0;
 
   /**
-   * Initialize the graphics interface
-   * @param[in]  environmentOptions  The environment options.
+   * Configure the graphics surface
+   *
+   * @param[in] surface The surface to configure, or NULL if not present
    */
-  virtual void Initialize( EnvironmentOptions* environmentOptions ) = 0;
+  virtual void ConfigureSurface(Dali::RenderSurfaceInterface* surface) = 0;
 
   /**
-   * Destroy the Graphics Factory implementation
+   * Activate the resource context
+   */
+  virtual void ActivateResourceContext() = 0;
+
+  /**
+   * Activate the surface context
+   *
+   * @param[in] surface The surface whose context to be switched to.
+   */
+  virtual void ActivateSurfaceContext(Dali::RenderSurfaceInterface* surface) = 0;
+
+  /**
+   * Inform graphics interface that all the surfaces have been rendered.
+   *
+   * @note This should not be called if uploading resource only without rendering any surface.
+   */
+  virtual void PostRender() = 0;
+
+  /**
+   * Inform graphics interface that this is the first frame after a resume.
+   */
+  virtual void SetFirstFrameAfterResume() = 0;
+
+  /**
+   * Shut down the graphics implementation
+   */
+  virtual void Shutdown() = 0;
+
+  /**
+   * Destroy the Graphics implementation
    */
   virtual void Destroy() = 0;
 
@@ -76,23 +132,75 @@ public:
     return mStencilBufferRequired;
   };
 
-protected:
   /**
-   * Virtual protected destructor - no deletion through this interface
+   * Get whether the stencil buffer is required
+   * @return TRUE if the stencil buffer is required
    */
-  virtual ~GraphicsInterface() {};
+  Integration::PartialUpdateAvailable GetPartialUpdateRequired()
+  {
+    return mPartialUpdateRequired;
+  };
 
+  /**
+   * @return true if advanced blending options are supported
+   */
+  virtual bool IsAdvancedBlendEquationSupported() = 0;
 
-protected:
+  /**
+   * @return true if multisampled render to texture is supported
+   */
+  virtual bool IsMultisampledRenderToTextureSupported() = 0;
+
+  /**
+   * @return true if graphics subsystem is initialized
+   */
+  virtual bool IsInitialized() = 0;
+
+  /**
+   * @return true if a separate resource context is supported
+   */
+  virtual bool IsResourceContextSupported() = 0;
+
+  /**
+   * @return the maximum texture size
+   */
+  virtual uint32_t GetMaxTextureSize() = 0;
 
-  Integration::DepthBufferAvailable mDepthBufferRequired;       ///< Whether the depth buffer is required
-  Integration::StencilBufferAvailable mStencilBufferRequired;   ///< Whether the stencil buffer is required
+  /**
+   * @return the maximum texture samples when we use multisampled texture
+   */
+  virtual uint8_t GetMaxTextureSamples() = 0;
+
+  /**
+   * @return the version number of the shader language
+   */
+  virtual uint32_t GetShaderLanguageVersion() = 0;
+
+  /**
+   * Store cached configurations
+   */
+  virtual void CacheConfigurations(ConfigurationManager& configurationManager) = 0;
+
+  /**
+   * Initialize data for logging frame info
+   */
+  virtual void FrameStart() = 0;
+
+  /**
+   * Log total capacity of memory pools during this frame
+   */
+  virtual void LogMemoryPools() = 0;
+
+protected:
+  Integration::DepthBufferAvailable   mDepthBufferRequired;   ///< Whether the depth buffer is required
+  Integration::StencilBufferAvailable mStencilBufferRequired; ///< Whether the stencil buffer is required
+  Integration::PartialUpdateAvailable mPartialUpdateRequired; ///< Whether the partial update is required
 };
 
-} // Adaptor
+} // namespace Adaptor
 
-} // Internal
+} // namespace Internal
 
-} // Dali
+} // namespace Dali
 
 #endif // DALI_INTERNAL_BASE_GRAPHICS_INTERFACE_H