summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowsintegration.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2012-05-23 15:07:06 +0200
committerQt by Nokia <qt-info@nokia.com>2012-05-31 09:13:01 +0200
commite7f1106edb1ac37d92d7851c44cd8d99f68eaaf4 (patch)
treeb4d01b3ca52a0ff8a8ec0aa1803beeac78196508 /src/plugins/platforms/windows/qwindowsintegration.cpp
parentb63e101a90b677dcb192214aef35a107620c5f3c (diff)
Windows: Add ANGLE support.
- Add QWindowsEGLContext usable for ANGLE and Windows CE. - Add QWindowsEGLStaticContext containing the display for resource cleanup. - Add EGLSurface to QWindowsWindow. - Add a -angle option specifying the path to the external ANGLE installation to configure, add libraries to the mkspecs. Initial-patch-by: Jabot Corentin <corentinjabot@gmail.com> Task-number: QTBUG-24207 Change-Id: I5f80b1efb6996da7c5d70aa3720f7801c9e4c6af Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com> Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsintegration.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp41
1 files changed, 36 insertions, 5 deletions
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index e0ab113647..d31b059445 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -43,7 +43,10 @@
#include "qwindowsbackingstore.h"
#include "qwindowswindow.h"
#include "qwindowscontext.h"
-#ifndef QT_NO_OPENGL
+#if defined(QT_OPENGL_ES_2)
+# include "qwindowseglcontext.h"
+# include <QtGui/QOpenGLContext>
+#elif !defined(QT_NO_OPENGL)
# include "qwindowsglcontext.h"
#endif
#include "qwindowsscreen.h"
@@ -148,9 +151,19 @@ void *QWindowsNativeInterface::nativeResourceForContext(const QByteArray &resour
qWarning("%s: '%s' requested for null context or context without handle.", __FUNCTION__, resource.constData());
return 0;
}
+#ifdef QT_OPENGL_ES_2
+ QWindowsEGLContext *windowsEglContext = static_cast<QWindowsEGLContext *>(context->handle());
+ if (resource == QByteArrayLiteral("eglDisplay"))
+ return windowsEglContext->eglDisplay();
+ if (resource == QByteArrayLiteral("eglContext"))
+ return windowsEglContext->eglContext();
+ if (resource == QByteArrayLiteral("eglConfig"))
+ return windowsEglContext->eglConfig();
+#else // QT_OPENGL_ES_2
QWindowsGLContext *windowsContext = static_cast<QWindowsGLContext *>(context->handle());
- if (resource == "renderingContext")
+ if (resource == QByteArrayLiteral("renderingContext"))
return windowsContext->renderingContext();
+#endif // !QT_OPENGL_ES_2
qWarning("%s: Invalid key '%s' requested.", __FUNCTION__, resource.constData());
return 0;
@@ -181,7 +194,9 @@ void *QWindowsNativeInterface::createMessageWindow(const QString &classNameTempl
struct QWindowsIntegrationPrivate
{
-#ifndef QT_NO_OPENGL
+#if defined(QT_OPENGL_ES_2)
+ typedef QSharedPointer<QWindowsEGLStaticContext> QEGLStaticContextPtr;
+#elif !defined(QT_NO_OPENGL)
typedef QSharedPointer<QOpenGLStaticContext> QOpenGLStaticContextPtr;
#endif
@@ -196,7 +211,9 @@ struct QWindowsIntegrationPrivate
#endif
QWindowsDrag m_drag;
QWindowsGuiEventDispatcher *m_eventDispatcher;
-#ifndef QT_NO_OPENGL
+#if defined(QT_OPENGL_ES_2)
+ QEGLStaticContextPtr m_staticEGLContext;
+#elif !defined(QT_NO_OPENGL)
QOpenGLStaticContextPtr m_staticOpenGLContext;
#endif
QWindowsInputContext m_inputContext;
@@ -242,8 +259,12 @@ bool QWindowsIntegration::hasCapability(QPlatformIntegration::Capability cap) co
case OpenGL:
return true;
case ThreadedOpenGL:
+# ifdef QT_OPENGL_ES_2
+ return QWindowsEGLContext::hasThreadedOpenGLCapability();
+# else
return true;
-#endif
+# endif // QT_OPENGL_ES_2
+#endif // !QT_NO_OPENGL
default:
return QPlatformIntegration::hasCapability(cap);
}
@@ -293,6 +314,15 @@ QPlatformOpenGLContext
{
if (QWindowsContext::verboseIntegration)
qDebug() << __FUNCTION__ << context->format();
+#ifdef QT_OPENGL_ES_2
+ if (d->m_staticEGLContext.isNull()) {
+ QWindowsEGLStaticContext *staticContext = QWindowsEGLStaticContext::create();
+ if (!staticContext)
+ return 0;
+ d->m_staticEGLContext = QSharedPointer<QWindowsEGLStaticContext>(staticContext);
+ }
+ return new QWindowsEGLContext(d->m_staticEGLContext, context->format(), context->handle());
+#else // QT_OPENGL_ES_2
if (d->m_staticOpenGLContext.isNull())
d->m_staticOpenGLContext =
QSharedPointer<QOpenGLStaticContext>(QOpenGLStaticContext::create());
@@ -300,6 +330,7 @@ QPlatformOpenGLContext
if (result->isValid())
return result.take();
return 0;
+#endif // !QT_OPENGL_ES_2
}
#endif // !QT_NO_OPENGL