summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/winrt
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-10-31 19:08:25 +0100
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-11-02 08:48:51 +0000
commit9b735a46182350e42495053ca741150a06f5c546 (patch)
tree326af7f04aa8dc8521581ab8b0eacfe81febf35c /src/plugins/platforms/winrt
parent97b564374b99be4e3c077e6999e61d3d6688cf17 (diff)
WinRT: Add support for QOpenGLWidget
Also involves adding support for sharing contexts. Task-number: QTBUG-48663 Change-Id: I0b18846ae70b63a0a21132f820a12ea744c0e936 Reviewed-by: Andrew Knight <andrew.knight@intopalo.com> Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/winrt')
-rw-r--r--src/plugins/platforms/winrt/qwinrtbackingstore.cpp3
-rw-r--r--src/plugins/platforms/winrt/qwinrteglcontext.cpp10
-rw-r--r--src/plugins/platforms/winrt/qwinrtintegration.cpp1
3 files changed, 10 insertions, 4 deletions
diff --git a/src/plugins/platforms/winrt/qwinrtbackingstore.cpp b/src/plugins/platforms/winrt/qwinrtbackingstore.cpp
index ee54bf795c..4517200a2d 100644
--- a/src/plugins/platforms/winrt/qwinrtbackingstore.cpp
+++ b/src/plugins/platforms/winrt/qwinrtbackingstore.cpp
@@ -66,7 +66,8 @@ QWinRTBackingStore::QWinRTBackingStore(QWindow *window)
d->initialized = false;
d->screen = static_cast<QWinRTScreen*>(window->screen()->handle());
- window->setSurfaceType(QSurface::OpenGLSurface); // Required for flipping, but could be done in the swap
+ if (window->surfaceType() == QSurface::RasterSurface)
+ window->setSurfaceType(QSurface::OpenGLSurface);
}
bool QWinRTBackingStore::initialize()
diff --git a/src/plugins/platforms/winrt/qwinrteglcontext.cpp b/src/plugins/platforms/winrt/qwinrteglcontext.cpp
index c0ff92f738..3fd0278360 100644
--- a/src/plugins/platforms/winrt/qwinrteglcontext.cpp
+++ b/src/plugins/platforms/winrt/qwinrteglcontext.cpp
@@ -70,9 +70,11 @@ Q_GLOBAL_STATIC(WinRTEGLDisplay, g)
class QWinRTEGLContextPrivate
{
public:
+ QWinRTEGLContextPrivate() : eglContext(EGL_NO_CONTEXT), eglShareContext(EGL_NO_CONTEXT) { }
QSurfaceFormat format;
EGLConfig eglConfig;
EGLContext eglContext;
+ EGLContext eglShareContext;
};
QWinRTEGLContext::QWinRTEGLContext(QOpenGLContext *context)
@@ -81,6 +83,8 @@ QWinRTEGLContext::QWinRTEGLContext(QOpenGLContext *context)
Q_D(QWinRTEGLContext);
d->format = context->format();
d->format.setRenderableType(QSurfaceFormat::OpenGLES);
+ if (QPlatformOpenGLContext *shareHandle = context->shareHandle())
+ d->eglShareContext = static_cast<QWinRTEGLContext *>(shareHandle)->d_ptr->eglContext;
}
QWinRTEGLContext::~QWinRTEGLContext()
@@ -126,7 +130,7 @@ void QWinRTEGLContext::initialize()
EGL_CONTEXT_FLAGS_KHR, flags,
EGL_NONE
};
- d->eglContext = eglCreateContext(g->eglDisplay, d->eglConfig, nullptr, attributes);
+ d->eglContext = eglCreateContext(g->eglDisplay, d->eglConfig, d->eglShareContext, attributes);
if (d->eglContext == EGL_NO_CONTEXT) {
qWarning("QEGLPlatformContext: Failed to create context: %x", eglGetError());
return;
@@ -136,7 +140,7 @@ void QWinRTEGLContext::initialize()
bool QWinRTEGLContext::makeCurrent(QPlatformSurface *windowSurface)
{
Q_D(QWinRTEGLContext);
- Q_ASSERT(windowSurface->surface()->surfaceType() == QSurface::OpenGLSurface);
+ Q_ASSERT(windowSurface->surface()->supportsOpenGL());
QWinRTWindow *window = static_cast<QWinRTWindow *>(windowSurface);
if (window->eglSurface() == EGL_NO_SURFACE)
@@ -166,7 +170,7 @@ void QWinRTEGLContext::doneCurrent()
void QWinRTEGLContext::swapBuffers(QPlatformSurface *windowSurface)
{
- Q_ASSERT(windowSurface->surface()->surfaceType() == QSurface::OpenGLSurface);
+ Q_ASSERT(windowSurface->surface()->supportsOpenGL());
const QWinRTWindow *window = static_cast<QWinRTWindow *>(windowSurface);
eglSwapBuffers(g->eglDisplay, window->eglSurface());
diff --git a/src/plugins/platforms/winrt/qwinrtintegration.cpp b/src/plugins/platforms/winrt/qwinrtintegration.cpp
index 7ee3bf8593..dabb2603b6 100644
--- a/src/plugins/platforms/winrt/qwinrtintegration.cpp
+++ b/src/plugins/platforms/winrt/qwinrtintegration.cpp
@@ -188,6 +188,7 @@ bool QWinRTIntegration::hasCapability(QPlatformIntegration::Capability cap) cons
case ApplicationState:
case NonFullScreenWindows:
case MultipleWindows:
+ case RasterGLSurface:
return true;
default:
return QPlatformIntegration::hasCapability(cap);