diff options
author | Maurice Kalinowski <maurice.kalinowski@theqtcompany.com> | 2016-01-26 10:49:31 +0100 |
---|---|---|
committer | Maurice Kalinowski <maurice.kalinowski@theqtcompany.com> | 2016-01-26 14:04:43 +0000 |
commit | ba7f76dea029bc56288ecb46925f5104c6915a71 (patch) | |
tree | d478781b66bbc223a26685951db16c970abe48fa /src/plugins/platforms/winrt/qwinrteglcontext.cpp | |
parent | a1ba281a26d065d2e901b3a947a8517ec5790504 (diff) |
winrt: Add support for offscreen surfaces
Previously offscreen surfaces were only needed to properly shutdown Qt
Quick applications and the scene graph to have something to potentially
render into but not show on the screen.
However, Canvas3D requires a fully functional surface, preferably
offscreen. Hence we use the QEGLPbuffer provided by eglconvenience in
platformsupport.
Task-number: QTBUG-50576
Change-Id: I1a32820bb2f2c6823be4e96dd92cf7965566f2c3
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>
Reviewed-by: Andrew Knight <andrew.knight@intopalo.com>
Diffstat (limited to 'src/plugins/platforms/winrt/qwinrteglcontext.cpp')
-rw-r--r-- | src/plugins/platforms/winrt/qwinrteglcontext.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/plugins/platforms/winrt/qwinrteglcontext.cpp b/src/plugins/platforms/winrt/qwinrteglcontext.cpp index bc77df566e..882a7a6913 100644 --- a/src/plugins/platforms/winrt/qwinrteglcontext.cpp +++ b/src/plugins/platforms/winrt/qwinrteglcontext.cpp @@ -49,6 +49,7 @@ #include <QOffscreenSurface> #include <QOpenGLContext> #include <QtPlatformSupport/private/qeglconvenience_p.h> +#include <QtPlatformSupport/private/qeglpbuffer_p.h> QT_BEGIN_NAMESPACE @@ -148,14 +149,17 @@ bool QWinRTEGLContext::makeCurrent(QPlatformSurface *windowSurface) Q_D(QWinRTEGLContext); Q_ASSERT(windowSurface->surface()->supportsOpenGL()); - if (windowSurface->surface()->surfaceClass() == QSurface::Offscreen) - return false; + EGLSurface surface; + if (windowSurface->surface()->surfaceClass() == QSurface::Window) { + QWinRTWindow *window = static_cast<QWinRTWindow *>(windowSurface); + if (window->eglSurface() == EGL_NO_SURFACE) + window->createEglSurface(g->eglDisplay, d->eglConfig); - QWinRTWindow *window = static_cast<QWinRTWindow *>(windowSurface); - if (window->eglSurface() == EGL_NO_SURFACE) - window->createEglSurface(g->eglDisplay, d->eglConfig); + surface = window->eglSurface(); + } else { // Offscreen + surface = static_cast<QEGLPbuffer *>(windowSurface)->pbuffer(); + } - EGLSurface surface = window->eglSurface(); if (surface == EGL_NO_SURFACE) return false; @@ -346,4 +350,9 @@ QFunctionPointer QWinRTEGLContext::getProcAddress(const QByteArray &procName) return eglGetProcAddress(procName.constData()); } +EGLDisplay QWinRTEGLContext::display() +{ + return g->eglDisplay; +} + QT_END_NAMESPACE |