Initial copy from dali-adaptor repository
[platform/core/uifw/dali-adaptor-legacy.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) 2019 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
52 public:   // EGLImageKHR extension support
53
54   /**
55    * If the EGL Image extension is available this function returns a
56    * EGLImageKHR
57    * @param clientBuffer Client buffer to use for image creation
58    * @return an object that holds a EGLImageKHR
59    */
60   void* CreateImageKHR(EGLClientBuffer clientBuffer);
61
62   /**
63    * If the EGL Image extension is available this function
64    * destroys the a EGLImageKHR
65    * @param eglImageKHR Object that holds a EGLImageKHR
66    */
67   void DestroyImageKHR(void* eglImageKHR);
68
69   /**
70    * defines a 2D texture
71    * @param eglImageKHR Object that holds a EGLImageKHR
72    */
73   void TargetTextureKHR(void* eglImageKHR);
74
75   /**
76    * Get the functions for using ImageKHR
77    */
78   void InitializeEglImageKHR();
79
80 private:
81   EglImplementation* mEglImplementation;
82
83   bool mImageKHRInitialized;             ///< Flag for whether extended KHR functions loaded
84   bool mImageKHRInitializeFailed;        ///< Flag to avoid trying to reload extended KHR functions, if
85                                          /// it fails the first time
86 };
87
88 } // namespace Adaptor
89
90 } // namespace Internal
91
92 } // namespace Dali
93
94 #endif // DALI_INTERNAL_EGL_IMAGE_EXTENSIONS_H