Deprecate and remove traces of RasterGLSurface

We no longer use this hybrid surface type approach for Qt Widget's
composition mode. Nowadays we use RHI to compose the widget texture
and the native textures, and the window surface type depends on the
RHI API in use, e.g. QSurface::MetalSurface, or QSurface::OpenGLSurface.

Change-Id: I85001100f681a1cf524b8b7dc50f680a9579b447
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Tor Arne Vestbø 2025-08-27 10:41:51 +02:00
parent e97cb95572
commit 8391c01f38
24 changed files with 18 additions and 58 deletions

View File

@ -90,7 +90,9 @@ public:
WindowManagement, WindowManagement,
WindowActivation, // whether requestActivate is supported WindowActivation, // whether requestActivate is supported
SyncState, SyncState,
RasterGLSurface, #if QT_REMOVAL_QT7_DEPRECATED_SINCE(6, 11)
RasterGLSurface Q_DECL_ENUMERATOR_DEPRECATED_X("This capability is no longer used"),
#endif
AllGLFunctionsQueryable, AllGLFunctionsQueryable,
ApplicationIcon, ApplicationIcon,
SwitchableWidgetComposition, SwitchableWidgetComposition,

View File

@ -32,17 +32,6 @@ QPlatformSurface::QPlatformSurface(QSurface *surface) : m_surface(surface)
{ {
} }
bool QPlatformSurface::isRasterSurface(QSurface *surface)
{
switch (surface->surfaceType()) {
case QSurface::RasterSurface:
case QSurface::RasterGLSurface:
return true;
default:
return false;
};
}
#ifndef QT_NO_DEBUG_STREAM #ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QPlatformSurface *surface) Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QPlatformSurface *surface)
{ {

View File

@ -37,8 +37,6 @@ public:
QSurface *surface() const; QSurface *surface() const;
virtual QPlatformScreen *screen() const = 0; virtual QPlatformScreen *screen() const = 0;
static bool isRasterSurface(QSurface *surface);
private: private:
explicit QPlatformSurface(QSurface *surface); explicit QPlatformSurface(QSurface *surface);

View File

@ -39,9 +39,6 @@ QT_IMPL_METATYPE_EXTERN_TAGGED(QSurface*, QSurface_ptr)
a software rasterizer like Qt's raster paint engine. a software rasterizer like Qt's raster paint engine.
\value OpenGLSurface The surface is an OpenGL compatible surface and can be used \value OpenGLSurface The surface is an OpenGL compatible surface and can be used
in conjunction with QOpenGLContext. in conjunction with QOpenGLContext.
\value RasterGLSurface The surface can be rendered to using a software rasterizer,
and also supports OpenGL. This surface type is intended for internal Qt use, and
requires the use of private API.
\value OpenVGSurface The surface is an OpenVG compatible surface and can be used \value OpenVGSurface The surface is an OpenVG compatible surface and can be used
in conjunction with OpenVG contexts. in conjunction with OpenVG contexts.
\value VulkanSurface The surface is a Vulkan compatible surface and can be used \value VulkanSurface The surface is a Vulkan compatible surface and can be used
@ -52,6 +49,8 @@ QT_IMPL_METATYPE_EXTERN_TAGGED(QSurface*, QSurface_ptr)
\value Direct3DSurface The surface is a Direct 3D 11 and 12 compatible \value Direct3DSurface The surface is a Direct 3D 11 and 12 compatible
surface and can be used in conjunction with the DXGI and Direct3D APIs. This surface and can be used in conjunction with the DXGI and Direct3D APIs. This
surface type is only supported on Windows. surface type is only supported on Windows.
\omitvalue RasterGLSurface
*/ */
/*! /*!
@ -69,12 +68,7 @@ QT_IMPL_METATYPE_EXTERN_TAGGED(QSurface*, QSurface_ptr)
bool QSurface::supportsOpenGL() const bool QSurface::supportsOpenGL() const
{ {
SurfaceType type = surfaceType(); return surfaceType() == OpenGLSurface;
if (type == RasterSurface) {
QPlatformIntegration *integ = QGuiApplicationPrivate::instance()->platformIntegration();
return integ->hasCapability(QPlatformIntegration::OpenGLOnRasterSurface);
}
return type == OpenGLSurface || type == RasterGLSurface;
} }
/*! /*!

View File

@ -30,7 +30,9 @@ public:
enum SurfaceType { enum SurfaceType {
RasterSurface, RasterSurface,
OpenGLSurface, OpenGLSurface,
RasterGLSurface, #if QT_REMOVAL_QT7_DEPRECATED_SINCE(6, 11)
RasterGLSurface Q_DECL_ENUMERATOR_DEPRECATED_X("Use RasterSurface instead"),
#endif
OpenVGSurface, OpenVGSurface,
VulkanSurface, VulkanSurface,
MetalSurface, MetalSurface,

View File

@ -46,7 +46,7 @@ QImage QRasterBackingStore::toImage() const
bool QRasterBackingStore::scroll(const QRegion &region, int dx, int dy) bool QRasterBackingStore::scroll(const QRegion &region, int dx, int dy)
{ {
if (!QPlatformSurface::isRasterSurface(window())) if (window()->surfaceType() != QSurface::RasterSurface)
return false; return false;
extern void qt_scrollRectInImage(QImage &, const QRect &, const QPoint &); extern void qt_scrollRectInImage(QImage &, const QRect &, const QPoint &);

View File

@ -79,8 +79,7 @@ QT_BEGIN_NAMESPACE
will not destroy it. will not destroy it.
\note With the OpenGL backend, QRhiSwapChain can only target QWindow \note With the OpenGL backend, QRhiSwapChain can only target QWindow
instances that have their surface type set to QSurface::OpenGLSurface or instances that have their surface type set to QSurface::OpenGLSurface.
QSurface::RasterGLSurface.
\note \c window is optional. It is recommended to specify it whenever \note \c window is optional. It is recommended to specify it whenever
possible, in order to avoid problems on multi-adapter and multi-screen possible, in order to avoid problems on multi-adapter and multi-screen

View File

@ -35,7 +35,7 @@ QT_BEGIN_NAMESPACE
(inherited from QOpenGLCompositorWindow). (inherited from QOpenGLCompositorWindow).
\note When implementing QOpenGLCompositorWindow::textures() for \note When implementing QOpenGLCompositorWindow::textures() for
windows of type RasterSurface or RasterGLSurface, simply return windows of type RasterSurface, simply return
the list provided by this class' textures(). the list provided by this class' textures().
*/ */

View File

@ -328,7 +328,6 @@ bool QAndroidPlatformIntegration::hasCapability(Capability cap) const
return isValidAndroidContextForRendering(); return isValidAndroidContextForRendering();
case ThreadedOpenGL: case ThreadedOpenGL:
return !needsBasicRenderloopWorkaround() && isValidAndroidContextForRendering(); return !needsBasicRenderloopWorkaround() && isValidAndroidContextForRendering();
case RasterGLSurface: return QtAndroidPrivate::activity().isValid();
case TopStackedNativeChildWindows: return false; case TopStackedNativeChildWindows: return false;
case MaximizeUsingFullscreenGeometry: return true; case MaximizeUsingFullscreenGeometry: return true;
// FIXME QTBUG-118849 - we do not implement grabWindow() anymore, calling it will return // FIXME QTBUG-118849 - we do not implement grabWindow() anymore, calling it will return

View File

@ -258,7 +258,6 @@ bool QCocoaIntegration::hasCapability(QPlatformIntegration::Capability cap) cons
case WindowMasks: case WindowMasks:
case MultipleWindows: case MultipleWindows:
case ForeignWindows: case ForeignWindows:
case RasterGLSurface:
case ApplicationState: case ApplicationState:
case ApplicationIcon: case ApplicationIcon:
case BackingStoreStaticContents: case BackingStoreStaticContents:

View File

@ -228,11 +228,9 @@ bool QEglFSIntegration::hasCapability(QPlatformIntegration::Capability cap) cons
#ifndef QT_NO_OPENGL #ifndef QT_NO_OPENGL
case OpenGL: return true; case OpenGL: return true;
case ThreadedOpenGL: return true; case ThreadedOpenGL: return true;
case RasterGLSurface: return true;
#else #else
case OpenGL: return false; case OpenGL: return false;
case ThreadedOpenGL: return false; case ThreadedOpenGL: return false;
case RasterGLSurface: return false;
#endif #endif
case WindowManagement: return false; case WindowManagement: return false;
case OpenGLOnRasterSurface: return true; case OpenGLOnRasterSurface: return true;

View File

@ -323,8 +323,7 @@ QEglFSScreen *QEglFSWindow::screen() const
bool QEglFSWindow::isRaster() const bool QEglFSWindow::isRaster() const
{ {
const QWindow::SurfaceType type = window()->surfaceType(); return window()->surfaceType() == QSurface::RasterSurface;
return type == QSurface::RasterSurface || type == QSurface::RasterGLSurface;
} }
#ifndef QT_NO_OPENGL #ifndef QT_NO_OPENGL

View File

@ -99,7 +99,7 @@ static QString fboStatusString(GLenum status)
} }
#define Q_ASSERT_IS_GL_SURFACE(surface) \ #define Q_ASSERT_IS_GL_SURFACE(surface) \
Q_ASSERT(surface && (surface->surface()->surfaceType() & (QSurface::OpenGLSurface | QSurface::RasterGLSurface))) Q_ASSERT(surface && (surface->surface()->surfaceType() == QSurface::OpenGLSurface))
bool QIOSContext::makeCurrent(QPlatformSurface *surface) bool QIOSContext::makeCurrent(QPlatformSurface *surface)
{ {

View File

@ -141,8 +141,6 @@ bool QIOSIntegration::hasCapability(Capability cap) const
case OpenGL: case OpenGL:
case ThreadedOpenGL: case ThreadedOpenGL:
return true; return true;
case RasterGLSurface:
return true;
#endif #endif
case ThreadedPixmaps: case ThreadedPixmaps:
return true; return true;

View File

@ -53,7 +53,6 @@ bool QOffscreenX11Integration::hasCapability(QPlatformIntegration::Capability ca
switch (cap) { switch (cap) {
case OpenGL: return true; case OpenGL: return true;
case ThreadedOpenGL: return true; case ThreadedOpenGL: return true;
case RasterGLSurface: return true;
default: return QOffscreenIntegration::hasCapability(cap); default: return QOffscreenIntegration::hasCapability(cap);
} }
} }

View File

@ -187,7 +187,6 @@ bool QWasmIntegration::hasCapability(QPlatformIntegration::Capability cap) const
case ThreadedPixmaps: return true; case ThreadedPixmaps: return true;
case OpenGL: return true; case OpenGL: return true;
case ThreadedOpenGL: return false; case ThreadedOpenGL: return false;
case RasterGLSurface: return false; // to enable this you need to fix qopenglwidget and quickwidget for wasm
case MultipleWindows: return true; case MultipleWindows: return true;
case WindowManagement: return true; case WindowManagement: return true;
case ForeignWindows: return true; case ForeignWindows: return true;

View File

@ -127,8 +127,6 @@ bool QWaylandIntegration::hasCapability(QPlatformIntegration::Capability cap) co
case MultipleWindows: case MultipleWindows:
case NonFullScreenWindows: case NonFullScreenWindows:
return true; return true;
case RasterGLSurface:
return true;
case WindowActivation: case WindowActivation:
return true; return true;
case ScreenWindowGrabbing: // whether QScreen::grabWindow() is supported case ScreenWindowGrabbing: // whether QScreen::grabWindow() is supported
@ -139,7 +137,7 @@ bool QWaylandIntegration::hasCapability(QPlatformIntegration::Capability cap) co
QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWindow *window) const QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWindow *window) const
{ {
if ((window->surfaceType() == QWindow::OpenGLSurface || window->surfaceType() == QWindow::RasterGLSurface) if (window->surfaceType() == QWindow::OpenGLSurface
&& mDisplay->clientBufferIntegration()) && mDisplay->clientBufferIntegration())
return mDisplay->clientBufferIntegration()->createEglWindow(window); return mDisplay->clientBufferIntegration()->createEglWindow(window);

View File

@ -282,12 +282,8 @@ bool QWaylandShmBackingStore::scroll(const QRegion &region, int dx, int dy)
void QWaylandShmBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset) void QWaylandShmBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset)
{ {
Q_UNUSED(offset) Q_UNUSED(offset)
// Invoked when the window is of type RasterSurface or when the window is // Invoked when the window is of type RasterSurface.
// RasterGLSurface and there are no child widgets requiring OpenGL composition.
// For the case of RasterGLSurface + having to compose, the composeAndFlush() is
// called instead. The default implementation from QPlatformBackingStore is sufficient
// however so no need to reimplement that.
if (window != this->window()) { if (window != this->window()) {
auto waylandWindow = static_cast<QWaylandWindow *>(window->handle()); auto waylandWindow = static_cast<QWaylandWindow *>(window->handle());
auto newBuffer = new QWaylandShmBuffer(mDisplay, window->size(), mBackBuffer->image()->format(), mBackBuffer->scale(), mEventQueue); auto newBuffer = new QWaylandShmBuffer(mDisplay, window->size(), mBackBuffer->image()->format(), mBackBuffer->scale(), mEventQueue);

View File

@ -279,8 +279,6 @@ bool QWindowsIntegration::hasCapability(QPlatformIntegration::Capability cap) co
return true; return true;
case ForeignWindows: case ForeignWindows:
return true; return true;
case RasterGLSurface:
return true;
case AllGLFunctionsQueryable: case AllGLFunctionsQueryable:
return true; return true;
case SwitchableWidgetComposition: case SwitchableWidgetComposition:

View File

@ -56,7 +56,6 @@ void *QWindowsNativeInterface::nativeResourceForWindow(const QByteArray &resourc
return bw->handle(); return bw->handle();
switch (window->surfaceType()) { switch (window->surfaceType()) {
case QWindow::RasterSurface: case QWindow::RasterSurface:
case QWindow::RasterGLSurface:
if (type == GetDCType) if (type == GetDCType)
return bw->getDC(); return bw->getDC();
if (type == ReleaseDCType) { if (type == ReleaseDCType) {

View File

@ -226,8 +226,7 @@ QPlatformWindow *QXcbIntegration::createPlatformWindow(QWindow *window) const
} }
} }
Q_ASSERT(window->type() == Qt::Desktop || isTrayIconWindow || !window->supportsOpenGL() Q_ASSERT(window->type() == Qt::Desktop || isTrayIconWindow || !window->supportsOpenGL()); // for VNC
|| (!glIntegration && window->surfaceType() == QSurface::RasterGLSurface)); // for VNC
QXcbWindow *xcbWindow = new QXcbWindow(window); QXcbWindow *xcbWindow = new QXcbWindow(window);
xcbWindow->create(); xcbWindow->create();
return xcbWindow; return xcbWindow;
@ -318,7 +317,6 @@ bool QXcbIntegration::hasCapability(QPlatformIntegration::Capability cap) const
case MultipleWindows: case MultipleWindows:
case ForeignWindows: case ForeignWindows:
case SyncState: case SyncState:
case RasterGLSurface:
return true; return true;
case SwitchableWidgetComposition: case SwitchableWidgetComposition:

View File

@ -302,7 +302,7 @@ void QXcbWindow::create()
if (QPlatformWindow::parent()) { if (QPlatformWindow::parent()) {
// When using a Vulkan QWindow via QWidget::createWindowContainer() we // When using a Vulkan QWindow via QWidget::createWindowContainer() we
// must make sure the visuals are compatible. Now, the parent will be // must make sure the visuals are compatible. Now, the parent will be
// of RasterGLSurface which typically chooses a GLX/EGL compatible // of OpenGLSurface which typically chooses a GLX/EGL compatible
// visual which may not be what the Vulkan window would choose. // visual which may not be what the Vulkan window would choose.
// Therefore, take the parent's visual. // Therefore, take the parent's visual.
if (window()->surfaceType() == QSurface::VulkanSurface if (window()->surfaceType() == QSurface::VulkanSurface

View File

@ -97,7 +97,6 @@ static void dumpConfiguration(QTextStream &str)
DUMP_CAPABILITY(str, platformIntegration, SharedGraphicsCache) DUMP_CAPABILITY(str, platformIntegration, SharedGraphicsCache)
DUMP_CAPABILITY(str, platformIntegration, BufferQueueingOpenGL) DUMP_CAPABILITY(str, platformIntegration, BufferQueueingOpenGL)
DUMP_CAPABILITY(str, platformIntegration, WindowMasks) DUMP_CAPABILITY(str, platformIntegration, WindowMasks)
DUMP_CAPABILITY(str, platformIntegration, RasterGLSurface)
DUMP_CAPABILITY(str, platformIntegration, AllGLFunctionsQueryable) DUMP_CAPABILITY(str, platformIntegration, AllGLFunctionsQueryable)
str << '\n'; str << '\n';

View File

@ -64,9 +64,6 @@ private slots:
void tst_QOpenGLWidget::initTestCase() void tst_QOpenGLWidget::initTestCase()
{ {
// See QOpenGLWidget constructor // See QOpenGLWidget constructor
if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::RasterGLSurface))
QSKIP("QOpenGLWidget is not supported on this platform.");
if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL))
QSKIP("OpenGL is not supported on this platform."); QSKIP("OpenGL is not supported on this platform.");
} }