1 #ifndef __DALI_INTERNAL_ADAPTOR_EGL_SYNC_IMPLEMENTATION_H__
2 #define __DALI_INTERNAL_ADAPTOR_EGL_SYNC_IMPLEMENTATION_H__
5 * Copyright (c) 2014 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.
23 #include <EGL/eglext.h>
24 #include <dali/public-api/common/dali-common.h>
25 #include <dali/public-api/common/dali-vector.h>
26 #include <dali/integration-api/gl-sync-abstraction.h>
34 class EglImplementation;
36 class EglSyncObject : public Integration::GlSyncAbstraction::SyncObject
42 EglSyncObject( EglImplementation& eglSyncImpl );
47 virtual ~EglSyncObject();
50 * @copydoc Dali::Integration::GlSyncAbstraction::SyncObject::IsSynced()
52 virtual bool IsSynced();
58 int mPollCounter; // Implementations without fence sync use a 3 frame counter
60 EglImplementation& mEglImplementation;
65 * GlSyncImplementation is a concrete implementation for GlSyncAbstraction.
66 * It provides fence syncing for resources such as FrameBuffers using EGL extensions
68 * Sync objects are created in the render thread after a render instruction
69 * has been processed (i.e. GL draw calls have completed for a given FB), and
70 * tested in the update
72 class EglSyncImplementation : public Integration::GlSyncAbstraction
78 EglSyncImplementation();
83 virtual ~EglSyncImplementation();
86 * Initialize the sync object with the Egl implementation.
87 * @param[in] impl The EGL implementation (to access display)
89 void Initialize( EglImplementation* impl );
92 * @copydoc Dali::Integration::GlSyncAbstraction::CreateSyncObject()
94 virtual SyncObject* CreateSyncObject();
97 * @copydoc Dali::Integration::GlSyncAbstraction::DestroySyncObject()
99 virtual void DestroySyncObject(SyncObject* syncObject);
103 * Set up the function pointers
105 void InitializeEglSync();
108 typedef Vector<EglSyncObject*> SyncContainer;
109 typedef SyncContainer::Iterator SyncIter;
111 EglImplementation* mEglImplementation; ///< Egl implementation (to get display)
112 bool mSyncInitialized; ///< Flag to perform initialization on first use
113 bool mSyncInitializeFailed; ///< Flag to avoid reloading functions if failed once
115 SyncContainer mSyncObjects;
118 } // namespace Adaptor
119 } // namespace Internal
122 #endif // __DALI_INTERNAL_EGL_ADAPTOR_SYNC_IMPLEMENTATION_H__