1 #ifndef DALI_INTERNAL_BASE_GRAPHICS_INTERFACE_H
2 #define DALI_INTERNAL_BASE_GRAPHICS_INTERFACE_H
5 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/graphics-api/graphics-controller.h>
23 #include <dali/integration-api/core-enumerations.h>
24 #include <dali/internal/system/common/environment-options.h>
28 class RenderSurfaceInterface;
34 class ConfigurationManager;
37 * Factory interface for creating Graphics Factory implementation
39 class GraphicsInterface
46 : mDepthBufferRequired(Integration::DepthBufferAvailable::FALSE),
47 mStencilBufferRequired(Integration::StencilBufferAvailable::FALSE),
48 mPartialUpdateRequired(Integration::PartialUpdateAvailable::FALSE){};
53 virtual ~GraphicsInterface() = default;
56 * Returns controller object
59 virtual Dali::Graphics::Controller& GetController() = 0;
62 * Initialize the graphics subsystem, configured from environment
64 virtual void Initialize() = 0;
67 * Initialize the graphics subsystem, providing explicit parameters.
69 * @param[in] depth True if depth buffer is required
70 * @param[in] stencil True if stencil buffer is required
71 * @param[in] partialRendering True if partial rendering is required
72 * @param[in] msaa level of anti-aliasing required (-1 = off)
74 virtual void Initialize(bool depth, bool stencil, bool partialRendering, int msaa) = 0;
77 * Configure the graphics surface
79 * @param[in] surface The surface to configure, or NULL if not present
81 virtual void ConfigureSurface(Dali::RenderSurfaceInterface* surface) = 0;
84 * Activate the resource context
86 virtual void ActivateResourceContext() = 0;
89 * Activate the surface context
91 * @param[in] surface The surface whose context to be switched to.
93 virtual void ActivateSurfaceContext(Dali::RenderSurfaceInterface* surface) = 0;
96 * Inform graphics interface that all the surfaces have been rendered.
98 * @note This should not be called if uploading resource only without rendering any surface.
100 virtual void PostRender() = 0;
103 * Inform graphics interface that this is the first frame after a resume.
105 virtual void SetFirstFrameAfterResume() = 0;
108 * Shut down the graphics implementation
110 virtual void Shutdown() = 0;
113 * Destroy the Graphics implementation
115 virtual void Destroy() = 0;
118 * Get whether the depth buffer is required
119 * @return TRUE if the depth buffer is required
121 Integration::DepthBufferAvailable& GetDepthBufferRequired()
123 return mDepthBufferRequired;
127 * Get whether the stencil buffer is required
128 * @return TRUE if the stencil buffer is required
130 Integration::StencilBufferAvailable GetStencilBufferRequired()
132 return mStencilBufferRequired;
136 * Get whether the stencil buffer is required
137 * @return TRUE if the stencil buffer is required
139 Integration::PartialUpdateAvailable GetPartialUpdateRequired()
141 return mPartialUpdateRequired;
145 * @return true if advanced blending options are supported
147 virtual bool IsAdvancedBlendEquationSupported() = 0;
150 * @return true if multisampled render to texture is supported
152 virtual bool IsMultisampledRenderToTextureSupported() = 0;
155 * @return true if graphics subsystem is initialized
157 virtual bool IsInitialized() = 0;
160 * @return true if a separate resource context is supported
162 virtual bool IsResourceContextSupported() = 0;
165 * @return the maximum texture size
167 virtual uint32_t GetMaxTextureSize() = 0;
170 * @return the maximum number of combined texture units
172 virtual uint32_t GetMaxCombinedTextureUnits() = 0;
175 * @return the maximum texture samples when we use multisampled texture
177 virtual uint8_t GetMaxTextureSamples() = 0;
180 * @return the version number of the shader language
182 virtual uint32_t GetShaderLanguageVersion() = 0;
185 * Store cached configurations
187 virtual void CacheConfigurations(ConfigurationManager& configurationManager) = 0;
190 * Initialize data for logging frame info
192 virtual void FrameStart() = 0;
195 * Log total capacity of memory pools during this frame
197 virtual void LogMemoryPools() = 0;
200 Integration::DepthBufferAvailable mDepthBufferRequired; ///< Whether the depth buffer is required
201 Integration::StencilBufferAvailable mStencilBufferRequired; ///< Whether the stencil buffer is required
202 Integration::PartialUpdateAvailable mPartialUpdateRequired; ///< Whether the partial update is required
205 } // namespace Adaptor
207 } // namespace Internal
211 #endif // DALI_INTERNAL_BASE_GRAPHICS_INTERFACE_H