From 9e3304246acf5b58a2ce86eed082784da818a8f0 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Mon, 29 Mar 2010 18:49:31 +0200 Subject: Work-around Symbian 10.1's broken egl.h In Symbian 10.1, egl.h itself includes eglext.h. This leads to EGL_KHR_image & EGL_KHR_image_base being defined, but not the actual function prototypes for eglCreateImageKHR/eglDestroyImageKHR. But, because the extension defines were set, Qt assumed (wrongly) that the EGL library would define eglCreateImageKHR. This left these functions undefined. The work-around is to check the define EGL_EGLEXT_PROTOTYPES and still define the function pointers if it isn't set. Reviewed-By: TrustMe --- src/gui/egl/qegl.cpp | 2 +- src/gui/egl/qegl_p.h | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index f36904d..498245c 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -528,7 +528,7 @@ QEglProperties QEglContext::configProperties() const return QEglProperties(config()); } -#if !defined(EGL_KHR_image) && !defined(EGL_KHR_image_base) +#if (defined(EGL_KHR_image) || defined(EGL_KHR_image_base)) && !defined(EGL_EGLEXT_PROTOTYPES) _eglCreateImageKHR eglCreateImageKHR = 0; _eglDestroyImageKHR eglDestroyImageKHR = 0; #endif diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h index 53abe4a..540cd3d 100644 --- a/src/gui/egl/qegl_p.h +++ b/src/gui/egl/qegl_p.h @@ -134,20 +134,25 @@ QT_BEGIN_NAMESPACE #endif +// Declare/define the bits of EGL_KHR_image_base we need: #if !defined(EGL_KHR_image) && !defined(EGL_KHR_image_base) - typedef void *EGLImageKHR; #define EGL_NO_IMAGE_KHR ((EGLImageKHR)0) #define EGL_IMAGE_PRESERVED_KHR 0x30D2 +#endif +// It is possible that something has included eglext.h (like Symbian 10.1's broken egl.h), in +// which case, EGL_KHR_image/EGL_KHR_image_base will be defined. They may have also defined +// the actual function prototypes, but generally EGL_EGLEXT_PROTOTYPES will be defined in that +// case and we shouldn't re-define them here. +#if (defined(EGL_KHR_image) || defined(EGL_KHR_image_base)) && !defined(EGL_EGLEXT_PROTOTYPES) typedef EGLImageKHR (EGLAPIENTRY *_eglCreateImageKHR)(EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, EGLint*); typedef EGLBoolean (EGLAPIENTRY *_eglDestroyImageKHR)(EGLDisplay, EGLImageKHR); // Defined in qegl.cpp: extern Q_GUI_EXPORT _eglCreateImageKHR eglCreateImageKHR; extern Q_GUI_EXPORT _eglDestroyImageKHR eglDestroyImageKHR; - -#endif // !defined(EGL_KHR_image) && !defined(EGL_KHR_image_base) +#endif // (defined(EGL_KHR_image) || defined(EGL_KHR_image_base)) && !defined(EGL_EGLEXT_PROTOTYPES) #if !defined(EGL_KHR_image) && !defined(EGL_KHR_image_pixmap) #define EGL_NATIVE_PIXMAP_KHR 0x30B0 -- cgit v0.12