#define DALI_INTERNAL_EGL_IMPLEMENTATION_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <dali/public-api/common/dali-vector.h>
+#include <dali/public-api/common/vector-wrapper.h>
#include <dali/integration-api/core-enumerations.h>
// INTERNAL INCLUDES
-#include <dali/integration-api/egl-interface.h>
+#include <dali/integration-api/adaptor-framework/egl-interface.h>
namespace Dali
{
-
namespace Internal
{
namespace Adaptor
bool InitializeGles( EGLNativeDisplayType display, bool isOwnSurface = true );
/**
- * Create the OpenGL context.
+ * Create the OpenGL context for the shared resource.
* @return true if successful
*/
virtual bool CreateContext();
/**
+ * Create the OpenGL context for the window.
+ * @return true if successful
+ */
+ bool CreateWindowContext( EGLContext& mEglContext );
+
+ /**
* Destroy the OpenGL context.
*/
- void DestroyContext();
+ void DestroyContext( EGLContext& eglContext );
/**
* Destroy the OpenGL surface.
*/
- void DestroySurface();
+ void DestroySurface( EGLSurface& eglSurface );
/**
* Make the OpenGL context current
*/
- virtual void MakeContextCurrent();
+ virtual void MakeContextCurrent( EGLSurface eglSurface, EGLContext eglContext );
/**
* clear the OpenGL context
/**
* Performs an OpenGL swap buffers command
*/
- virtual void SwapBuffers();
+ virtual void SwapBuffers( EGLSurface& eglSurface );
/**
* Performs an OpenGL copy buffers command
*/
- virtual void CopyBuffers();
+ virtual void CopyBuffers( EGLSurface& eglSurface );
/**
* Performs an EGL wait GL command
* Choose config of egl
* @param isWindowType whether the config for window or pixmap
* @param colorDepth Bit per pixel value (ex. 32 or 24)
+ * @return true if the eglChooseConfig is succeed.
*/
- void ChooseConfig( bool isWindowType, ColorDepth depth );
+ bool ChooseConfig( bool isWindowType, ColorDepth depth );
/**
* Create an OpenGL surface using a window
* @param window The window to create the surface on
* @param colorDepth Bit per pixel value (ex. 32 or 24)
- * @return true on success, false on failure
+ * @return Handle to an on-screen EGL window surface (the requester has an ownership of this egl surface)
*/
- void CreateSurfaceWindow( EGLNativeWindowType window, ColorDepth depth );
+ EGLSurface CreateSurfaceWindow( EGLNativeWindowType window, ColorDepth depth );
/**
* Create the OpenGL surface using a pixmap
* @return true if the context was lost due to a change in display
* between old surface and new surface
*/
- bool ReplaceSurfaceWindow( EGLNativeWindowType window );
+ bool ReplaceSurfaceWindow( EGLNativeWindowType window, EGLSurface& eglSurface, EGLContext& eglContext );
/**
* Replaces the render surface
bool ReplaceSurfacePixmap( EGLNativePixmapType pixmap, EGLSurface& eglSurface );
/**
+ * Sets gles version
+ */
+ void SetGlesVersion( const int32_t glesVersion );
+
+ /**
+ * Sets Whether the frame is the first after Resume.
+ */
+ void SetFirstFrameAfterResume();
+
+ /**
* returns the display with which this object was initialized
* @return the EGL Display.
*/
*/
EGLContext GetContext() const;
+ /**
+ * Returns the gles version
+ * @return the gles version
+ */
+ int32_t GetGlesVersion() const;
+
+ /**
+ * Returns whether the surfaceless context is supported
+ * @return true if the surfaceless context is supported
+ */
+ bool IsSurfacelessContextSupported() const;
+
+ /**
+ * @brief Wait until all rendering calls for the currently context are executed
+ */
+ void WaitClient();
+
private:
Vector<EGLint> mContextAttribs;
EGLDisplay mEglDisplay;
EGLConfig mEglConfig;
- EGLContext mEglContext;
+ EGLContext mEglContext; ///< The resource context holding assets such as textures to be shared
+
+ typedef std::vector<EGLContext> EglWindowContextContainer;
+ EglWindowContextContainer mEglWindowContexts; ///< The EGL context for the window
+
EGLSurface mCurrentEglSurface;
+ EGLContext mCurrentEglContext;
+
+ typedef std::vector<EGLSurface> EglWindowSurfaceContainer;
+ EglWindowSurfaceContainer mEglWindowSurfaces; ///< The EGL surface for the window
- int mMultiSamplingLevel;
+ int32_t mMultiSamplingLevel;
+ int32_t mGlesVersion;
ColorDepth mColorDepth;
bool mGlesInitialized;
bool mIsOwnSurface;
- bool mContextCurrent;
bool mIsWindow;
bool mDepthBufferRequired;
bool mStencilBufferRequired;
+ bool mIsSurfacelessContextSupported;
+ bool mIsKhrCreateContextSupported;
+
+ uint32_t mSwapBufferCountAfterResume;
};
} // namespace Adaptor