1 #ifndef DALI_INTERNAL_BASE_GRAPHICS_INTERFACE_H
2 #define DALI_INTERNAL_BASE_GRAPHICS_INTERFACE_H
5 * Copyright (c) 2021 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 * Inform graphics interface that this is the first frame after a resume.
91 virtual void SetFirstFrameAfterResume() = 0;
94 * Shut down the graphics implementation
96 virtual void Shutdown() = 0;
99 * Destroy the Graphics implementation
101 virtual void Destroy() = 0;
104 * Get whether the depth buffer is required
105 * @return TRUE if the depth buffer is required
107 Integration::DepthBufferAvailable& GetDepthBufferRequired()
109 return mDepthBufferRequired;
113 * Get whether the stencil buffer is required
114 * @return TRUE if the stencil buffer is required
116 Integration::StencilBufferAvailable GetStencilBufferRequired()
118 return mStencilBufferRequired;
122 * Get whether the stencil buffer is required
123 * @return TRUE if the stencil buffer is required
125 Integration::PartialUpdateAvailable GetPartialUpdateRequired()
127 return mPartialUpdateRequired;
131 * @return true if advanced blending options are supported
133 virtual bool IsAdvancedBlendEquationSupported() = 0;
136 * @return true if graphics subsystem is initialized
138 virtual bool IsInitialized() = 0;
141 * @return true if a separate resource context is supported
143 virtual bool IsResourceContextSupported() = 0;
146 * @return the maximum texture size
148 virtual uint32_t GetMaxTextureSize() = 0;
151 * @return the version number of the shader language
153 virtual uint32_t GetShaderLanguageVersion() = 0;
156 * Store cached configurations
158 virtual void CacheConfigurations(ConfigurationManager& configurationManager) = 0;
161 Integration::DepthBufferAvailable mDepthBufferRequired; ///< Whether the depth buffer is required
162 Integration::StencilBufferAvailable mStencilBufferRequired; ///< Whether the stencil buffer is required
163 Integration::PartialUpdateAvailable mPartialUpdateRequired; ///< Whether the partial update is required
166 } // namespace Adaptor
168 } // namespace Internal
172 #endif // DALI_INTERNAL_BASE_GRAPHICS_INTERFACE_H