From 1b999b603a95f1e2c90e9db431b6c4ff4d5a17f5 Mon Sep 17 00:00:00 2001 From: HyeJin Lee Date: Fri, 23 Aug 2013 18:08:05 +0300 Subject: [PATCH] egl 1 Change-Id: I05834fb4e1ebf622ca2603fe441422c7de5239f0 --- src/ui/animations/FUiAnim_GlContext.h | 58 ++++------ src/ui/animations/FUiAnim_GlLayer.cpp | 2 +- src/ui/animations/FUiAnim_GlLayer.h | 6 +- src/ui/animations/FUiAnim_GlRenderManager.cpp | 25 +---- src/ui/animations/FUiAnim_NativeLayer.cpp | 2 +- src/ui/animations/platform/FUiAnim_Egl.cpp | 79 +------------ src/ui/animations/platform/FUiAnim_Egl.h | 19 +--- src/ui/animations/platform/FUiAnim_GlContext.cpp | 137 ++++++++++------------- src/ui/animations/platform/FUiAnim_Wgl.cpp | 89 +-------------- src/ui/animations/platform/FUiAnim_Wgl.h | 19 +--- 10 files changed, 100 insertions(+), 336 deletions(-) diff --git a/src/ui/animations/FUiAnim_GlContext.h b/src/ui/animations/FUiAnim_GlContext.h index 4493ca2..dce057d 100644 --- a/src/ui/animations/FUiAnim_GlContext.h +++ b/src/ui/animations/FUiAnim_GlContext.h @@ -59,24 +59,18 @@ public: static result CreateInstance(Handle nativeDisplay); static result ReleaseInstance(void); - - Handle CreateWindowSurface(EGLNativeWindowType window); - void DestroySurface(Handle surface); -#endif - -#ifdef VE_USE_GL_MULTI_CONTEXT - bool MakeCurrent(void); -#else - bool MakeCurrent(Handle surface); #endif + bool MakeCurrent(Handle surface = 0); void SwapBuffers(void) const; + bool IsSupportedBGRA() const { return __supportBGRA8888; } + + //Texture bool CreateTexture(TextureInfo* pTextureInfo); void DeleteTexture(TextureInfo* pTextureInfo); - void UploadTexture(Tizen::Graphics::GlVisualElementSurfaceInfo* pSurfaceInfo); - - bool IsSupportedBGRA() const { return __supportBGRA8888; } + void UpdateTexture(Tizen::Graphics::GlVisualElementSurfaceInfo* pSurfaceInfo); //TODO: parameter check + void BindTexture(unsigned int textureId); //Shader void UseShaderProgram(_GlShaderProgram* pShaderProgram); @@ -97,6 +91,18 @@ protected: _GlContext(Handle nativeDisplay, EGLNativeWindowType window); virtual ~_GlContext(void); + bool GetDisplay(Handle nativeDisplay); + bool CreateContext(void); + EGLConfig GetConfig(bool useAlpha, bool useStencil, bool useDepth) const; + + Handle CreateWindowSurface(EGLNativeWindowType window); + void DestroySurface(Handle surface); + Handle CreateDefaultSurface(void); + + void InitGL(void); + + void LoadTexture(TextureInfo& textureInfo, bool create); + private: //TODO: Check structure class _PixmapInfo @@ -129,29 +135,16 @@ private: EGLImageKHR __eglImage; }; - bool CreateContext(void); - -#ifdef VE_USE_GL_MULTI_CONTEXT - Handle CreateWindowSurface(EGLNativeWindowType window); - void DestroySurface(Handle surface); -#else - bool CreateDefaultSurface(void); -#endif - - bool GetDisplay(Handle nativeDisplay); - EGLConfig GetConfig(bool useAlpha, bool useStencil, bool useDepth) const; - - void InitGL(void); - - void LoadTexture(TextureInfo& textureInfo, bool create); - bool CreateDynamicTexture(GLuint textureId, TextureInfo* pTextureInfo); _PixmapInfo* CreateNativePixmap(Graphics::BufferInfo& bufferInfo); protected: + Handle __nativeDisplay; + EGLDisplay __display; EGLContext __context; EGLConfig __config; + EGLSurface __surface; bool __supportBGRA8888; @@ -160,19 +153,14 @@ protected: bool __useDepthTest; _GlShaderProgram* __pCurrentShader; - unsigned int __currentTextureId; + unsigned int __textureId; private: #ifndef VE_USE_GL_MULTI_CONTEXT static _GlContext* __pInstance; #endif - Handle __nativeDisplay; - -#ifdef VE_USE_GL_MULTI_CONTEXT - EGLSurface __surface; -#else - EGLSurface __currentSurface; +#ifndef VE_USE_GL_MULTI_CONTEXT EGLSurface __dummySurface; Handle __nativeDummyPixmap; // for dummy #endif diff --git a/src/ui/animations/FUiAnim_GlLayer.cpp b/src/ui/animations/FUiAnim_GlLayer.cpp index 78e6ca1..3e53f42 100644 --- a/src/ui/animations/FUiAnim_GlLayer.cpp +++ b/src/ui/animations/FUiAnim_GlLayer.cpp @@ -62,7 +62,7 @@ _GlLayer::_GlLayer(void) , __opacity(1.0f) , __pRootVisualElement(null) , __pWindow(null) - , __surface(EGL_NO_SURFACE) + , __surface(null) , __reconfigureNeeded(false) #ifdef VE_USE_GL_MULTI_CONTEXT , __pContext(null) diff --git a/src/ui/animations/FUiAnim_GlLayer.h b/src/ui/animations/FUiAnim_GlLayer.h index b77f277..98c6c3b 100644 --- a/src/ui/animations/FUiAnim_GlLayer.h +++ b/src/ui/animations/FUiAnim_GlLayer.h @@ -25,8 +25,6 @@ #ifndef _FUI_ANIM_INTERNAL_GL_LAYER_H_ #define _FUI_ANIM_INTERNAL_GL_LAYER_H_ -#include -#include #include #include #include "FUiAnim_NativeLayer.h" @@ -90,7 +88,7 @@ public: Handle GetNativeSurface(void) const { - return (Handle)__surface; + return __surface; } #ifdef VE_USE_GL_MULTI_CONTEXT @@ -110,7 +108,7 @@ private: float __opacity; _RootVisualElement* __pRootVisualElement; _NativeWindow* __pWindow; - EGLSurface __surface; + Handle __surface; bool __reconfigureNeeded; #ifdef VE_USE_GL_MULTI_CONTEXT diff --git a/src/ui/animations/FUiAnim_GlRenderManager.cpp b/src/ui/animations/FUiAnim_GlRenderManager.cpp index 1048e6b..cd03d3b 100644 --- a/src/ui/animations/FUiAnim_GlRenderManager.cpp +++ b/src/ui/animations/FUiAnim_GlRenderManager.cpp @@ -720,13 +720,8 @@ _GlRenderManager::FlushRenderQueue(void) if (__pRenderQueue[i].__textureId > 0) { - if (likely(__pGlContext->__currentTextureId != __pRenderQueue[i].__textureId)) - { - glBindTexture(GL_TEXTURE_2D, __pRenderQueue[i].__textureId); - __pGlContext->__currentTextureId = __pRenderQueue[i].__textureId; - } - - __pGlContext->UploadTexture(__pRenderQueue[i].__pSurfaceInfo); + __pGlContext->BindTexture(__pRenderQueue[i].__textureId); + __pGlContext->UpdateTexture(__pRenderQueue[i].__pSurfaceInfo); //TODO Update안에서 bind를 해주면 안되는가? } if (__pGlContext->__useBlend != __pRenderQueue[i].__useBlend) @@ -817,11 +812,7 @@ _GlRenderManager::RenderMesh(_GlNode* pNode, const _Matrix3Df& viewport) if (pMeshImpl->__pTexCoordinates) { - if (likely(__pGlContext->__currentTextureId != pNode->__textureId)) - { - glBindTexture(GL_TEXTURE_2D, pNode->__textureId); - __pGlContext->__currentTextureId = pNode->__textureId; - } + __pGlContext->BindTexture(pNode->__textureId); if (_FloatCompare(pNode->__opacity, 1.0f)) { @@ -898,15 +889,10 @@ _GlRenderManager::SetProgramInfo(_GlNode* pNode, const _Matrix3Df& viewport) if (pNode->__textureId > 0) { - if (likely(__pGlContext->__currentTextureId != pNode->__textureId)) - { - glBindTexture(GL_TEXTURE_2D, pNode->__textureId); - __pGlContext->__currentTextureId = pNode->__textureId; - } - _VisualElementSurfaceImpl* pSurfaceImpl = _VisualElementSurfaceImpl::GetInstance(*pNode->GetSurface()); - __pGlContext->UploadTexture((GlVisualElementSurfaceInfo*)pSurfaceImpl->GetNativeHandle()); + __pGlContext->BindTexture(pNode->__textureId); + __pGlContext->UpdateTexture((GlVisualElementSurfaceInfo*)pSurfaceImpl->GetNativeHandle()); if (_FloatCompare(pNode->__opacity, 1.0f)) { @@ -1114,7 +1100,6 @@ _GlRenderManager::CompositeLayer(_GlLayer* pLayer) { #ifdef VE_USE_GL_MULTI_CONTEXT __pGlContext = (_GlContext*)pLayer->GetContext(); - __pGlContext->MakeCurrent(); #else __pGlContext->MakeCurrent(pLayer->GetNativeSurface()); diff --git a/src/ui/animations/FUiAnim_NativeLayer.cpp b/src/ui/animations/FUiAnim_NativeLayer.cpp index 9fffadb..da42f73 100644 --- a/src/ui/animations/FUiAnim_NativeLayer.cpp +++ b/src/ui/animations/FUiAnim_NativeLayer.cpp @@ -204,7 +204,7 @@ _NativeLayer::Render(void) if (!checkOnly) { _pRootVisualElement->SetNeedsSurfaceUpdate(false); - _GlRenderManager::GetInstance()->UploadTexture(); + _GlRenderManager::GetInstance()->UpdateTexture(); } updated = true; } diff --git a/src/ui/animations/platform/FUiAnim_Egl.cpp b/src/ui/animations/platform/FUiAnim_Egl.cpp index 83eb3a5..5a6a874 100644 --- a/src/ui/animations/platform/FUiAnim_Egl.cpp +++ b/src/ui/animations/platform/FUiAnim_Egl.cpp @@ -76,10 +76,7 @@ namespace Tizen { namespace Ui { namespace Animations { _Egl::_Egl(Handle nativeDisplay, EGLNativeWindowType window) : _GlContext(nativeDisplay, window) , __nativeDisplay(nativeDisplay) -#ifdef VE_USE_GL_MULTI_CONTEXT - , __surface(EGL_NO_SURFACE) -#else - , __currentSurface(EGL_NO_SURFACE) +#ifndef VE_USE_GL_MULTI_CONTEXT , __dummySurface(EGL_NO_SURFACE) , __nativeDummyPixmap(0) #endif @@ -161,80 +158,6 @@ _Egl::~_Egl(void) PRINT("_Egl:~_Egl() \n"); } -Handle -_Egl::CreateWindowSurface(EGLNativeWindowType window) -{ - PRINT(">> _Egl:CreateWindowSurface() %p \n", (void*)window); - - EGLSurface surface = eglCreateWindowSurface(__display, __config, window, null); - if (surface == EGL_NO_SURFACE || eglGetError() != EGL_SUCCESS) - { - PRINT("Failed to eglCreateWindowSurface. \n"); - SysLog(NID_UI_ANIM, "eglCreateWindowSurface() failed."); - } - - return (Handle)surface; -} - -void -_Egl::DestroySurface(Handle surface) -{ - TryReturnVoid(surface == 0, "surface is null"); - -#ifdef VE_USE_GL_MULTI_CONTEXT - eglMakeCurrent(__display, null, null, null); -#else - if (surface == (Handle)__currentSurface) // eglGetCurrentSurface(??) - { - PRINT(">> _Egl::DestroySurface currentSurface is destroyed. \n"); - - MakeCurrent((Handle)__dummySurface); - __currentSurface = __dummySurface; - } -#endif - - eglDestroySurface(__display, (EGLSurface)surface); -} - -#ifndef VE_USE_GL_MULTI_CONTEXT -bool -_Egl::CreateDefaultSurface(void) -{ -#ifndef BUILD_UI_CORE - if (__dummySurface != EGL_NO_SURFACE) - { - return true; - } - -#ifdef USE_PBUFFER - EGLint pbufferList[] = - { - EGL_WIDTH, 32, - EGL_HEIGHT, 32, - EGL_NONE - }; - - // __dummySurface = eglCreatePbufferSurface(__display, __config, pbufferList); -#endif - - Display* pDisplay = (Display*)__nativeDisplay; - __nativeDummyPixmap = XCreatePixmap(pDisplay, DefaultRootWindow(pDisplay), 10, 10, DefaultDepth(pDisplay, DefaultScreen(pDisplay))); - SysAssertf(__nativeDummyPixmap, "Failed to create default native pixmap."); - - __dummySurface = eglCreatePixmapSurface(__display, __config, (EGLNativePixmapType)__nativeDummyPixmap, NULL); - if (__dummySurface == EGL_NO_SURFACE) - { - PRINT("_Egl:CreateDefaultSurface: %#x \n", eglGetError()); - SysLog(NID_UI_ANIM, "CreateDefaultSurface failed!"); - return false; - } - - return true; -#endif - return false; -} -#endif - bool _Egl::GetDisplay(Handle nativeDisplay) { diff --git a/src/ui/animations/platform/FUiAnim_Egl.h b/src/ui/animations/platform/FUiAnim_Egl.h index e4fc4a9..6a8d943 100644 --- a/src/ui/animations/platform/FUiAnim_Egl.h +++ b/src/ui/animations/platform/FUiAnim_Egl.h @@ -56,11 +56,6 @@ public: _Egl(Handle nativeDisplay, EGLNativeWindowType window); virtual ~_Egl(void); -#ifndef VE_USE_GL_MULTI_CONTEXT - Handle CreateWindowSurface(EGLNativeWindowType window); - void DestroySurface(Handle surface); -#endif - // bool CreateTexture(TextureInfo* pTextureInfo); void DeleteTexture(TextureInfo* pTextureInfo); @@ -76,7 +71,7 @@ private: #else #ifdef LINUX - : __nativePixmap((Pixmap)0) + : __nativePixmap(0) #else : __nativePixmap() #endif @@ -103,13 +98,6 @@ private: bool CreateContext(void); -#ifdef VE_USE_GL_MULTI_CONTEXT - Handle CreateWindowSurface(EGLNativeWindowType window); - void DestroySurface(Handle surface); -#else - bool CreateDefaultSurface(void); -#endif - bool GetDisplay(Handle nativeDisplay); EGLConfig GetConfig(bool useAlpha, bool useStencil, bool useDepth) const; @@ -121,10 +109,7 @@ private: private: Handle __nativeDisplay; -#ifdef VE_USE_GL_MULTI_CONTEXT - EGLSurface __surface; -#else - EGLSurface __currentSurface; +#ifndef VE_USE_GL_MULTI_CONTEXT EGLSurface __dummySurface; Handle __nativeDummyPixmap; // for dummy #endif diff --git a/src/ui/animations/platform/FUiAnim_GlContext.cpp b/src/ui/animations/platform/FUiAnim_GlContext.cpp index e1218da..22f0a53 100644 --- a/src/ui/animations/platform/FUiAnim_GlContext.cpp +++ b/src/ui/animations/platform/FUiAnim_GlContext.cpp @@ -103,21 +103,19 @@ _GlContext::CreateN(Handle nativeDisplay, EGLNativeWindowType window) } _GlContext::_GlContext(Handle nativeDisplay, EGLNativeWindowType window) - : __display(EGL_NO_DISPLAY) + : __nativeDisplay(nativeDisplay) + , __display(EGL_NO_DISPLAY) , __context(EGL_NO_CONTEXT) , __config(null) + , __surface(EGL_NO_SURFACE) , __supportBGRA8888(false) , __useBlend(false) , __useStencil(false) , __useDepthTest(false) , __pCurrentShader(null) - , __currentTextureId(0) - , __nativeDisplay(nativeDisplay) -#ifdef VE_USE_GL_MULTI_CONTEXT - , __surface(EGL_NO_SURFACE) -#else - , __currentSurface(EGL_NO_SURFACE) - , __dummySurface(EGL_NO_SURFACE) //TODO: __surface로 합치면 ?? + , __textureId(0) +#ifndef VE_USE_GL_MULTI_CONTEXT + , __dummySurface(EGL_NO_SURFACE) , __nativeDummyPixmap(0) #endif { @@ -138,7 +136,9 @@ _GlContext::_GlContext(Handle nativeDisplay, EGLNativeWindowType window) else { #ifndef VE_USE_GL_MULTI_CONTEXT - SysAssertf(CreateDefaultSurface(), "Failed to create default surface."); + __dummySurface = (EGLSurface)CreateDefaultSurface(); + + SysAssertf(__dummySurface != EGL_NO_SURFACE, "Failed to create default surface."); SysAssertf(MakeCurrent((Handle)__dummySurface), "Failed to make current."); #endif } @@ -230,50 +230,6 @@ _GlContext::ReleaseInstance(void) } #endif -#ifdef VE_USE_GL_MULTI_CONTEXT -bool -_GlContext::MakeCurrent(void) -{ - if (eglMakeCurrent(__display, __surface, __surface, __context) == EGL_FALSE) - { - PRINT("_GlContext::MakeCurrent: eglGetError() [%x] \n", eglGetError()); - SysLog(NID_UI_ANIM, "Can't change current context"); - - return false; - } - - return true; -} -#else -bool -_GlContext::MakeCurrent(Handle surface) -{ - EGLSurface newSurface = (EGLSurface)surface; - -/* if (newSurface == EGL_NO_SURFACE) - { - newSurface = __dummySurface; - }*/ - - if (newSurface == __currentSurface)//eglGetCurrentSurface(EGL_DRAW)) - { - return true; - } - - if (eglMakeCurrent(__display, newSurface, newSurface, __context) == EGL_FALSE) - { - PRINT("_GlContext::MakeCurrent: eglGetError() [%x] \n", eglGetError()); - SysLog(NID_UI_ANIM, "Can't change current context"); - - return false; - } - - __currentSurface = newSurface; - - return true; -} -#endif - Handle _GlContext::CreateWindowSurface(EGLNativeWindowType window) { @@ -297,28 +253,24 @@ _GlContext::DestroySurface(Handle surface) #ifdef VE_USE_GL_MULTI_CONTEXT eglMakeCurrent(__display, null, null, null); #else - if (surface == (Handle)__currentSurface) // eglGetCurrentSurface(??) + if (surface == (Handle)__surface) // eglGetCurrentSurface(??) { PRINT(">> _GlContext::DestroySurface currentSurface is destroyed. \n"); MakeCurrent((Handle)__dummySurface); - __currentSurface = __dummySurface; + __surface = __dummySurface; } #endif eglDestroySurface(__display, (EGLSurface)surface); } -#ifndef VE_USE_GL_MULTI_CONTEXT -bool +Handle _GlContext::CreateDefaultSurface(void) { + EGLSurface surface = EGL_NO_SURFACE; + #ifndef BUILD_UI_CORE - if (__dummySurface != EGL_NO_SURFACE) - { - return true; - } - #ifdef USE_PBUFFER EGLint pbufferList[] = { @@ -327,35 +279,50 @@ _GlContext::CreateDefaultSurface(void) EGL_NONE }; - // __dummySurface = eglCreatePbufferSurface(__display, __config, pbufferList); -#endif - + surface = eglCreatePbufferSurface(__display, __config, pbufferList); +#else +#ifndef VE_USE_GL_MULTI_CONTEXT Display* pDisplay = (Display*)__nativeDisplay; __nativeDummyPixmap = XCreatePixmap(pDisplay, DefaultRootWindow(pDisplay), 10, 10, DefaultDepth(pDisplay, DefaultScreen(pDisplay))); SysAssertf(__nativeDummyPixmap, "Failed to create default native pixmap."); - __dummySurface = eglCreatePixmapSurface(__display, __config, (EGLNativePixmapType)__nativeDummyPixmap, NULL); - if (__dummySurface == EGL_NO_SURFACE) + surface = eglCreatePixmapSurface(__display, __config, (EGLNativePixmapType)__nativeDummyPixmap, NULL); +#endif +#endif +#endif + + return (Handle)surface; +} + +bool +_GlContext::MakeCurrent(Handle surface) +{ + if (surface) { - PRINT("_GlContext:CreateDefaultSurface: %#x \n", eglGetError()); - SysLog(NID_UI_ANIM, "CreateDefaultSurface failed!"); + EGLSurface newSurface = (EGLSurface)surface; + if (__surface == newSurface) + { + return true; + } + + __surface = newSurface; + } + + if (eglMakeCurrent(__display, __surface, __surface, __context) == EGL_FALSE) + { + PRINT("_GlContext::MakeCurrent: eglGetError() [%x] \n", eglGetError()); + SysLog(NID_UI_ANIM, "Can't change current context"); + return false; } return true; -#endif - return false; } -#endif void _GlContext::SwapBuffers(void) const { -#ifdef VE_USE_GL_MULTI_CONTEXT if (!eglSwapBuffers(__display, __surface)) -#else - if (!eglSwapBuffers(__display, __currentSurface)) -#endif { PRINT("_GlContext::SwapBuffers: ERROR! [0x%x]\n", eglGetError()); } @@ -510,7 +477,7 @@ _GlContext::CreateTexture(TextureInfo* pTextureInfo) glBindTexture(GL_TEXTURE_2D, textureId); - __currentTextureId = textureId; + __textureId = textureId; glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); @@ -529,7 +496,7 @@ _GlContext::CreateTexture(TextureInfo* pTextureInfo) if (pTextureInfo->pPixels == null) { glDeleteTextures(1, &textureId); - __currentTextureId = 0; + __textureId = 0; return false; } @@ -549,11 +516,23 @@ _GlContext::CreateTexture(TextureInfo* pTextureInfo) return true; } +void +_GlContext::BindTexture(unsigned int textureId) +{ + if (likely(__textureId != textureId)) + { + glBindTexture(GL_TEXTURE_2D, textureId); + __textureId = textureId; + } +} + //TODO: why?? pSurfaceInfo void -_GlContext::UploadTexture(GlVisualElementSurfaceInfo* pSurfaceInfo) +_GlContext::UpdateTexture(GlVisualElementSurfaceInfo* pSurfaceInfo) { #ifndef USE_EGL_IMAGE +// BindTexture(pSurfaceInfo->textureId); + // if (pSurfaceInfo->type == SURFACE_TYPE_DYNAMIC && pSurfaceInfo->updated) // if (pSurfaceInfo->type == SURFACE_TYPE_DYNAMIC) { diff --git a/src/ui/animations/platform/FUiAnim_Wgl.cpp b/src/ui/animations/platform/FUiAnim_Wgl.cpp index 4d10c21..62481bc 100644 --- a/src/ui/animations/platform/FUiAnim_Wgl.cpp +++ b/src/ui/animations/platform/FUiAnim_Wgl.cpp @@ -76,10 +76,7 @@ namespace Tizen { namespace Ui { namespace Animations { _Wgl::_Wgl(Handle nativeDisplay, EGLNativeWindowType window) : _GlContext(nativeDisplay, window) , __nativeDisplay(nativeDisplay) -#ifdef VE_USE_GL_MULTI_CONTEXT - , __surface(EGL_NO_SURFACE) -#else - , __currentSurface(EGL_NO_SURFACE) +#ifndef VE_USE_GL_MULTI_CONTEXT , __dummySurface(EGL_NO_SURFACE) , __nativeDummyPixmap(0) #endif @@ -161,80 +158,6 @@ _Wgl::~_Wgl(void) PRINT("_Wgl:~_Wgl() \n"); } -Handle -_Wgl::CreateWindowSurface(EGLNativeWindowType window) -{ - PRINT(">> _Wgl:CreateWindowSurface() %p \n", (void*)window); - - EGLSurface surface = eglCreateWindowSurface(__display, __config, window, null); - if (surface == EGL_NO_SURFACE || eglGetError() != EGL_SUCCESS) - { - PRINT("Failed to eglCreateWindowSurface. \n"); - SysLog(NID_UI_ANIM, "eglCreateWindowSurface() failed."); - } - - return (Handle)surface; -} - -void -_Wgl::DestroySurface(Handle surface) -{ - TryReturnVoid(surface == 0, "surface is null"); - -#ifdef VE_USE_GL_MULTI_CONTEXT - eglMakeCurrent(__display, null, null, null); -#else - if (surface == (Handle)__currentSurface) // eglGetCurrentSurface(??) - { - PRINT(">> _Wgl::DestroySurface currentSurface is destroyed. \n"); - - MakeCurrent((Handle)__dummySurface); - __currentSurface = __dummySurface; - } -#endif - - eglDestroySurface(__display, (EGLSurface)surface); -} - -#ifndef VE_USE_GL_MULTI_CONTEXT -bool -_Wgl::CreateDefaultSurface(void) -{ -#ifndef BUILD_UI_CORE - if (__dummySurface != EGL_NO_SURFACE) - { - return true; - } - -#ifdef USE_PBUFFER - EGLint pbufferList[] = - { - EGL_WIDTH, 32, - EGL_HEIGHT, 32, - EGL_NONE - }; - - // __dummySurface = eglCreatePbufferSurface(__display, __config, pbufferList); -#endif - - Display* pDisplay = (Display*)__nativeDisplay; - __nativeDummyPixmap = XCreatePixmap(pDisplay, DefaultRootWindow(pDisplay), 10, 10, DefaultDepth(pDisplay, DefaultScreen(pDisplay))); - SysAssertf(__nativeDummyPixmap, "Failed to create default native pixmap."); - - __dummySurface = eglCreatePixmapSurface(__display, __config, (EGLNativePixmapType)__nativeDummyPixmap, NULL); - if (__dummySurface == EGL_NO_SURFACE) - { - PRINT("_Wgl:CreateDefaultSurface: %#x \n", eglGetError()); - SysLog(NID_UI_ANIM, "CreateDefaultSurface failed!"); - return false; - } - - return true; -#endif - return false; -} -#endif - bool _Wgl::GetDisplay(Handle nativeDisplay) { @@ -554,8 +477,7 @@ CATCH_01: bool _Wgl::CreateDynamicTexture(GLuint textureId, TextureInfo* pTextureInfo) { -#ifndef BUILD_UI_CORE -#ifndef VE_SIMULATOR +#ifdef USE_EGL_IMAGE _PixmapInfo* pPixmapInfo; PFNEGLCREATEIMAGEKHRPROC funcEglCreateImageKHR = @@ -600,10 +522,9 @@ _Wgl::CreateDynamicTexture(GLuint textureId, TextureInfo* pTextureInfo) __nativePixmaps.Add(textureId, pPixmapInfo); return true; -#else - return false; -#endif -#endif +#endif // USE_EGL_IMAGE + + return true; } }}} // Tizen::Ui::Animations diff --git a/src/ui/animations/platform/FUiAnim_Wgl.h b/src/ui/animations/platform/FUiAnim_Wgl.h index 032a5ee..4386958 100644 --- a/src/ui/animations/platform/FUiAnim_Wgl.h +++ b/src/ui/animations/platform/FUiAnim_Wgl.h @@ -56,11 +56,6 @@ public: _Wgl(Handle nativeDisplay, EGLNativeWindowType window); virtual ~_Wgl(void); -#ifndef VE_USE_GL_MULTI_CONTEXT - Handle CreateWindowSurface(EGLNativeWindowType window); - void DestroySurface(Handle surface); -#endif - // bool CreateTexture(TextureInfo* pTextureInfo); void DeleteTexture(TextureInfo* pTextureInfo); @@ -76,7 +71,7 @@ private: #else #ifdef LINUX - : __nativePixmap((Pixmap)0) + : __nativePixmap(0) #else : __nativePixmap() #endif @@ -103,13 +98,6 @@ private: bool CreateContext(void); -#ifdef VE_USE_GL_MULTI_CONTEXT - Handle CreateWindowSurface(EGLNativeWindowType window); - void DestroySurface(Handle surface); -#else - bool CreateDefaultSurface(void); -#endif - bool GetDisplay(Handle nativeDisplay); EGLConfig GetConfig(bool useAlpha, bool useStencil, bool useDepth) const; @@ -121,10 +109,7 @@ private: private: Handle __nativeDisplay; -#ifdef VE_USE_GL_MULTI_CONTEXT - EGLSurface __surface; -#else - EGLSurface __currentSurface; +#ifndef VE_USE_GL_MULTI_CONTEXT EGLSurface __dummySurface; Handle __nativeDummyPixmap; // for dummy #endif -- 2.7.4