Revert "[Tizen] Do not call gl functions during shutdown"
[platform/core/uifw/dali-adaptor.git] / dali / internal / graphics / common / egl-image-extensions.h
1 #ifndef DALI_INTERNAL_EGL_IMAGE_EXTENSIONS_H
2 #define DALI_INTERNAL_EGL_IMAGE_EXTENSIONS_H
3
4 /*
5  * Copyright (c) 2021 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 #include <dali/public-api/images/pixel.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/internal/graphics/common/egl-include.h>
26
27 namespace Dali
28 {
29 namespace Internal
30 {
31 namespace Adaptor
32 {
33 class EglImplementation;
34
35 /**
36  * EglImageExtensions class provides EGL image extension support
37  */
38 class EglImageExtensions
39 {
40 public:
41   /**
42    * Constructor
43    */
44   EglImageExtensions(EglImplementation* impl);
45
46   /**
47    * Destructor
48    */
49   ~EglImageExtensions();
50
51 public: // EGLImageKHR extension support
52   /**
53    * If the EGL Image extension is available this function returns a
54    * EGLImageKHR
55    * @param clientBuffer Client buffer to use for image creation
56    * @return an object that holds a EGLImageKHR
57    */
58   void* CreateImageKHR(EGLClientBuffer clientBuffer);
59
60   /**
61    * If the EGL Image extension is available this function
62    * destroys the a EGLImageKHR
63    * @param eglImageKHR Object that holds a EGLImageKHR
64    */
65   void DestroyImageKHR(void* eglImageKHR);
66
67   /**
68    * defines a 2D texture
69    * @param eglImageKHR Object that holds a EGLImageKHR
70    */
71   void TargetTextureKHR(void* eglImageKHR);
72
73   /**
74    * Get the functions for using ImageKHR
75    */
76   void InitializeEglImageKHR();
77
78 private:
79   EglImplementation* mEglImplementation;
80
81   bool mImageKHRInitialized;      ///< Flag for whether extended KHR functions loaded
82   bool mImageKHRInitializeFailed; ///< Flag to avoid trying to reload extended KHR functions, if
83                                   /// it fails the first time
84 };
85
86 } // namespace Adaptor
87
88 } // namespace Internal
89
90 } // namespace Dali
91
92 #endif // DALI_INTERNAL_EGL_IMAGE_EXTENSIONS_H