Skip to content

Commit

Permalink
winrt: Use ANGLE sub-buffer swap on Windows Phone
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
xknight authored and Andrew Knight committed May 8, 2015
1 parent a34e9eb commit 00a341d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/plugins/platforms/winrt/qwinrteglcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,27 @@

#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)
: QEGLPlatformContext(format, share, display, &config), m_eglSurface(surface)
{
}

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) {
Expand Down
1 change: 1 addition & 0 deletions src/plugins/platforms/winrt/qwinrteglcontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 00a341d

Please sign in to comment.