From 00a341daa7c55926ce4d1c1f0290520b5e6c22a5 Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Sun, 3 May 2015 20:52:15 +0300 Subject: winrt: Use ANGLE sub-buffer swap on Windows Phone This allows the plugin to communicate the swap region to ANGLE and avoid glitches when the orientation changes. Task-number: QTBUG-44333 Change-Id: I40240cbcb3aaec92dbf4a82f4957965e92b9c3da Reviewed-by: Oliver Wolff --- src/plugins/platforms/winrt/qwinrteglcontext.cpp | 14 ++++++++++++++ src/plugins/platforms/winrt/qwinrteglcontext.h | 1 + 2 files changed, 15 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/winrt/qwinrteglcontext.cpp b/src/plugins/platforms/winrt/qwinrteglcontext.cpp index fd90582119..0832fbb586 100644 --- a/src/plugins/platforms/winrt/qwinrteglcontext.cpp +++ b/src/plugins/platforms/winrt/qwinrteglcontext.cpp @@ -33,6 +33,9 @@ #include "qwinrteglcontext.h" +#define EGL_EGLEXT_PROTOTYPES +#include "EGL/eglext.h" + QT_BEGIN_NAMESPACE QWinRTEGLContext::QWinRTEGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, EGLSurface surface, EGLConfig config) @@ -40,6 +43,17 @@ QWinRTEGLContext::QWinRTEGLContext(const QSurfaceFormat &format, QPlatformOpenGL { } +void QWinRTEGLContext::swapBuffers(QPlatformSurface *surface) +{ +#ifdef Q_OS_WINPHONE + const QSize size = surface->surface()->size(); + eglPostSubBufferNV(eglDisplay(), eglSurfaceForPlatformSurface(surface), + 0, 0, size.width(), size.height()); +#else + eglSwapBuffers(eglDisplay(), eglSurfaceForPlatformSurface(surface)); +#endif +} + EGLSurface QWinRTEGLContext::eglSurfaceForPlatformSurface(QPlatformSurface *surface) { if (surface->surface()->surfaceClass() == QSurface::Window) { diff --git a/src/plugins/platforms/winrt/qwinrteglcontext.h b/src/plugins/platforms/winrt/qwinrteglcontext.h index bec9c19089..9b1ef37d1b 100644 --- a/src/plugins/platforms/winrt/qwinrteglcontext.h +++ b/src/plugins/platforms/winrt/qwinrteglcontext.h @@ -43,6 +43,7 @@ class QWinRTEGLContext : public QEGLPlatformContext public: explicit QWinRTEGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, EGLSurface surface, EGLConfig config); + void swapBuffers(QPlatformSurface *surface) Q_DECL_OVERRIDE; QFunctionPointer getProcAddress(const QByteArray &procName) Q_DECL_OVERRIDE; protected: -- cgit v1.2.3