Support surfaceless context for OpenGL ES 2
[platform/core/uifw/dali-adaptor.git] / dali / internal / graphics / gles / egl-graphics.h
1 #ifndef DALI_INTERNAL_BASE_GRAPHICS_IMPLEMENTATION_H
2 #define DALI_INTERNAL_BASE_GRAPHICS_IMPLEMENTATION_H
3
4 /*
5  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22
23 // INTERNAL INCLUDES
24 #include <dali/internal/graphics/common/graphics-interface.h>
25 #include <dali/internal/graphics/gles/gl-proxy-implementation.h>
26 #include <dali/internal/graphics/gles/gl-implementation.h>
27 #include <dali/integration-api/egl-interface.h>
28
29 #include <dali/internal/graphics/gles/egl-implementation.h>
30 #include <dali/internal/graphics/common/egl-image-extensions.h>
31 #include <dali/internal/graphics/gles/egl-sync-implementation.h>
32
33
34 namespace Dali
35 {
36
37 namespace Internal
38 {
39
40 namespace Adaptor
41 {
42
43 class EglGraphics : public GraphicsInterface
44 {
45 public:
46
47   /**
48    * Constructor
49    */
50   EglGraphics();
51
52   /**
53    * Destructor
54    */
55   virtual ~EglGraphics();
56
57   /**
58    * @copydoc Dali::Internal::Adaptor::GraphicsInterface::Initialize()
59    */
60   void Initialize( EnvironmentOptions* environmentOptions ) override;
61
62   /**
63    * Creates the graphics interface for EGL
64    * @return The graphics interface for EGL
65    */
66   EglInterface* Create();
67
68   /**
69    * Set gles version
70    * Default version is gles 3.0
71    */
72   void SetGlesVersion( const int32_t glesVersion );
73
74   /**
75    * Set whether the surfaceless context is supported
76    * @param[in] isSupported Whether the surfaceless context is supported
77    */
78   void SetIsSurfacelessContextSupported( const bool isSupported );
79
80   /**
81    * Gets the GL abstraction
82    * @return The GL abstraction
83    */
84   Integration::GlAbstraction& GetGlAbstraction() const;
85
86   /**
87    * Gets the implementation of EGL
88    * @return The implementation of EGL
89    */
90   EglImplementation& GetEglImplementation() const;
91
92   /**
93    * Gets the graphics interface for EGL
94    * @return The graphics interface for EGL
95    */
96   EglInterface& GetEglInterface() const;
97
98   /**
99    * @copydoc Dali::Integration::GlAbstraction& GetGlesInterface()
100    */
101   GlImplementation& GetGlesInterface();
102
103   /**
104    * Gets the implementation of GlSyncAbstraction for EGL.
105    * @return The implementation of GlSyncAbstraction for EGL.
106    */
107   EglSyncImplementation& GetSyncImplementation();
108
109   /**
110    * @copydoc Dali::Internal::Adaptor::GraphicsInterface::GetDepthBufferRequired()
111    */
112   Integration::DepthBufferAvailable& GetDepthBufferRequired();
113
114   /**
115    * @copydoc Dali::Internal::Adaptor::GraphicsInterface::GetStencilBufferRequired()
116    */
117   Integration::StencilBufferAvailable GetStencilBufferRequired();
118
119   /**
120    * Gets the EGL image extension
121    * @return The EGL image extension
122    */
123   EglImageExtensions* GetImageExtensions();
124
125   /**
126    * @copydoc Dali::Internal::Adaptor::GraphicsInterface::Destroy()
127    */
128   void Destroy() override;
129
130 private:
131   // Eliminate copy and assigned operations
132   EglGraphics(const EglGraphics& rhs) = delete;
133   EglGraphics& operator=(const EglGraphics& rhs) = delete;
134
135
136 private:
137   std::unique_ptr< GlImplementation > mGLES;                    ///< GL implementation
138   std::unique_ptr< EglImplementation > mEglImplementation;      ///< EGL implementation
139   std::unique_ptr< EglImageExtensions > mEglImageExtensions;    ///< EGL image extension
140   std::unique_ptr< EglSyncImplementation > mEglSync;            ///< GlSyncAbstraction implementation for EGL
141
142   int mMultiSamplingLevel;                                      ///< The multiple sampling level
143 };
144
145 } // namespace Adaptor
146
147 } // namespace Internal
148
149 } // namespace Dali
150
151 #endif // __DALI_INTERNAL_BASE_GRAPHICS_IMPLEMENTATION_H__