717ffc2eeb0f29d255e3a6255a002a0de393eff0
[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    * Gets the GL abstraction
76    * @return The GL abstraction
77    */
78   Integration::GlAbstraction& GetGlAbstraction() const;
79
80   /**
81    * Gets the implementation of EGL
82    * @return The implementation of EGL
83    */
84   EglImplementation& GetEglImplementation() const;
85
86   /**
87    * Gets the graphics interface for EGL
88    * @return The graphics interface for EGL
89    */
90   EglInterface& GetEglInterface() const;
91
92   /**
93    * @copydoc Dali::Integration::GlAbstraction& GetGlesInterface()
94    */
95   GlImplementation& GetGlesInterface();
96
97   /**
98    * Gets the implementation of GlSyncAbstraction for EGL.
99    * @return The implementation of GlSyncAbstraction for EGL.
100    */
101   EglSyncImplementation& GetSyncImplementation();
102
103   /**
104    * @copydoc Dali::Internal::Adaptor::GraphicsInterface::GetDepthBufferRequired()
105    */
106   Integration::DepthBufferAvailable& GetDepthBufferRequired();
107
108   /**
109    * @copydoc Dali::Internal::Adaptor::GraphicsInterface::GetStencilBufferRequired()
110    */
111   Integration::StencilBufferAvailable GetStencilBufferRequired();
112
113   /**
114    * Gets the EGL image extension
115    * @return The EGL image extension
116    */
117   EglImageExtensions* GetImageExtensions();
118
119   /**
120    * @copydoc Dali::Internal::Adaptor::GraphicsInterface::Destroy()
121    */
122   void Destroy() override;
123
124 private:
125   // Eliminate copy and assigned operations
126   EglGraphics(const EglGraphics& rhs) = delete;
127   EglGraphics& operator=(const EglGraphics& rhs) = delete;
128
129
130 private:
131   std::unique_ptr< GlImplementation > mGLES;                    ///< GL implementation
132   std::unique_ptr< EglImplementation > mEglImplementation;      ///< EGL implementation
133   std::unique_ptr< EglImageExtensions > mEglImageExtensions;    ///< EGL image extension
134   std::unique_ptr< EglSyncImplementation > mEglSync;            ///< GlSyncAbstraction implementation for EGL
135
136   int mMultiSamplingLevel;                                      ///< The multiple sampling level
137 };
138
139 } // namespace Adaptor
140
141 } // namespace Internal
142
143 } // namespace Dali
144
145 #endif // __DALI_INTERNAL_BASE_GRAPHICS_IMPLEMENTATION_H__