winrt: Use ES3 ANGLE code path when blitting widgets

We run into validation issues when using the ES2 code path when blitting
widgets on winrt. By using ES3 we not only avoid this issue, but there
might also be performance gains.

We now call window()->format() instead of window()->requestedFormat as the
latter will not respect the values that were set on initialization of the
native window (which is done in QWinRTWindow's constructor).

Change-Id: I5ed7a9326691375f9c9cb5d8d22ee8d1b643fbd0
Reviewed-by: Andre de la Rocha <andre.rocha@qt.io>
Reviewed-by: Miguel Costa <miguel.costa@qt.io>
bb10
Oliver Wolff 2019-01-31 13:10:50 +01:00
parent 74e04d6ace
commit 86cf366a30
2 changed files with 5 additions and 4 deletions

View File

@ -45,8 +45,7 @@
#include <QtGui/QOpenGLContext>
#include <QtGui/QOpenGLFramebufferObject>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <GLES3/gl3.h>
QT_BEGIN_NAMESPACE
@ -83,7 +82,7 @@ bool QWinRTBackingStore::initialize()
return true;
d->context.reset(new QOpenGLContext);
QSurfaceFormat format = window()->requestedFormat();
QSurfaceFormat format = window()->format();
d->context->setFormat(format);
d->context->setScreen(window()->screen());
if (!d->context->create())
@ -138,7 +137,7 @@ void QWinRTBackingStore::flush(QWindow *window, const QRegion &region, const QPo
const int y2 = y1 + bounds.height();
const int x1 = bounds.x();
const int x2 = x1 + bounds.width();
glBlitFramebufferANGLE(x1, y1, x2, y2,
glBlitFramebuffer(x1, y1, x2, y2,
x1, d->size.height() - y1, x2, d->size.height() - y2,
GL_COLOR_BUFFER_BIT, GL_NEAREST);

View File

@ -112,6 +112,8 @@ QWinRTWindow::QWinRTWindow(QWindow *window)
d->screen = static_cast<QWinRTScreen *>(screen());
handleContentOrientationChange(window->contentOrientation());
d->surfaceFormat.setMajorVersion(3);
d->surfaceFormat.setMinorVersion(0);
d->surfaceFormat.setAlphaBufferSize(0);
d->surfaceFormat.setRedBufferSize(8);
d->surfaceFormat.setGreenBufferSize(8);