translator EGL:fixing bug in eglGetDisplay caused in Windows Platform
in Windows platform we previously defined EGLNativeDisplaytype to be WinDisplay*
( this was defined in include/EGL/eglplatform.h) this was OK as long as we used the
the EGL_DEFAULT_DISPLAY as parameter for eglGetDisplay meaning we were generating
a native display by oureselv and wrapping it, but there was aproblem when we got the
EGLNativeDisplayType from the user (as HDC in Windows) but interpret it as WinDisplay*
this caused a big memory corupption.
so to overcome this problem we now define two types EGLNativeDisplayType to be
HDC and EGLNativeInternalDisplayTypeto be WinDisplay*, and when we get in eglGetDisplay
a parameter different from EGL_DEFAULT_DISPLAY we wrap it with the struct of WinDisplay
and return it to the user.
this change caused a change in all the declerations of EglOsApi.h changing
EGLNativeDisplayType -> EGLNativeInternalDisplayType
Change-Id: I3522c3d507b084c5c211e10ddb6f512d1b90c65e
diff --git a/tools/emulator/opengl/host/libs/Translator/EGL/EglDisplay.cpp b/tools/emulator/opengl/host/libs/Translator/EGL/EglDisplay.cpp
index f20f51c..bb5dd90 100644
--- a/tools/emulator/opengl/host/libs/Translator/EGL/EglDisplay.cpp
+++ b/tools/emulator/opengl/host/libs/Translator/EGL/EglDisplay.cpp
@@ -18,7 +18,7 @@
#include <GLcommon/GLutils.h>
#include <utils/threads.h>
-EglDisplay::EglDisplay(EGLNativeDisplayType dpy,bool isDefault) :
+EglDisplay::EglDisplay(EGLNativeInternalDisplayType dpy,bool isDefault) :
m_dpy(dpy),
m_initialized(false),
m_configInitialized(false),
@@ -53,9 +53,10 @@
delete m_manager[GLES_1_1];
delete m_manager[GLES_2_0];
+ EglOS::deleteDisplay(m_dpy);
}
-EGLNativeDisplayType EglDisplay::nativeType(){return m_dpy;}
+EGLNativeInternalDisplayType EglDisplay::nativeType(){return m_dpy;}
void EglDisplay::initialize(int renderableType) {
android::Mutex::Autolock mutex(m_lock);
diff --git a/tools/emulator/opengl/host/libs/Translator/EGL/EglDisplay.h b/tools/emulator/opengl/host/libs/Translator/EGL/EglDisplay.h
index f60c90f..587e92a 100644
--- a/tools/emulator/opengl/host/libs/Translator/EGL/EglDisplay.h
+++ b/tools/emulator/opengl/host/libs/Translator/EGL/EglDisplay.h
@@ -38,8 +38,8 @@
public:
- EglDisplay(EGLNativeDisplayType dpy,bool isDefault = true);
- EGLNativeDisplayType nativeType();
+ EglDisplay(EGLNativeInternalDisplayType dpy,bool isDefault = true);
+ EGLNativeInternalDisplayType nativeType();
int nConfigs(){ return m_configs.size();}
int getConfigs(EGLConfig* configs,int config_size);
int chooseConfigs(const EglConfig& dummy,EGLConfig* configs,int config_size);
@@ -72,19 +72,19 @@
void addMissingConfigs(void);
void initConfigurations(int renderableType);
- EGLNativeDisplayType m_dpy;
- bool m_initialized;
- bool m_configInitialized;
- bool m_isDefault;
- ConfigsList m_configs;
- ContextsHndlMap m_contexts;
- SurfacesHndlMap m_surfaces;
- GlobalNameSpace m_globalNameSpace;
- ObjectNameManager *m_manager[MAX_GLES_VERSION];
- android::Mutex m_lock;
- ImagesHndlMap m_eglImages;
- unsigned int m_nextEglImageId;
- EGLNativeContextType m_globalSharedContext;
+ EGLNativeInternalDisplayType m_dpy;
+ bool m_initialized;
+ bool m_configInitialized;
+ bool m_isDefault;
+ ConfigsList m_configs;
+ ContextsHndlMap m_contexts;
+ SurfacesHndlMap m_surfaces;
+ GlobalNameSpace m_globalNameSpace;
+ ObjectNameManager *m_manager[MAX_GLES_VERSION];
+ android::Mutex m_lock;
+ ImagesHndlMap m_eglImages;
+ unsigned int m_nextEglImageId;
+ EGLNativeContextType m_globalSharedContext;
};
#endif
diff --git a/tools/emulator/opengl/host/libs/Translator/EGL/EglGlobalInfo.cpp b/tools/emulator/opengl/host/libs/Translator/EGL/EglGlobalInfo.cpp
index 955f66c..cd372ff 100644
--- a/tools/emulator/opengl/host/libs/Translator/EGL/EglGlobalInfo.cpp
+++ b/tools/emulator/opengl/host/libs/Translator/EGL/EglGlobalInfo.cpp
@@ -47,28 +47,27 @@
}
-EglDisplay* EglGlobalInfo::addDisplay(EGLNativeDisplayType dpy) {
+EglDisplay* EglGlobalInfo::addDisplay(EGLNativeDisplayType dpy,EGLNativeInternalDisplayType idpy) {
//search if it is not already exists
android::Mutex::Autolock mutex(m_lock);
- for(DisplaysList::iterator it = m_displays.begin(); it != m_displays.end() ;it++) {
- if((*it)->nativeType() == dpy) return (*it);
+ for(DisplaysMap::iterator it = m_displays.begin(); it != m_displays.end() ;it++) {
+ if((*it).second == dpy) return (*it).first;
}
- EglDisplay* p_dpy = new EglDisplay(dpy);
+ EglDisplay* p_dpy = new EglDisplay(idpy);
if(p_dpy) {
- m_displays.push_front(p_dpy);
+ m_displays[p_dpy] = dpy;
return p_dpy;
}
return NULL;
}
bool EglGlobalInfo::removeDisplay(EGLDisplay dpy) {
-
android::Mutex::Autolock mutex(m_lock);
- for(DisplaysList::iterator it = m_displays.begin(); it != m_displays.end() ;it++) {
- if(static_cast<EGLDisplay>(*it) == dpy) {
- delete (*it);
- m_displays.remove(*it);
+ for(DisplaysMap::iterator it = m_displays.begin(); it != m_displays.end() ;it++) {
+ if(static_cast<EGLDisplay>((*it).first) == dpy) {
+ delete (*it).first;
+ m_displays.erase(it);
return true;
}
}
@@ -77,16 +76,18 @@
EglDisplay* EglGlobalInfo::getDisplay(EGLNativeDisplayType dpy) {
android::Mutex::Autolock mutex(m_lock);
- for(DisplaysList::iterator it = m_displays.begin(); it != m_displays.end() ;it++) {
- if((*it)->nativeType() == dpy) return (*it);
+ for(DisplaysMap::iterator it = m_displays.begin(); it != m_displays.end() ;it++) {
+ if((*it).second == dpy) return (*it).first;
}
return NULL;
}
EglDisplay* EglGlobalInfo::getDisplay(EGLDisplay dpy) {
android::Mutex::Autolock mutex(m_lock);
- for(DisplaysList::iterator it = m_displays.begin(); it != m_displays.end() ;it++) {
- if(static_cast<EGLDisplay>(*it) == dpy) return (*it);
- }
- return NULL;
+ DisplaysMap::iterator it = m_displays.find(static_cast<EglDisplay*>(dpy));
+ return (it != m_displays.end() ? (*it).first : NULL);
+}
+
+EGLNativeInternalDisplayType EglGlobalInfo::generateInternalDisplay(EGLNativeDisplayType dpy){
+ return EglOS::getInternalDisplay(dpy);
}
diff --git a/tools/emulator/opengl/host/libs/Translator/EGL/EglGlobalInfo.h b/tools/emulator/opengl/host/libs/Translator/EGL/EglGlobalInfo.h
index 5e03e72..6be76ef 100644
--- a/tools/emulator/opengl/host/libs/Translator/EGL/EglGlobalInfo.h
+++ b/tools/emulator/opengl/host/libs/Translator/EGL/EglGlobalInfo.h
@@ -24,17 +24,18 @@
#include "EglConfig.h"
#include "EglContext.h"
-typedef std::list<EglDisplay*> DisplaysList;
+typedef std::map<EglDisplay*,EGLNativeDisplayType>DisplaysMap;
class EglGlobalInfo {
public:
- EglDisplay* addDisplay(EGLNativeDisplayType dpy);
+ EglDisplay* addDisplay(EGLNativeDisplayType dpy,EGLNativeInternalDisplayType idpy);
EglDisplay* getDisplay(EGLNativeDisplayType dpy);
EglDisplay* getDisplay(EGLDisplay dpy);
bool removeDisplay(EGLDisplay dpy);
- EGLNativeDisplayType getDefaultNativeDisplay(){ return m_default;};
+ EGLNativeInternalDisplayType getDefaultNativeDisplay(){ return m_default;};
+ EGLNativeInternalDisplayType generateInternalDisplay(EGLNativeDisplayType dpy);
void setIface(GLESiface* iface,GLESVersion ver) { m_gles_ifaces[ver] = iface;};
GLESiface* getIface(GLESVersion ver){ return m_gles_ifaces[ver];}
@@ -49,13 +50,13 @@
EglGlobalInfo();
~EglGlobalInfo(){};
- static EglGlobalInfo* m_singleton;
- static int m_refCount;
+ static EglGlobalInfo* m_singleton;
+ static int m_refCount;
- DisplaysList m_displays;
- EGLNativeDisplayType m_default;
- GLESiface* m_gles_ifaces[MAX_GLES_VERSION];
- android::Mutex m_lock;
+ DisplaysMap m_displays;
+ EGLNativeInternalDisplayType m_default;
+ GLESiface* m_gles_ifaces[MAX_GLES_VERSION];
+ android::Mutex m_lock;
};
#endif
diff --git a/tools/emulator/opengl/host/libs/Translator/EGL/EglImp.cpp b/tools/emulator/opengl/host/libs/Translator/EGL/EglImp.cpp
index 17fb33e..8b64b94 100644
--- a/tools/emulator/opengl/host/libs/Translator/EGL/EglImp.cpp
+++ b/tools/emulator/opengl/host/libs/Translator/EGL/EglImp.cpp
@@ -134,15 +134,20 @@
EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id) {
EglDisplay* dpy = NULL;
+ EGLNativeInternalDisplayType internalDisplay = NULL;
- if( display_id == EGL_DEFAULT_DISPLAY) {
- display_id = g_eglInfo->getDefaultNativeDisplay();
- }
if ((dpy = g_eglInfo->getDisplay(display_id))) {
return dpy;
} else {
- dpy = g_eglInfo->addDisplay(display_id);
+
+ if( display_id == EGL_DEFAULT_DISPLAY) {
+ internalDisplay = g_eglInfo->getDefaultNativeDisplay();
+ } else {
+ internalDisplay = g_eglInfo->generateInternalDisplay(display_id);
+ }
+
+ dpy = g_eglInfo->addDisplay(display_id,internalDisplay);
if(dpy) return dpy;
return EGL_NO_DISPLAY;
}
@@ -726,7 +731,7 @@
RETURN_ERROR(EGL_FALSE,EGL_BAD_MATCH);
}
- EGLNativeDisplayType nativeDisplay = dpy->nativeType();
+ EGLNativeInternalDisplayType nativeDisplay = dpy->nativeType();
EGLNativeSurfaceType nativeRead = newReadPtr->native();
EGLNativeSurfaceType nativeDraw = newDrawPtr->native();
//checking native window validity
@@ -899,7 +904,7 @@
SurfacePtr read = currCtx->read();
SurfacePtr draw = currCtx->draw();
- EGLNativeDisplayType nativeDisplay = dpy->nativeType();
+ EGLNativeInternalDisplayType nativeDisplay = dpy->nativeType();
if(read.Ptr()) {
if(read->type() == EglSurface::WINDOW &&
!EglOS::validNativeWin(nativeDisplay,read->native())) {
diff --git a/tools/emulator/opengl/host/libs/Translator/EGL/EglMacApi.cpp b/tools/emulator/opengl/host/libs/Translator/EGL/EglMacApi.cpp
index 10f3f4a..b5e7d67 100644
--- a/tools/emulator/opengl/host/libs/Translator/EGL/EglMacApi.cpp
+++ b/tools/emulator/opengl/host/libs/Translator/EGL/EglMacApi.cpp
@@ -212,4 +212,12 @@
void destroySurface(EGLNativeSurfaceType srfc){
}
+
+EGLNativeInternalDisplayType getInternalDisplay(EGLNativeDisplayType dpy){
+ return (EGLNativeInternalDisplayType)dpy;
+}
+
+void deleteDisplay(EGLNativeInternalDisplayType idpy){
+}
+
};
diff --git a/tools/emulator/opengl/host/libs/Translator/EGL/EglOsApi.h b/tools/emulator/opengl/host/libs/Translator/EGL/EglOsApi.h
index 8ad5d52..c166220 100644
--- a/tools/emulator/opengl/host/libs/Translator/EGL/EglOsApi.h
+++ b/tools/emulator/opengl/host/libs/Translator/EGL/EglOsApi.h
@@ -33,23 +33,25 @@
namespace EglOS{
- void queryConfigs(EGLNativeDisplayType dpy,int renderable_type,ConfigsList& listOut);
- bool releasePbuffer(EGLNativeDisplayType dis,EGLNativeSurfaceType pb);
- bool destroyContext(EGLNativeDisplayType dpy,EGLNativeContextType ctx);
- bool releaseDisplay(EGLNativeDisplayType dpy);
- bool validNativeWin(EGLNativeDisplayType dpy,EGLNativeSurfaceType win);
- bool validNativeWin(EGLNativeDisplayType dpy,EGLNativeWindowType win);
- bool validNativePixmap(EGLNativeDisplayType dpy,EGLNativeSurfaceType pix);
- bool checkWindowPixelFormatMatch(EGLNativeDisplayType dpy,EGLNativeWindowType win,EglConfig* cfg,unsigned int* width,unsigned int* height);
- bool checkPixmapPixelFormatMatch(EGLNativeDisplayType dpy,EGLNativePixmapType pix,EglConfig* cfg,unsigned int* width,unsigned int* height);
- bool makeCurrent(EGLNativeDisplayType dpy,EglSurface* read,EglSurface* draw,EGLNativeContextType);
- void swapBuffers(EGLNativeDisplayType dpy,EGLNativeSurfaceType srfc);
- void swapInterval(EGLNativeDisplayType dpy,EGLNativeSurfaceType win,int interval);
+ void queryConfigs(EGLNativeInternalDisplayType dpy,int renderable_type,ConfigsList& listOut);
+ bool releasePbuffer(EGLNativeInternalDisplayType dis,EGLNativeSurfaceType pb);
+ bool destroyContext(EGLNativeInternalDisplayType dpy,EGLNativeContextType ctx);
+ bool releaseDisplay(EGLNativeInternalDisplayType dpy);
+ bool validNativeWin(EGLNativeInternalDisplayType dpy,EGLNativeSurfaceType win);
+ bool validNativeWin(EGLNativeInternalDisplayType dpy,EGLNativeWindowType win);
+ bool validNativePixmap(EGLNativeInternalDisplayType dpy,EGLNativeSurfaceType pix);
+ bool checkWindowPixelFormatMatch(EGLNativeInternalDisplayType dpy,EGLNativeWindowType win,EglConfig* cfg,unsigned int* width,unsigned int* height);
+ bool checkPixmapPixelFormatMatch(EGLNativeInternalDisplayType dpy,EGLNativePixmapType pix,EglConfig* cfg,unsigned int* width,unsigned int* height);
+ bool makeCurrent(EGLNativeInternalDisplayType dpy,EglSurface* read,EglSurface* draw,EGLNativeContextType);
+ void swapBuffers(EGLNativeInternalDisplayType dpy,EGLNativeSurfaceType srfc);
+ void swapInterval(EGLNativeInternalDisplayType dpy,EGLNativeSurfaceType win,int interval);
void waitNative();
- EGLNativeDisplayType getDefaultDisplay();
- EGLNativeSurfaceType createPbufferSurface(EGLNativeDisplayType dpy,EglConfig* cfg,EglPbufferSurface* pb);
- EGLNativeContextType createContext(EGLNativeDisplayType dpy,EglConfig* cfg,EGLNativeContextType sharedContext);
+ EGLNativeInternalDisplayType getDefaultDisplay();
+ EGLNativeInternalDisplayType getInternalDisplay(EGLNativeDisplayType dpy);
+ void deleteDisplay(EGLNativeInternalDisplayType idpy);
+ EGLNativeSurfaceType createPbufferSurface(EGLNativeInternalDisplayType dpy,EglConfig* cfg,EglPbufferSurface* pb);
+ EGLNativeContextType createContext(EGLNativeInternalDisplayType dpy,EglConfig* cfg,EGLNativeContextType sharedContext);
EGLNativeSurfaceType createWindowSurface(EGLNativeWindowType wnd);
EGLNativeSurfaceType createPixmapSurface(EGLNativePixmapType pix);
void destroySurface(EGLNativeSurfaceType srfc);
diff --git a/tools/emulator/opengl/host/libs/Translator/EGL/EglWindowsApi.cpp b/tools/emulator/opengl/host/libs/Translator/EGL/EglWindowsApi.cpp
index 8ad226b..4f8d4b4 100644
--- a/tools/emulator/opengl/host/libs/Translator/EGL/EglWindowsApi.cpp
+++ b/tools/emulator/opengl/host/libs/Translator/EGL/EglWindowsApi.cpp
@@ -49,7 +49,9 @@
void WinDisplay::releaseAll(){
for(std::map<int,DisplayInfo>::iterator it = m_map.begin(); it != m_map.end();it++){
- DestroyWindow((*it).second.hwnd);
+ if((*it).second.hwnd){
+ DestroyWindow((*it).second.hwnd);
+ }
DeleteDC((*it).second.dc);
}
}
@@ -190,17 +192,22 @@
return hwnd;
}
-EGLNativeDisplayType getDefaultDisplay() {
+EGLNativeInternalDisplayType getDefaultDisplay() {
WinDisplay* dpy = new WinDisplay();
HWND hwnd = createDummyWindow();
HDC hdc = GetDC(hwnd);
dpy->setInfo(WinDisplay::DEFAULT_DISPLAY,DisplayInfo(hdc,hwnd));
- return static_cast<EGLNativeDisplayType>(dpy);
+ return static_cast<EGLNativeInternalDisplayType>(dpy);
}
+EGLNativeInternalDisplayType getInternalDisplay(EGLNativeDisplayType display){
+ WinDisplay* dpy = new WinDisplay();
+ dpy->setInfo(WinDisplay::DEFAULT_DISPLAY,DisplayInfo(display,NULL));
+ return dpy;
+}
-static HDC getDummyDC(EGLNativeDisplayType display,int cfgId){
+static HDC getDummyDC(EGLNativeInternalDisplayType display,int cfgId){
HDC dpy = NULL;
if(display->infoExists(cfgId)){
@@ -283,11 +290,17 @@
DeleteDC(dpy);
}
-bool releaseDisplay(EGLNativeDisplayType dpy) {
+bool releaseDisplay(EGLNativeInternalDisplayType dpy) {
dpy->releaseAll();
return true;
}
+void deleteDisplay(EGLNativeInternalDisplayType idpy){
+ if(idpy){
+ delete idpy;
+ }
+}
+
static bool initPixelFormat(HDC dc){
PIXELFORMATDESCRIPTOR pfd;
@@ -301,7 +314,7 @@
}
}
-EglConfig* pixelFormatToConfig(EGLNativeDisplayType display,int renderableType,EGLNativePixelFormatType* frmt,int index){
+EglConfig* pixelFormatToConfig(EGLNativeInternalDisplayType display,int renderableType,EGLNativePixelFormatType* frmt,int index){
EGLint red,green,blue,alpha,depth,stencil;
EGLint supportedSurfaces,visualType,visualId;
@@ -371,7 +384,7 @@
}
-void queryConfigs(EGLNativeDisplayType display,int renderableType,ConfigsList& listOut) {
+void queryConfigs(EGLNativeInternalDisplayType display,int renderableType,ConfigsList& listOut) {
PIXELFORMATDESCRIPTOR pfd;
int iPixelFormat = 1;
HDC dpy = getDummyDC(display,WinDisplay::DEFAULT_DISPLAY);
@@ -394,22 +407,22 @@
}
}
-bool validNativeWin(EGLNativeDisplayType dpy,EGLNativeWindowType win) {
+bool validNativeWin(EGLNativeInternalDisplayType dpy,EGLNativeWindowType win) {
return IsWindow(win);
}
-bool validNativeWin(EGLNativeDisplayType dpy,EGLNativeSurfaceType win) {
+bool validNativeWin(EGLNativeInternalDisplayType dpy,EGLNativeSurfaceType win) {
if (!win) return false;
return validNativeWin(dpy,win->getHwnd());
}
-bool validNativePixmap(EGLNativeDisplayType dpy,EGLNativeSurfaceType pix) {
+bool validNativePixmap(EGLNativeInternalDisplayType dpy,EGLNativeSurfaceType pix) {
BITMAP bm;
if (!pix) return false;
return GetObject(pix->getBmap(), sizeof(BITMAP), (LPSTR)&bm);
}
-bool checkWindowPixelFormatMatch(EGLNativeDisplayType dpy,EGLNativeWindowType win,EglConfig* cfg,unsigned int* width,unsigned int* height) {
+bool checkWindowPixelFormatMatch(EGLNativeInternalDisplayType dpy,EGLNativeWindowType win,EglConfig* cfg,unsigned int* width,unsigned int* height) {
RECT r;
if(!GetClientRect(win,&r)) return false;
*width = r.right - r.left;
@@ -420,7 +433,7 @@
return ret;
}
-bool checkPixmapPixelFormatMatch(EGLNativeDisplayType dpy,EGLNativePixmapType pix,EglConfig* cfg,unsigned int* width,unsigned int* height){
+bool checkPixmapPixelFormatMatch(EGLNativeInternalDisplayType dpy,EGLNativePixmapType pix,EglConfig* cfg,unsigned int* width,unsigned int* height){
BITMAP bm;
if(!GetObject(pix, sizeof(BITMAP), (LPSTR)&bm)) return false;
@@ -431,7 +444,7 @@
return true;
}
-EGLNativeSurfaceType createPbufferSurface(EGLNativeDisplayType display,EglConfig* cfg,EglPbufferSurface* pbSurface) {
+EGLNativeSurfaceType createPbufferSurface(EGLNativeInternalDisplayType display,EglConfig* cfg,EglPbufferSurface* pbSurface) {
HDC dpy = getDummyDC(display,cfg->nativeId());
@@ -466,7 +479,7 @@
return new SrfcInfo(pb);
}
-bool releasePbuffer(EGLNativeDisplayType display,EGLNativeSurfaceType pb) {
+bool releasePbuffer(EGLNativeInternalDisplayType display,EGLNativeSurfaceType pb) {
if (!pb) return false;
if(!s_wglExtProcs->wglReleasePbufferDCARB || !s_wglExtProcs->wglDestroyPbufferARB) return false;
if(!s_wglExtProcs->wglReleasePbufferDCARB(pb->getPbuffer(),pb->getDC()) || !s_wglExtProcs->wglDestroyPbufferARB(pb->getPbuffer())){
@@ -476,7 +489,7 @@
return true;
}
-EGLNativeContextType createContext(EGLNativeDisplayType display,EglConfig* cfg,EGLNativeContextType sharedContext) {
+EGLNativeContextType createContext(EGLNativeInternalDisplayType display,EglConfig* cfg,EGLNativeContextType sharedContext) {
EGLNativeContextType ctx = NULL;
HDC dpy = getDummyDC(display,cfg->nativeId());
@@ -499,7 +512,7 @@
return ctx;
}
-bool destroyContext(EGLNativeDisplayType dpy,EGLNativeContextType ctx) {
+bool destroyContext(EGLNativeInternalDisplayType dpy,EGLNativeContextType ctx) {
if(!wglDeleteContext(ctx)) {
DWORD err = GetLastError();
return false;
@@ -508,7 +521,7 @@
}
-bool makeCurrent(EGLNativeDisplayType display,EglSurface* read,EglSurface* draw,EGLNativeContextType ctx) {
+bool makeCurrent(EGLNativeInternalDisplayType display,EglSurface* read,EglSurface* draw,EGLNativeContextType ctx) {
HDC hdcRead = read ? read->native()->getDC(): NULL;
HDC hdcDraw = draw ? draw->native()->getDC(): NULL;
@@ -526,7 +539,7 @@
return retVal;
}
-void swapBuffers(EGLNativeDisplayType display,EGLNativeSurfaceType srfc){
+void swapBuffers(EGLNativeInternalDisplayType display,EGLNativeSurfaceType srfc){
if(srfc && !SwapBuffers(srfc->getDC())) {
DWORD err = GetLastError();
}
@@ -535,7 +548,7 @@
void waitNative(){}
-void swapInterval(EGLNativeDisplayType dpy,EGLNativeSurfaceType win,int interval) {
+void swapInterval(EGLNativeInternalDisplayType dpy,EGLNativeSurfaceType win,int interval) {
if (s_wglExtProcs->wglSwapIntervalEXT){
s_wglExtProcs->wglSwapIntervalEXT(interval);
@@ -553,4 +566,6 @@
void destroySurface(EGLNativeSurfaceType srfc){
delete srfc;
}
+
+
};
diff --git a/tools/emulator/opengl/host/libs/Translator/EGL/EglX11Api.cpp b/tools/emulator/opengl/host/libs/Translator/EGL/EglX11Api.cpp
index 1d761fa..44044af 100644
--- a/tools/emulator/opengl/host/libs/Translator/EGL/EglX11Api.cpp
+++ b/tools/emulator/opengl/host/libs/Translator/EGL/EglX11Api.cpp
@@ -294,4 +294,11 @@
delete srfc;
};
+EGLNativeInternalDisplayType getInternalDisplay(EGLNativeDisplayType dpy){
+ return dpy;
+}
+
+void deleteDisplay(EGLNativeInternalDisplayType idpy){
+}
+
};
diff --git a/tools/emulator/opengl/host/libs/Translator/include/EGL/eglinternalplatform.h b/tools/emulator/opengl/host/libs/Translator/include/EGL/eglinternalplatform.h
index 319e6f9..c387043 100644
--- a/tools/emulator/opengl/host/libs/Translator/include/EGL/eglinternalplatform.h
+++ b/tools/emulator/opengl/host/libs/Translator/include/EGL/eglinternalplatform.h
@@ -30,10 +30,14 @@
#define WGL_WGLEXT_PROTOTYPES
#include <GL/wglext.h>
+class WinDisplay; //defined in EglWindows.cpp
+typedef WinDisplay* DISPLAY;
+
typedef PIXELFORMATDESCRIPTOR EGLNativePixelFormatType;
#define PIXEL_FORMAT_INITIALIZER {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
typedef HGLRC EGLNativeContextType;
typedef HPBUFFERARB EGLNativePbufferType;
+typedef DISPLAY EGLNativeInternalDisplayType;
#elif defined(__APPLE__)
@@ -41,6 +45,7 @@
#define PIXEL_FORMAT_INITIALIZER NULL
typedef void* EGLNativeContextType;
typedef void* EGLNativePbufferType;
+typedef EGLNativeDisplayType EGLNativeInternalDisplayType;
#elif defined(__unix__)
@@ -50,10 +55,11 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
-typedef GLXFBConfig EGLNativePixelFormatType;
+typedef GLXFBConfig EGLNativePixelFormatType;
#define PIXEL_FORMAT_INITIALIZER 0;
-typedef GLXContext EGLNativeContextType;
-typedef GLXPbuffer EGLNativePbufferType;
+typedef GLXContext EGLNativeContextType;
+typedef GLXPbuffer EGLNativePbufferType;
+typedef EGLNativeDisplayType EGLNativeInternalDisplayType;
#else
#error "Platform not recognized"
diff --git a/tools/emulator/opengl/host/libs/Translator/include/EGL/eglplatform.h b/tools/emulator/opengl/host/libs/Translator/include/EGL/eglplatform.h
index 95aaa22..b159cd7 100644
--- a/tools/emulator/opengl/host/libs/Translator/include/EGL/eglplatform.h
+++ b/tools/emulator/opengl/host/libs/Translator/include/EGL/eglplatform.h
@@ -66,11 +66,9 @@
#endif
#include <windows.h>
-class WinDisplay; //defined in EglWindows.cpp
-typedef WinDisplay* DISPLAY;
-typedef DISPLAY EGLNativeDisplayType;
+typedef HDC EGLNativeDisplayType;
typedef HBITMAP EGLNativePixmapType;
typedef HWND EGLNativeWindowType;