diff options
author | Tom Cooksey <thomas.cooksey@nokia.com> | 2010-04-07 15:18:04 (GMT) |
---|---|---|
committer | Tom Cooksey <thomas.cooksey@nokia.com> | 2010-04-07 15:27:37 (GMT) |
commit | 99c17c0efb1331f5d11260b08614c9dff9bbf2e1 (patch) | |
tree | cfdf3d8552e66d2abbe66b9da4886f3e0a52efd9 /src | |
parent | e925d5ebed4b319c57c1a3097a0e25c9cd562bcb (diff) | |
download | Qt-99c17c0efb1331f5d11260b08614c9dff9bbf2e1.zip Qt-99c17c0efb1331f5d11260b08614c9dff9bbf2e1.tar.gz Qt-99c17c0efb1331f5d11260b08614c9dff9bbf2e1.tar.bz2 |
Fix EGLImage & re-enable its use in QtOpenGL
Make sure we set the EGL_KHR_image_base define when we define the
reset of the extension defines. This also makes eglCreateImageKHR
get defined when previously it wasn't.
Reviewed-By: TrustMe
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/egl/qegl_p.h | 9 | ||||
-rw-r--r-- | src/opengl/qgl_x11egl.cpp | 48 |
2 files changed, 30 insertions, 27 deletions
diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h index 540cd3d..f81add6 100644 --- a/src/gui/egl/qegl_p.h +++ b/src/gui/egl/qegl_p.h @@ -139,6 +139,12 @@ QT_BEGIN_NAMESPACE typedef void *EGLImageKHR; #define EGL_NO_IMAGE_KHR ((EGLImageKHR)0) #define EGL_IMAGE_PRESERVED_KHR 0x30D2 +#define EGL_KHR_image_base +#endif + +#if !defined(EGL_KHR_image) && !defined(EGL_KHR_image_pixmap) +#define EGL_NATIVE_PIXMAP_KHR 0x30B0 +#define EGL_KHR_image_pixmap #endif // It is possible that something has included eglext.h (like Symbian 10.1's broken egl.h), in @@ -154,9 +160,6 @@ extern Q_GUI_EXPORT _eglCreateImageKHR eglCreateImageKHR; extern Q_GUI_EXPORT _eglDestroyImageKHR eglDestroyImageKHR; #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 -#endif class QEglProperties; diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index 456e111..af0100b 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -435,30 +435,30 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons // If the pixmap doesn't already have a valid surface, try binding it via EGLImage // first, as going through EGLImage should be faster and better supported: -// if (!textureIsBound && haveEglImageTFP) { -// Q_ASSERT(eglCreateImageKHR); -// -// EGLImageKHR eglImage; -// -// EGLint attribs[] = { -// EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, -// EGL_NONE -// }; -// eglImage = eglCreateImageKHR(QEgl::display(), EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, -// (EGLClientBuffer)QEgl::nativePixmap(pixmap), attribs); -// -// QGLContext* ctx = q; -// glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, eglImage); -// -// GLint err = glGetError(); -// if (err == GL_NO_ERROR) -// textureIsBound = true; -// -// // Once the egl image is bound, the texture becomes a new sibling image and we can safely -// // destroy the EGLImage we created for the pixmap: -// if (eglImage != EGL_NO_IMAGE_KHR) -// eglDestroyImageKHR(QEgl::display(), eglImage); -// } + if (!textureIsBound && haveEglImageTFP) { + Q_ASSERT(eglCreateImageKHR); + + EGLImageKHR eglImage; + + EGLint attribs[] = { + EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, + EGL_NONE + }; + eglImage = eglCreateImageKHR(QEgl::display(), EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, + (EGLClientBuffer)QEgl::nativePixmap(pixmap), attribs); + + QGLContext* ctx = q; + glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, eglImage); + + GLint err = glGetError(); + if (err == GL_NO_ERROR) + textureIsBound = true; + + // Once the egl image is bound, the texture becomes a new sibling image and we can safely + // destroy the EGLImage we created for the pixmap: + if (eglImage != EGL_NO_IMAGE_KHR) + eglDestroyImageKHR(QEgl::display(), eglImage); + } if (!textureIsBound && haveTFP) { // Check to see if the surface is still valid |