Merge "opengles emulator: libEGL fixes for ATI driver on windows."

This commit is contained in:
David Turner
2011-08-10 01:09:26 -07:00
committed by Android Code Review
2 changed files with 20 additions and 3 deletions

View File

@@ -49,7 +49,16 @@ GLEScontext* getGLESContext();
#define tls_thread EglThreadInfo::get() #define tls_thread EglThreadInfo::get()
EglGlobalInfo* g_eglInfo = EglGlobalInfo::getInstance(); EglGlobalInfo* g_eglInfo = NULL;
android::Mutex s_eglLock;
void initGlobalInfo()
{
android::Mutex::Autolock mutex(s_eglLock);
if (!g_eglInfo) {
g_eglInfo = EglGlobalInfo::getInstance();
}
}
static EGLiface s_eglIface = { static EGLiface s_eglIface = {
getGLESContext : getGLESContext, getGLESContext : getGLESContext,
@@ -144,6 +153,7 @@ EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id) {
EglDisplay* dpy = NULL; EglDisplay* dpy = NULL;
EGLNativeInternalDisplayType internalDisplay = NULL; EGLNativeInternalDisplayType internalDisplay = NULL;
initGlobalInfo();
if ((dpy = g_eglInfo->getDisplay(display_id))) { if ((dpy = g_eglInfo->getDisplay(display_id))) {
return dpy; return dpy;
@@ -185,6 +195,9 @@ static __translator_getGLESIfaceFunc loadIfaces(const char* libName){
#endif #endif
EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay display, EGLint *major, EGLint *minor) { EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay display, EGLint *major, EGLint *minor) {
initGlobalInfo();
EglDisplay* dpy = g_eglInfo->getDisplay(display); EglDisplay* dpy = g_eglInfo->getDisplay(display);
if(!dpy) { if(!dpy) {
RETURN_ERROR(EGL_FALSE,EGL_BAD_DISPLAY); RETURN_ERROR(EGL_FALSE,EGL_BAD_DISPLAY);
@@ -928,6 +941,9 @@ EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void) {
EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY
eglGetProcAddress(const char *procname){ eglGetProcAddress(const char *procname){
__eglMustCastToProperFunctionPointerType retVal = NULL; __eglMustCastToProperFunctionPointerType retVal = NULL;
initGlobalInfo();
if(!strncmp(procname,"egl",3)) { //EGL proc if(!strncmp(procname,"egl",3)) { //EGL proc
for(int i=0;i < s_eglExtentionsSize;i++){ for(int i=0;i < s_eglExtentionsSize;i++){
if(strcmp(procname,s_eglExtentions[i].name) == 0){ if(strcmp(procname,s_eglExtentions[i].name) == 0){

View File

@@ -220,7 +220,6 @@ static HDC getDummyDC(EGLNativeInternalDisplayType display,int cfgId){
return dpy; return dpy;
} }
void initPtrToWglFunctions(){ void initPtrToWglFunctions(){
HWND hwnd = createDummyWindow(); HWND hwnd = createDummyWindow();
HDC dpy = GetDC(hwnd); HDC dpy = GetDC(hwnd);
if(!hwnd || !dpy){ if(!hwnd || !dpy){
@@ -308,7 +307,9 @@ static bool initPixelFormat(HDC dc){
int iPixelFormat; int iPixelFormat;
if(s_wglExtProcs->wglChoosePixelFormatARB) { if(s_wglExtProcs->wglChoosePixelFormatARB) {
return s_wglExtProcs->wglChoosePixelFormatARB(dc,NULL, NULL, 1, &iPixelFormat, &numpf); int i0 = 0;
float f0 = 0.0f;
return s_wglExtProcs->wglChoosePixelFormatARB(dc,&i0, &f0, 1, &iPixelFormat, &numpf);
} else { } else {
return ChoosePixelFormat(dc,&pfd); return ChoosePixelFormat(dc,&pfd);
} }