summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/windows')
-rw-r--r--src/plugins/platforms/windows/qwindowseglcontext.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp60
-rw-r--r--src/plugins/platforms/windows/qwindowsnativeinterface.cpp41
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp14
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.h10
-rw-r--r--src/plugins/platforms/windows/windows.pri16
6 files changed, 86 insertions, 59 deletions
diff --git a/src/plugins/platforms/windows/qwindowseglcontext.cpp b/src/plugins/platforms/windows/qwindowseglcontext.cpp
index a8617b2c2b..e025d7e513 100644
--- a/src/plugins/platforms/windows/qwindowseglcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowseglcontext.cpp
@@ -135,11 +135,7 @@ QWindowsEGLContext::~QWindowsEGLContext()
bool QWindowsEGLContext::hasThreadedOpenGLCapability()
{
-#ifdef QT_OPENGL_ES_2_ANGLE
return false;
-#else
- return true;
-#endif
}
EGLSurface QWindowsEGLContext::eglSurfaceForPlatformSurface(QPlatformSurface *surface)
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index 8a91929733..e5d9444966 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -43,12 +43,20 @@
#include "qwindowsintegration.h"
#include "qwindowswindow.h"
#include "qwindowscontext.h"
-#if defined(QT_OPENGL_ES_2)
+
+#if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC)
# include "qwindowseglcontext.h"
# include <QtGui/QOpenGLContext>
-#elif !defined(QT_NO_OPENGL)
+#endif
+
+#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
# include "qwindowsglcontext.h"
#endif
+
+#if !defined(QT_NO_OPENGL)
+# include <QtGui/QOpenGLFunctions>
+#endif
+
#include "qwindowsscreen.h"
#include "qwindowstheme.h"
#include "qwindowsservices.h"
@@ -125,9 +133,10 @@ QT_BEGIN_NAMESPACE
struct QWindowsIntegrationPrivate
{
-#if defined(QT_OPENGL_ES_2)
+#if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC)
typedef QSharedPointer<QWindowsEGLStaticContext> QEGLStaticContextPtr;
-#elif !defined(QT_NO_OPENGL)
+#endif
+#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
typedef QSharedPointer<QOpenGLStaticContext> QOpenGLStaticContextPtr;
#endif
@@ -143,9 +152,10 @@ struct QWindowsIntegrationPrivate
QWindowsDrag m_drag;
# endif
#endif
-#if defined(QT_OPENGL_ES_2)
+#if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC)
QEGLStaticContextPtr m_staticEGLContext;
-#elif !defined(QT_NO_OPENGL)
+#endif
+#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
QOpenGLStaticContextPtr m_staticOpenGLContext;
#endif
QWindowsInputContext m_inputContext;
@@ -216,8 +226,8 @@ bool QWindowsIntegration::hasCapability(QPlatformIntegration::Capability cap) co
case OpenGL:
return true;
case ThreadedOpenGL:
-# ifdef QT_OPENGL_ES_2
- return QWindowsEGLContext::hasThreadedOpenGLCapability();
+#if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC)
+ return QOpenGLFunctions::isES() ? QWindowsEGLContext::hasThreadedOpenGLCapability() : true;
# else
return true;
# endif // QT_OPENGL_ES_2
@@ -278,23 +288,27 @@ QPlatformOpenGLContext
*QWindowsIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
{
qCDebug(lcQpaGl) << __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);
+#if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC)
+ if (QOpenGLFunctions::isES()){
+ 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->shareHandle());
+ }
+#endif
+#if !defined(QT_OPENGL_ES_2)
+ if (!QOpenGLFunctions::isES()) {
+ if (d->m_staticOpenGLContext.isNull())
+ d->m_staticOpenGLContext =
+ QSharedPointer<QOpenGLStaticContext>(QOpenGLStaticContext::create());
+ QScopedPointer<QWindowsGLContext> result(new QWindowsGLContext(d->m_staticOpenGLContext, context));
+ return result->isValid() ? result.take() : 0;
}
- return new QWindowsEGLContext(d->m_staticEGLContext, context->format(), context->shareHandle());
-#else // QT_OPENGL_ES_2
- if (d->m_staticOpenGLContext.isNull())
- d->m_staticOpenGLContext =
- QSharedPointer<QOpenGLStaticContext>(QOpenGLStaticContext::create());
- QScopedPointer<QWindowsGLContext> result(new QWindowsGLContext(d->m_staticOpenGLContext, context));
- if (result->isValid())
- return result.take();
- return 0;
#endif // !QT_OPENGL_ES_2
+ return 0;
}
#endif // !QT_NO_OPENGL
diff --git a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp
index 9bf4b3240c..fb1b63084f 100644
--- a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp
+++ b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp
@@ -43,13 +43,19 @@
#include "qwindowswindow.h"
#include "qwindowscontext.h"
-#if defined(QT_OPENGL_ES_2)
+#if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC)
# include "qwindowseglcontext.h"
# include <QtGui/QOpenGLContext>
-#elif !defined(QT_NO_OPENGL)
+#endif
+
+#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
# include "qwindowsglcontext.h"
#endif
+#if !defined(QT_NO_OPENGL)
+# include <QtGui/QOpenGLFunctions>
+#endif
+
#include <QtGui/QWindow>
QT_BEGIN_NAMESPACE
@@ -113,19 +119,24 @@ 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 == QByteArrayLiteral("renderingContext"))
- return windowsContext->renderingContext();
-#endif // !QT_OPENGL_ES_2
+#if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC)
+ if (QOpenGLFunctions::isES()) {
+ 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();
+ }
+#endif // QT_OPENGL_ES_2 || QT_OPENGL_DYNAMIC
+#if !defined(QT_OPENGL_ES_2)
+ if (!QOpenGLFunctions::isES()) {
+ QWindowsGLContext *windowsContext = static_cast<QWindowsGLContext *>(context->handle());
+ if (resource == QByteArrayLiteral("renderingContext"))
+ return windowsContext->renderingContext();
+ }
+#endif // QT_OPENGL_ES_2 || QT_OPENGL_DYNAMIC
qWarning("%s: Invalid key '%s' requested.", __FUNCTION__, resource.constData());
return 0;
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 256967d25f..a0a9e75e2d 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -48,8 +48,9 @@
# include "qwindowscursor.h"
#endif
-#ifdef QT_OPENGL_ES_2
+#if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC)
# include "qwindowseglcontext.h"
+# include <QtGui/QOpenGLFunctions>
#endif
#include <QtGui/QGuiApplication>
@@ -861,7 +862,7 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data)
m_dropTarget(0),
m_savedStyle(0),
m_format(aWindow->format()),
-#ifdef QT_OPENGL_ES_2
+#if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC)
m_eglSurface(0),
#endif
#ifdef Q_OS_WINCE
@@ -878,8 +879,9 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data)
return; // No further handling for Qt::Desktop
if (aWindow->surfaceType() == QWindow::OpenGLSurface) {
setFlag(OpenGLSurface);
-#ifdef QT_OPENGL_ES_2
- setFlag(OpenGL_ES2);
+#if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC)
+ if (QOpenGLFunctions::isES())
+ setFlag(OpenGL_ES2);
#endif
}
updateDropSite();
@@ -933,7 +935,7 @@ void QWindowsWindow::destroyWindow()
if (hasMouseCapture())
setMouseGrabEnabled(false);
setDropSiteEnabled(false);
-#ifdef QT_OPENGL_ES_2
+#if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC)
if (m_eglSurface) {
qCDebug(lcQpaGl) << __FUNCTION__ << "Freeing EGL surface " << m_eglSurface << window();
eglDestroySurface(m_staticEglContext->display(), m_eglSurface);
@@ -2107,7 +2109,7 @@ void QWindowsWindow::setEnabled(bool enabled)
setStyle(newStyle);
}
-#ifdef QT_OPENGL_ES_2
+#if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC)
EGLSurface QWindowsWindow::ensureEglSurfaceHandle(const QWindowsWindow::QWindowsEGLStaticContextPtr &staticContext, EGLConfig config)
{
if (!m_eglSurface) {
diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h
index 1d515fd2fe..ba0f22bb0a 100644
--- a/src/plugins/platforms/windows/qwindowswindow.h
+++ b/src/plugins/platforms/windows/qwindowswindow.h
@@ -50,7 +50,7 @@
#include <qpa/qplatformwindow.h>
-#ifdef QT_OPENGL_ES_2
+#if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC)
# include <QtCore/QSharedPointer>
# include <EGL/egl.h>
#endif
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
class QWindowsOleDropTarget;
class QDebug;
-#ifdef QT_OPENGL_ES_2
+#if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC)
class QWindowsEGLStaticContext;
#endif
@@ -130,7 +130,7 @@ struct QWindowsWindowData
class QWindowsWindow : public QPlatformWindow
{
public:
-#ifdef QT_OPENGL_ES_2
+#if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC)
typedef QSharedPointer<QWindowsEGLStaticContext> QWindowsEGLStaticContextPtr;
#endif
@@ -206,7 +206,7 @@ public:
QMargins customMargins() const { return m_data.customMargins; }
void setCustomMargins(const QMargins &m);
-#ifdef QT_OPENGL_ES_2
+#if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC)
EGLSurface eglSurfaceHandle() const { return m_eglSurface;}
EGLSurface ensureEglSurfaceHandle(const QWindowsEGLStaticContextPtr &staticContext, EGLConfig config);
#endif
@@ -301,7 +301,7 @@ private:
unsigned m_savedStyle;
QRect m_savedFrameGeometry;
const QSurfaceFormat m_format;
-#ifdef QT_OPENGL_ES_2
+#if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC)
EGLSurface m_eglSurface;
QSharedPointer<QWindowsEGLStaticContext> m_staticEglContext;
#endif
diff --git a/src/plugins/platforms/windows/windows.pri b/src/plugins/platforms/windows/windows.pri
index c10d00c2ad..13799ba1ba 100644
--- a/src/plugins/platforms/windows/windows.pri
+++ b/src/plugins/platforms/windows/windows.pri
@@ -2,7 +2,7 @@
LIBS *= -lole32
!wince*:LIBS *= -luser32 -lwinspool -limm32 -lwinmm -loleaut32
-contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles2):LIBS *= -lopengl32
+contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles2):!contains(QT_CONFIG, dynamicgl): LIBS *= -lopengl32
mingw: LIBS *= -luuid
# For the dialog helpers:
@@ -71,11 +71,15 @@ INCLUDEPATH += $$PWD
contains(QT_CONFIG, opengles2) {
SOURCES += $$PWD/qwindowseglcontext.cpp
HEADERS += $$PWD/qwindowseglcontext.h
-} else {
- contains(QT_CONFIG, opengl) {
- SOURCES += $$PWD/qwindowsglcontext.cpp
- HEADERS += $$PWD/qwindowsglcontext.h
- }
+} else: contains(QT_CONFIG,opengl) {
+ SOURCES += $$PWD/qwindowsglcontext.cpp
+ HEADERS += $$PWD/qwindowsglcontext.h
+}
+
+# Dynamic GL needs both WGL and EGL
+contains(QT_CONFIG,dynamicgl) {
+ SOURCES += $$PWD/qwindowseglcontext.cpp
+ HEADERS += $$PWD/qwindowseglcontext.h
}
!contains( DEFINES, QT_NO_CLIPBOARD ) {