1 #ifndef DALI_INTERNAL_BASE_GRAPHICS_IMPLEMENTATION_H
2 #define DALI_INTERNAL_BASE_GRAPHICS_IMPLEMENTATION_H
5 * Copyright (c) 2019 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/integration-api/adaptor-framework/egl-interface.h>
23 #include <dali/internal/graphics/common/egl-image-extensions.h>
24 #include <dali/internal/graphics/common/graphics-interface.h>
25 #include <dali/internal/graphics/gles/gl-implementation.h>
26 #include <dali/internal/graphics/gles/gl-proxy-implementation.h>
27 #include <dali/internal/graphics/gles/egl-context-helper-implementation.h>
28 #include <dali/internal/graphics/gles/egl-implementation.h>
29 #include <dali/internal/graphics/gles/egl-sync-implementation.h>
40 class EglGraphics : public GraphicsInterface
52 virtual ~EglGraphics();
55 * @copydoc Dali::Internal::Adaptor::GraphicsInterface::Initialize()
57 void Initialize( EnvironmentOptions* environmentOptions ) override;
60 * Initialize the graphics interface with specific input parameters
61 * @param[in] depth The flag to enable depth buffer
62 * @param[in] stencil The flag to enable stencil buffer
63 * @param[in] msaa The value of multi sampleing bit
65 void Initialize( bool depth, bool stencil, int msaa );
68 * Creates the graphics interface for EGL
69 * @return The graphics interface for EGL
71 EglInterface* Create();
75 * Default version is gles 3.0
77 void SetGlesVersion( const int32_t glesVersion );
80 * Set whether the surfaceless context is supported
81 * @param[in] isSupported Whether the surfaceless context is supported
83 void SetIsSurfacelessContextSupported( const bool isSupported );
86 * Gets the GL abstraction
87 * @return The GL abstraction
89 Integration::GlAbstraction& GetGlAbstraction() const;
92 * Gets the implementation of EGL
93 * @return The implementation of EGL
95 EglImplementation& GetEglImplementation() const;
98 * Gets the graphics interface for EGL
99 * @return The graphics interface for EGL
101 EglInterface& GetEglInterface() const;
104 * @copydoc Dali::Integration::GlAbstraction& GetGlesInterface()
106 GlImplementation& GetGlesInterface();
109 * Gets the implementation of GlSyncAbstraction for EGL.
110 * @return The implementation of GlSyncAbstraction for EGL.
112 EglSyncImplementation& GetSyncImplementation();
115 * Gets the implementation of GlContextHelperAbstraction for EGL.
116 * @return The implementation of GlContextHelperAbstraction for EGL.
118 EglContextHelperImplementation& GetContextHelperImplementation();
121 * @copydoc Dali::Internal::Adaptor::GraphicsInterface::GetDepthBufferRequired()
123 Integration::DepthBufferAvailable& GetDepthBufferRequired();
126 * @copydoc Dali::Internal::Adaptor::GraphicsInterface::GetStencilBufferRequired()
128 Integration::StencilBufferAvailable GetStencilBufferRequired();
131 * Gets the EGL image extension
132 * @return The EGL image extension
134 EglImageExtensions* GetImageExtensions();
137 * Sets fixed damaged areas for partial rendering. This overrides automatic partial rendering.
139 void SetDamagedAreas( std::vector<Dali::Rect<int>>& areas );
142 * Instructs egl implementation to do full swap regardless of stored data, resets the data.
144 void SetFullSwapNextFrame();
147 * @copydoc Dali::Internal::Adaptor::GraphicsInterface::Destroy()
149 void Destroy() override;
152 // Eliminate copy and assigned operations
153 EglGraphics(const EglGraphics& rhs) = delete;
154 EglGraphics& operator=(const EglGraphics& rhs) = delete;
158 std::unique_ptr< GlImplementation > mGLES; ///< GL implementation
159 std::unique_ptr< EglImplementation > mEglImplementation; ///< EGL implementation
160 std::unique_ptr< EglImageExtensions > mEglImageExtensions; ///< EGL image extension
161 std::unique_ptr< EglSyncImplementation > mEglSync; ///< GlSyncAbstraction implementation for EGL
162 std::unique_ptr< EglContextHelperImplementation > mEglContextHelper; ///< GlContextHelperAbstraction implementation for EGL
164 int mMultiSamplingLevel; ///< The multiple sampling level
167 } // namespace Adaptor
169 } // namespace Internal
173 #endif // DALI_INTERNAL_BASE_GRAPHICS_IMPLEMENTATION_H