am c9ad449f: am cea49c2f: Merge "translator EGL:fixing bug in eglGetDisplay caused in Windows Platform"

* commit 'c9ad449f633fbbef0b46f2617bd75d80db1d8942':
  translator EGL:fixing bug in eglGetDisplay caused in Windows Platform
This commit is contained in:
David Turner
2011-07-13 18:18:37 -07:00
committed by Android Git Automerger
11 changed files with 132 additions and 88 deletions

View File

@@ -18,7 +18,7 @@
#include <GLcommon/GLutils.h> #include <GLcommon/GLutils.h>
#include <utils/threads.h> #include <utils/threads.h>
EglDisplay::EglDisplay(EGLNativeDisplayType dpy,bool isDefault) : EglDisplay::EglDisplay(EGLNativeInternalDisplayType dpy,bool isDefault) :
m_dpy(dpy), m_dpy(dpy),
m_initialized(false), m_initialized(false),
m_configInitialized(false), m_configInitialized(false),
@@ -53,9 +53,10 @@ EglDisplay::~EglDisplay() {
delete m_manager[GLES_1_1]; delete m_manager[GLES_1_1];
delete m_manager[GLES_2_0]; 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) { void EglDisplay::initialize(int renderableType) {
android::Mutex::Autolock mutex(m_lock); android::Mutex::Autolock mutex(m_lock);

View File

@@ -38,8 +38,8 @@ class EglDisplay {
public: public:
EglDisplay(EGLNativeDisplayType dpy,bool isDefault = true); EglDisplay(EGLNativeInternalDisplayType dpy,bool isDefault = true);
EGLNativeDisplayType nativeType(); EGLNativeInternalDisplayType nativeType();
int nConfigs(){ return m_configs.size();} int nConfigs(){ return m_configs.size();}
int getConfigs(EGLConfig* configs,int config_size); int getConfigs(EGLConfig* configs,int config_size);
int chooseConfigs(const EglConfig& dummy,EGLConfig* configs,int config_size); int chooseConfigs(const EglConfig& dummy,EGLConfig* configs,int config_size);
@@ -72,19 +72,19 @@ private:
void addMissingConfigs(void); void addMissingConfigs(void);
void initConfigurations(int renderableType); void initConfigurations(int renderableType);
EGLNativeDisplayType m_dpy; EGLNativeInternalDisplayType m_dpy;
bool m_initialized; bool m_initialized;
bool m_configInitialized; bool m_configInitialized;
bool m_isDefault; bool m_isDefault;
ConfigsList m_configs; ConfigsList m_configs;
ContextsHndlMap m_contexts; ContextsHndlMap m_contexts;
SurfacesHndlMap m_surfaces; SurfacesHndlMap m_surfaces;
GlobalNameSpace m_globalNameSpace; GlobalNameSpace m_globalNameSpace;
ObjectNameManager *m_manager[MAX_GLES_VERSION]; ObjectNameManager *m_manager[MAX_GLES_VERSION];
android::Mutex m_lock; android::Mutex m_lock;
ImagesHndlMap m_eglImages; ImagesHndlMap m_eglImages;
unsigned int m_nextEglImageId; unsigned int m_nextEglImageId;
EGLNativeContextType m_globalSharedContext; EGLNativeContextType m_globalSharedContext;
}; };
#endif #endif

View File

@@ -47,28 +47,27 @@ void EglGlobalInfo::delInstance() {
} }
EglDisplay* EglGlobalInfo::addDisplay(EGLNativeDisplayType dpy) { EglDisplay* EglGlobalInfo::addDisplay(EGLNativeDisplayType dpy,EGLNativeInternalDisplayType idpy) {
//search if it is not already exists //search if it is not already exists
android::Mutex::Autolock mutex(m_lock); android::Mutex::Autolock mutex(m_lock);
for(DisplaysList::iterator it = m_displays.begin(); it != m_displays.end() ;it++) { for(DisplaysMap::iterator it = m_displays.begin(); it != m_displays.end() ;it++) {
if((*it)->nativeType() == dpy) return (*it); if((*it).second == dpy) return (*it).first;
} }
EglDisplay* p_dpy = new EglDisplay(dpy); EglDisplay* p_dpy = new EglDisplay(idpy);
if(p_dpy) { if(p_dpy) {
m_displays.push_front(p_dpy); m_displays[p_dpy] = dpy;
return p_dpy; return p_dpy;
} }
return NULL; return NULL;
} }
bool EglGlobalInfo::removeDisplay(EGLDisplay dpy) { bool EglGlobalInfo::removeDisplay(EGLDisplay dpy) {
android::Mutex::Autolock mutex(m_lock); android::Mutex::Autolock mutex(m_lock);
for(DisplaysList::iterator it = m_displays.begin(); it != m_displays.end() ;it++) { for(DisplaysMap::iterator it = m_displays.begin(); it != m_displays.end() ;it++) {
if(static_cast<EGLDisplay>(*it) == dpy) { if(static_cast<EGLDisplay>((*it).first) == dpy) {
delete (*it); delete (*it).first;
m_displays.remove(*it); m_displays.erase(it);
return true; return true;
} }
} }
@@ -77,16 +76,18 @@ bool EglGlobalInfo::removeDisplay(EGLDisplay dpy) {
EglDisplay* EglGlobalInfo::getDisplay(EGLNativeDisplayType dpy) { EglDisplay* EglGlobalInfo::getDisplay(EGLNativeDisplayType dpy) {
android::Mutex::Autolock mutex(m_lock); android::Mutex::Autolock mutex(m_lock);
for(DisplaysList::iterator it = m_displays.begin(); it != m_displays.end() ;it++) { for(DisplaysMap::iterator it = m_displays.begin(); it != m_displays.end() ;it++) {
if((*it)->nativeType() == dpy) return (*it); if((*it).second == dpy) return (*it).first;
} }
return NULL; return NULL;
} }
EglDisplay* EglGlobalInfo::getDisplay(EGLDisplay dpy) { EglDisplay* EglGlobalInfo::getDisplay(EGLDisplay dpy) {
android::Mutex::Autolock mutex(m_lock); android::Mutex::Autolock mutex(m_lock);
for(DisplaysList::iterator it = m_displays.begin(); it != m_displays.end() ;it++) { DisplaysMap::iterator it = m_displays.find(static_cast<EglDisplay*>(dpy));
if(static_cast<EGLDisplay>(*it) == dpy) return (*it); return (it != m_displays.end() ? (*it).first : NULL);
} }
return NULL;
EGLNativeInternalDisplayType EglGlobalInfo::generateInternalDisplay(EGLNativeDisplayType dpy){
return EglOS::getInternalDisplay(dpy);
} }

View File

@@ -24,17 +24,18 @@
#include "EglConfig.h" #include "EglConfig.h"
#include "EglContext.h" #include "EglContext.h"
typedef std::list<EglDisplay*> DisplaysList; typedef std::map<EglDisplay*,EGLNativeDisplayType>DisplaysMap;
class EglGlobalInfo { class EglGlobalInfo {
public: public:
EglDisplay* addDisplay(EGLNativeDisplayType dpy); EglDisplay* addDisplay(EGLNativeDisplayType dpy,EGLNativeInternalDisplayType idpy);
EglDisplay* getDisplay(EGLNativeDisplayType dpy); EglDisplay* getDisplay(EGLNativeDisplayType dpy);
EglDisplay* getDisplay(EGLDisplay dpy); EglDisplay* getDisplay(EGLDisplay dpy);
bool removeDisplay(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;}; void setIface(GLESiface* iface,GLESVersion ver) { m_gles_ifaces[ver] = iface;};
GLESiface* getIface(GLESVersion ver){ return m_gles_ifaces[ver];} GLESiface* getIface(GLESVersion ver){ return m_gles_ifaces[ver];}
@@ -49,13 +50,13 @@ private:
EglGlobalInfo(); EglGlobalInfo();
~EglGlobalInfo(){}; ~EglGlobalInfo(){};
static EglGlobalInfo* m_singleton; static EglGlobalInfo* m_singleton;
static int m_refCount; static int m_refCount;
DisplaysList m_displays; DisplaysMap m_displays;
EGLNativeDisplayType m_default; EGLNativeInternalDisplayType m_default;
GLESiface* m_gles_ifaces[MAX_GLES_VERSION]; GLESiface* m_gles_ifaces[MAX_GLES_VERSION];
android::Mutex m_lock; android::Mutex m_lock;
}; };
#endif #endif

View File

@@ -134,15 +134,20 @@ EGLAPI EGLint EGLAPIENTRY eglGetError(void) {
EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id) { EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id) {
EglDisplay* dpy = NULL; EglDisplay* dpy = NULL;
EGLNativeInternalDisplayType internalDisplay = NULL;
if( display_id == EGL_DEFAULT_DISPLAY) {
display_id = g_eglInfo->getDefaultNativeDisplay();
}
if ((dpy = g_eglInfo->getDisplay(display_id))) { if ((dpy = g_eglInfo->getDisplay(display_id))) {
return dpy; return dpy;
} else { } 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; if(dpy) return dpy;
return EGL_NO_DISPLAY; return EGL_NO_DISPLAY;
} }
@@ -726,7 +731,7 @@ EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay display, EGLSurface draw
RETURN_ERROR(EGL_FALSE,EGL_BAD_MATCH); RETURN_ERROR(EGL_FALSE,EGL_BAD_MATCH);
} }
EGLNativeDisplayType nativeDisplay = dpy->nativeType(); EGLNativeInternalDisplayType nativeDisplay = dpy->nativeType();
EGLNativeSurfaceType nativeRead = newReadPtr->native(); EGLNativeSurfaceType nativeRead = newReadPtr->native();
EGLNativeSurfaceType nativeDraw = newDrawPtr->native(); EGLNativeSurfaceType nativeDraw = newDrawPtr->native();
//checking native window validity //checking native window validity
@@ -899,7 +904,7 @@ EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine) {
SurfacePtr read = currCtx->read(); SurfacePtr read = currCtx->read();
SurfacePtr draw = currCtx->draw(); SurfacePtr draw = currCtx->draw();
EGLNativeDisplayType nativeDisplay = dpy->nativeType(); EGLNativeInternalDisplayType nativeDisplay = dpy->nativeType();
if(read.Ptr()) { if(read.Ptr()) {
if(read->type() == EglSurface::WINDOW && if(read->type() == EglSurface::WINDOW &&
!EglOS::validNativeWin(nativeDisplay,read->native())) { !EglOS::validNativeWin(nativeDisplay,read->native())) {

View File

@@ -212,4 +212,12 @@ EGLNativeSurfaceType createPixmapSurface(EGLNativePixmapType pix){
void destroySurface(EGLNativeSurfaceType srfc){ void destroySurface(EGLNativeSurfaceType srfc){
} }
EGLNativeInternalDisplayType getInternalDisplay(EGLNativeDisplayType dpy){
return (EGLNativeInternalDisplayType)dpy;
}
void deleteDisplay(EGLNativeInternalDisplayType idpy){
}
}; };

View File

@@ -33,23 +33,25 @@
namespace EglOS{ namespace EglOS{
void queryConfigs(EGLNativeDisplayType dpy,int renderable_type,ConfigsList& listOut); void queryConfigs(EGLNativeInternalDisplayType dpy,int renderable_type,ConfigsList& listOut);
bool releasePbuffer(EGLNativeDisplayType dis,EGLNativeSurfaceType pb); bool releasePbuffer(EGLNativeInternalDisplayType dis,EGLNativeSurfaceType pb);
bool destroyContext(EGLNativeDisplayType dpy,EGLNativeContextType ctx); bool destroyContext(EGLNativeInternalDisplayType dpy,EGLNativeContextType ctx);
bool releaseDisplay(EGLNativeDisplayType dpy); bool releaseDisplay(EGLNativeInternalDisplayType dpy);
bool validNativeWin(EGLNativeDisplayType dpy,EGLNativeSurfaceType win); bool validNativeWin(EGLNativeInternalDisplayType dpy,EGLNativeSurfaceType win);
bool validNativeWin(EGLNativeDisplayType dpy,EGLNativeWindowType win); bool validNativeWin(EGLNativeInternalDisplayType dpy,EGLNativeWindowType win);
bool validNativePixmap(EGLNativeDisplayType dpy,EGLNativeSurfaceType pix); bool validNativePixmap(EGLNativeInternalDisplayType dpy,EGLNativeSurfaceType pix);
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);
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);
bool makeCurrent(EGLNativeDisplayType dpy,EglSurface* read,EglSurface* draw,EGLNativeContextType); bool makeCurrent(EGLNativeInternalDisplayType dpy,EglSurface* read,EglSurface* draw,EGLNativeContextType);
void swapBuffers(EGLNativeDisplayType dpy,EGLNativeSurfaceType srfc); void swapBuffers(EGLNativeInternalDisplayType dpy,EGLNativeSurfaceType srfc);
void swapInterval(EGLNativeDisplayType dpy,EGLNativeSurfaceType win,int interval); void swapInterval(EGLNativeInternalDisplayType dpy,EGLNativeSurfaceType win,int interval);
void waitNative(); void waitNative();
EGLNativeDisplayType getDefaultDisplay(); EGLNativeInternalDisplayType getDefaultDisplay();
EGLNativeSurfaceType createPbufferSurface(EGLNativeDisplayType dpy,EglConfig* cfg,EglPbufferSurface* pb); EGLNativeInternalDisplayType getInternalDisplay(EGLNativeDisplayType dpy);
EGLNativeContextType createContext(EGLNativeDisplayType dpy,EglConfig* cfg,EGLNativeContextType sharedContext); 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 createWindowSurface(EGLNativeWindowType wnd);
EGLNativeSurfaceType createPixmapSurface(EGLNativePixmapType pix); EGLNativeSurfaceType createPixmapSurface(EGLNativePixmapType pix);
void destroySurface(EGLNativeSurfaceType srfc); void destroySurface(EGLNativeSurfaceType srfc);

View File

@@ -49,7 +49,9 @@ private:
void WinDisplay::releaseAll(){ void WinDisplay::releaseAll(){
for(std::map<int,DisplayInfo>::iterator it = m_map.begin(); it != m_map.end();it++){ 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); DeleteDC((*it).second.dc);
} }
} }
@@ -190,17 +192,22 @@ HWND createDummyWindow(){
return hwnd; return hwnd;
} }
EGLNativeDisplayType getDefaultDisplay() { EGLNativeInternalDisplayType getDefaultDisplay() {
WinDisplay* dpy = new WinDisplay(); WinDisplay* dpy = new WinDisplay();
HWND hwnd = createDummyWindow(); HWND hwnd = createDummyWindow();
HDC hdc = GetDC(hwnd); HDC hdc = GetDC(hwnd);
dpy->setInfo(WinDisplay::DEFAULT_DISPLAY,DisplayInfo(hdc,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; HDC dpy = NULL;
if(display->infoExists(cfgId)){ if(display->infoExists(cfgId)){
@@ -283,11 +290,17 @@ void initPtrToWglFunctions(){
DeleteDC(dpy); DeleteDC(dpy);
} }
bool releaseDisplay(EGLNativeDisplayType dpy) { bool releaseDisplay(EGLNativeInternalDisplayType dpy) {
dpy->releaseAll(); dpy->releaseAll();
return true; return true;
} }
void deleteDisplay(EGLNativeInternalDisplayType idpy){
if(idpy){
delete idpy;
}
}
static bool initPixelFormat(HDC dc){ static bool initPixelFormat(HDC dc){
PIXELFORMATDESCRIPTOR pfd; PIXELFORMATDESCRIPTOR pfd;
@@ -301,7 +314,7 @@ static bool initPixelFormat(HDC dc){
} }
} }
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 red,green,blue,alpha,depth,stencil;
EGLint supportedSurfaces,visualType,visualId; EGLint supportedSurfaces,visualType,visualId;
@@ -371,7 +384,7 @@ EglConfig* pixelFormatToConfig(EGLNativeDisplayType display,int renderableType,E
} }
void queryConfigs(EGLNativeDisplayType display,int renderableType,ConfigsList& listOut) { void queryConfigs(EGLNativeInternalDisplayType display,int renderableType,ConfigsList& listOut) {
PIXELFORMATDESCRIPTOR pfd; PIXELFORMATDESCRIPTOR pfd;
int iPixelFormat = 1; int iPixelFormat = 1;
HDC dpy = getDummyDC(display,WinDisplay::DEFAULT_DISPLAY); HDC dpy = getDummyDC(display,WinDisplay::DEFAULT_DISPLAY);
@@ -394,22 +407,22 @@ void queryConfigs(EGLNativeDisplayType display,int renderableType,ConfigsList& l
} }
} }
bool validNativeWin(EGLNativeDisplayType dpy,EGLNativeWindowType win) { bool validNativeWin(EGLNativeInternalDisplayType dpy,EGLNativeWindowType win) {
return IsWindow(win); return IsWindow(win);
} }
bool validNativeWin(EGLNativeDisplayType dpy,EGLNativeSurfaceType win) { bool validNativeWin(EGLNativeInternalDisplayType dpy,EGLNativeSurfaceType win) {
if (!win) return false; if (!win) return false;
return validNativeWin(dpy,win->getHwnd()); return validNativeWin(dpy,win->getHwnd());
} }
bool validNativePixmap(EGLNativeDisplayType dpy,EGLNativeSurfaceType pix) { bool validNativePixmap(EGLNativeInternalDisplayType dpy,EGLNativeSurfaceType pix) {
BITMAP bm; BITMAP bm;
if (!pix) return false; if (!pix) return false;
return GetObject(pix->getBmap(), sizeof(BITMAP), (LPSTR)&bm); 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; RECT r;
if(!GetClientRect(win,&r)) return false; if(!GetClientRect(win,&r)) return false;
*width = r.right - r.left; *width = r.right - r.left;
@@ -420,7 +433,7 @@ bool checkWindowPixelFormatMatch(EGLNativeDisplayType dpy,EGLNativeWindowType wi
return ret; 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; BITMAP bm;
if(!GetObject(pix, sizeof(BITMAP), (LPSTR)&bm)) return false; if(!GetObject(pix, sizeof(BITMAP), (LPSTR)&bm)) return false;
@@ -431,7 +444,7 @@ bool checkPixmapPixelFormatMatch(EGLNativeDisplayType dpy,EGLNativePixmapType pi
return true; return true;
} }
EGLNativeSurfaceType createPbufferSurface(EGLNativeDisplayType display,EglConfig* cfg,EglPbufferSurface* pbSurface) { EGLNativeSurfaceType createPbufferSurface(EGLNativeInternalDisplayType display,EglConfig* cfg,EglPbufferSurface* pbSurface) {
HDC dpy = getDummyDC(display,cfg->nativeId()); HDC dpy = getDummyDC(display,cfg->nativeId());
@@ -466,7 +479,7 @@ EGLNativeSurfaceType createPbufferSurface(EGLNativeDisplayType display,EglConfig
return new SrfcInfo(pb); return new SrfcInfo(pb);
} }
bool releasePbuffer(EGLNativeDisplayType display,EGLNativeSurfaceType pb) { bool releasePbuffer(EGLNativeInternalDisplayType display,EGLNativeSurfaceType pb) {
if (!pb) return false; if (!pb) return false;
if(!s_wglExtProcs->wglReleasePbufferDCARB || !s_wglExtProcs->wglDestroyPbufferARB) return false; if(!s_wglExtProcs->wglReleasePbufferDCARB || !s_wglExtProcs->wglDestroyPbufferARB) return false;
if(!s_wglExtProcs->wglReleasePbufferDCARB(pb->getPbuffer(),pb->getDC()) || !s_wglExtProcs->wglDestroyPbufferARB(pb->getPbuffer())){ if(!s_wglExtProcs->wglReleasePbufferDCARB(pb->getPbuffer(),pb->getDC()) || !s_wglExtProcs->wglDestroyPbufferARB(pb->getPbuffer())){
@@ -476,7 +489,7 @@ bool releasePbuffer(EGLNativeDisplayType display,EGLNativeSurfaceType pb) {
return true; return true;
} }
EGLNativeContextType createContext(EGLNativeDisplayType display,EglConfig* cfg,EGLNativeContextType sharedContext) { EGLNativeContextType createContext(EGLNativeInternalDisplayType display,EglConfig* cfg,EGLNativeContextType sharedContext) {
EGLNativeContextType ctx = NULL; EGLNativeContextType ctx = NULL;
HDC dpy = getDummyDC(display,cfg->nativeId()); HDC dpy = getDummyDC(display,cfg->nativeId());
@@ -499,7 +512,7 @@ EGLNativeContextType createContext(EGLNativeDisplayType display,EglConfig* cfg,E
return ctx; return ctx;
} }
bool destroyContext(EGLNativeDisplayType dpy,EGLNativeContextType ctx) { bool destroyContext(EGLNativeInternalDisplayType dpy,EGLNativeContextType ctx) {
if(!wglDeleteContext(ctx)) { if(!wglDeleteContext(ctx)) {
DWORD err = GetLastError(); DWORD err = GetLastError();
return false; return false;
@@ -508,7 +521,7 @@ bool destroyContext(EGLNativeDisplayType dpy,EGLNativeContextType ctx) {
} }
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 hdcRead = read ? read->native()->getDC(): NULL;
HDC hdcDraw = draw ? draw->native()->getDC(): NULL; HDC hdcDraw = draw ? draw->native()->getDC(): NULL;
@@ -526,7 +539,7 @@ bool makeCurrent(EGLNativeDisplayType display,EglSurface* read,EglSurface* draw,
return retVal; return retVal;
} }
void swapBuffers(EGLNativeDisplayType display,EGLNativeSurfaceType srfc){ void swapBuffers(EGLNativeInternalDisplayType display,EGLNativeSurfaceType srfc){
if(srfc && !SwapBuffers(srfc->getDC())) { if(srfc && !SwapBuffers(srfc->getDC())) {
DWORD err = GetLastError(); DWORD err = GetLastError();
} }
@@ -535,7 +548,7 @@ void swapBuffers(EGLNativeDisplayType display,EGLNativeSurfaceType srfc){
void waitNative(){} void waitNative(){}
void swapInterval(EGLNativeDisplayType dpy,EGLNativeSurfaceType win,int interval) { void swapInterval(EGLNativeInternalDisplayType dpy,EGLNativeSurfaceType win,int interval) {
if (s_wglExtProcs->wglSwapIntervalEXT){ if (s_wglExtProcs->wglSwapIntervalEXT){
s_wglExtProcs->wglSwapIntervalEXT(interval); s_wglExtProcs->wglSwapIntervalEXT(interval);
@@ -553,4 +566,6 @@ EGLNativeSurfaceType createPixmapSurface(EGLNativePixmapType pix){
void destroySurface(EGLNativeSurfaceType srfc){ void destroySurface(EGLNativeSurfaceType srfc){
delete srfc; delete srfc;
} }
}; };

View File

@@ -294,4 +294,11 @@ void destroySurface(EGLNativeSurfaceType srfc){
delete srfc; delete srfc;
}; };
EGLNativeInternalDisplayType getInternalDisplay(EGLNativeDisplayType dpy){
return dpy;
}
void deleteDisplay(EGLNativeInternalDisplayType idpy){
}
}; };

View File

@@ -30,10 +30,14 @@ typedef SURFACE EGLNativeSurfaceType;
#define WGL_WGLEXT_PROTOTYPES #define WGL_WGLEXT_PROTOTYPES
#include <GL/wglext.h> #include <GL/wglext.h>
class WinDisplay; //defined in EglWindows.cpp
typedef WinDisplay* DISPLAY;
typedef PIXELFORMATDESCRIPTOR EGLNativePixelFormatType; 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}; #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 HGLRC EGLNativeContextType;
typedef HPBUFFERARB EGLNativePbufferType; typedef HPBUFFERARB EGLNativePbufferType;
typedef DISPLAY EGLNativeInternalDisplayType;
#elif defined(__APPLE__) #elif defined(__APPLE__)
@@ -41,6 +45,7 @@ typedef void* EGLNativePixelFormatType;
#define PIXEL_FORMAT_INITIALIZER NULL #define PIXEL_FORMAT_INITIALIZER NULL
typedef void* EGLNativeContextType; typedef void* EGLNativeContextType;
typedef void* EGLNativePbufferType; typedef void* EGLNativePbufferType;
typedef EGLNativeDisplayType EGLNativeInternalDisplayType;
#elif defined(__unix__) #elif defined(__unix__)
@@ -50,10 +55,11 @@ typedef void* EGLNativePbufferType;
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
typedef GLXFBConfig EGLNativePixelFormatType; typedef GLXFBConfig EGLNativePixelFormatType;
#define PIXEL_FORMAT_INITIALIZER 0; #define PIXEL_FORMAT_INITIALIZER 0;
typedef GLXContext EGLNativeContextType; typedef GLXContext EGLNativeContextType;
typedef GLXPbuffer EGLNativePbufferType; typedef GLXPbuffer EGLNativePbufferType;
typedef EGLNativeDisplayType EGLNativeInternalDisplayType;
#else #else
#error "Platform not recognized" #error "Platform not recognized"

View File

@@ -66,11 +66,9 @@
#endif #endif
#include <windows.h> #include <windows.h>
class WinDisplay; //defined in EglWindows.cpp
typedef WinDisplay* DISPLAY;
typedef DISPLAY EGLNativeDisplayType; typedef HDC EGLNativeDisplayType;
typedef HBITMAP EGLNativePixmapType; typedef HBITMAP EGLNativePixmapType;
typedef HWND EGLNativeWindowType; typedef HWND EGLNativeWindowType;