eglfs: Fix raster windows
Also sanitize the initial WebAssembly hack. Both eglfs and wasm lack the concept of true raster windows. A QWindow with RasterSurface is rendered with OpenGL no matter what. The two platforms took two different approaches to work around the rest of the machinery: - wasm disabled the QOpenGLContext warning for non-OpenGL QWindows, - eglfs forced the QWindow surfaceType to OpenGLSurface whenever it was originally set to RasterSurface. Now, the latter breaks sincec4e9eabc30
, leaving all raster window applications failing on eglfs, because flush in the backingstore is now checking the surface type and disallows OpenGLSurface windows. (just like how QOpenGLContext disallows RasterSurface windows) To solve all this correctly, introduce a new platform capability, OpenGLOnRasterSurface, and remove the special handling in the platform plugins. Change-Id: I7785dfb1c955577bbdccdc14ebaaac5babdec57c Fixes: QTBUG-77100 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit53a6f7b783
) Reviewed-by: Jukka Jokiniva <jukka.jokiniva@qt.io>
This commit is contained in:
parent
ee94d9c169
commit
a9b9a88134
@ -976,11 +976,8 @@ bool QOpenGLContext::makeCurrent(QSurface *surface)
|
||||
if (!surface->surfaceHandle())
|
||||
return false;
|
||||
if (!surface->supportsOpenGL()) {
|
||||
#ifndef Q_OS_WASM // ### work around the WASM platform plugin using QOpenGLContext with raster surfaces.
|
||||
// see QTBUG-70076
|
||||
qWarning() << "QOpenGLContext::makeCurrent() called with non-opengl surface" << surface;
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!d->platformGLContext->makeCurrent(surface->surfaceHandle()))
|
||||
|
@ -244,6 +244,9 @@ QPlatformServices *QPlatformIntegration::services() const
|
||||
\value TopStackedNativeChildWindows The platform supports native child windows via
|
||||
QWindowContainer without having to punch a transparent hole in the
|
||||
backingstore. (since 5.10)
|
||||
|
||||
\value OpenGLOnRasterSurface The platform supports making a QOpenGLContext current
|
||||
in combination with a QWindow of type RasterSurface.
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -105,7 +105,8 @@ public:
|
||||
AllGLFunctionsQueryable,
|
||||
ApplicationIcon,
|
||||
SwitchableWidgetComposition,
|
||||
TopStackedNativeChildWindows
|
||||
TopStackedNativeChildWindows,
|
||||
OpenGLOnRasterSurface
|
||||
};
|
||||
|
||||
virtual ~QPlatformIntegration() { }
|
||||
|
@ -39,6 +39,8 @@
|
||||
|
||||
#include "qsurface.h"
|
||||
#include "qopenglcontext.h"
|
||||
#include <qpa/qplatformintegration.h>
|
||||
#include <QtGui/private/qguiapplication_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -103,6 +105,10 @@ QT_BEGIN_NAMESPACE
|
||||
bool QSurface::supportsOpenGL() const
|
||||
{
|
||||
SurfaceType type = surfaceType();
|
||||
if (type == RasterSurface) {
|
||||
QPlatformIntegration *integ = QGuiApplicationPrivate::instance()->platformIntegration();
|
||||
return integ->hasCapability(QPlatformIntegration::OpenGLOnRasterSurface);
|
||||
}
|
||||
return type == OpenGLSurface || type == RasterGLSurface;
|
||||
}
|
||||
|
||||
|
@ -265,6 +265,7 @@ bool QEglFSIntegration::hasCapability(QPlatformIntegration::Capability cap) cons
|
||||
case RasterGLSurface: return false;
|
||||
#endif
|
||||
case WindowManagement: return false;
|
||||
case OpenGLOnRasterSurface: return true;
|
||||
default: return QPlatformIntegration::hasCapability(cap);
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,6 @@ QEglFSWindow::QEglFSWindow(QWindow *w)
|
||||
m_backingStore(0),
|
||||
m_rasterCompositingContext(0),
|
||||
#endif
|
||||
m_raster(false),
|
||||
m_winId(0),
|
||||
m_surface(EGL_NO_SURFACE),
|
||||
m_window(0),
|
||||
@ -94,11 +93,6 @@ void QEglFSWindow::create()
|
||||
|
||||
m_winId = newWId();
|
||||
|
||||
// Save the original surface type before changing to OpenGLSurface.
|
||||
m_raster = (window()->surfaceType() == QSurface::RasterSurface);
|
||||
if (m_raster) // change to OpenGL, but not for RasterGLSurface
|
||||
window()->setSurfaceType(QSurface::OpenGLSurface);
|
||||
|
||||
if (window()->type() == Qt::Desktop) {
|
||||
QRect fullscreenRect(QPoint(), screen()->availableGeometry().size());
|
||||
QWindowSystemInterface::handleGeometryChange(window(), fullscreenRect);
|
||||
@ -329,7 +323,8 @@ QEglFSScreen *QEglFSWindow::screen() const
|
||||
|
||||
bool QEglFSWindow::isRaster() const
|
||||
{
|
||||
return m_raster || window()->surfaceType() == QSurface::RasterGLSurface;
|
||||
const QWindow::SurfaceType type = window()->surfaceType();
|
||||
return type == QSurface::RasterSurface || type == QSurface::RasterGLSurface;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
|
@ -118,7 +118,6 @@ protected:
|
||||
QOpenGLCompositorBackingStore *m_backingStore;
|
||||
QOpenGLContext *m_rasterCompositingContext;
|
||||
#endif
|
||||
bool m_raster;
|
||||
WId m_winId;
|
||||
|
||||
EGLSurface m_surface;
|
||||
|
@ -168,6 +168,7 @@ bool QWasmIntegration::hasCapability(QPlatformIntegration::Capability cap) const
|
||||
case RasterGLSurface: return false; // to enable this you need to fix qopenglwidget and quickwidget for wasm
|
||||
case MultipleWindows: return true;
|
||||
case WindowManagement: return true;
|
||||
case OpenGLOnRasterSurface: return true;
|
||||
default: return QPlatformIntegration::hasCapability(cap);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user