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,
WindowActivation, // whether requestActivate is supported
SyncState,
RasterGLSurface,
#if QT_REMOVAL_QT7_DEPRECATED_SINCE(6, 11)
RasterGLSurface Q_DECL_ENUMERATOR_DEPRECATED_X("This capability is no longer used"),
#endif
AllGLFunctionsQueryable,
ApplicationIcon,
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
Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QPlatformSurface *surface)
{

View File

@ -37,8 +37,6 @@ public:
QSurface *surface() const;
virtual QPlatformScreen *screen() const = 0;
static bool isRasterSurface(QSurface *surface);
private:
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.
\value OpenGLSurface The surface is an OpenGL compatible surface and can be used
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
in conjunction with OpenVG contexts.
\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
surface and can be used in conjunction with the DXGI and Direct3D APIs. This
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
{
SurfaceType type = surfaceType();
if (type == RasterSurface) {
QPlatformIntegration *integ = QGuiApplicationPrivate::instance()->platformIntegration();
return integ->hasCapability(QPlatformIntegration::OpenGLOnRasterSurface);
}
return type == OpenGLSurface || type == RasterGLSurface;
return surfaceType() == OpenGLSurface;
}
/*!

View File

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

View File

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

View File

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

View File

@ -35,7 +35,7 @@ QT_BEGIN_NAMESPACE
(inherited from QOpenGLCompositorWindow).
\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().
*/

View File

@ -328,7 +328,6 @@ bool QAndroidPlatformIntegration::hasCapability(Capability cap) const
return isValidAndroidContextForRendering();
case ThreadedOpenGL:
return !needsBasicRenderloopWorkaround() && isValidAndroidContextForRendering();
case RasterGLSurface: return QtAndroidPrivate::activity().isValid();
case TopStackedNativeChildWindows: return false;
case MaximizeUsingFullscreenGeometry: return true;
// 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 MultipleWindows:
case ForeignWindows:
case RasterGLSurface:
case ApplicationState:
case ApplicationIcon:
case BackingStoreStaticContents:

View File

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

View File

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

View File

@ -99,7 +99,7 @@ static QString fboStatusString(GLenum status)
}
#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)
{

View File

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

View File

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

View File

@ -187,7 +187,6 @@ bool QWasmIntegration::hasCapability(QPlatformIntegration::Capability cap) const
case ThreadedPixmaps: return true;
case OpenGL: return true;
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 WindowManagement: return true;
case ForeignWindows: return true;

View File

@ -127,8 +127,6 @@ bool QWaylandIntegration::hasCapability(QPlatformIntegration::Capability cap) co
case MultipleWindows:
case NonFullScreenWindows:
return true;
case RasterGLSurface:
return true;
case WindowActivation:
return true;
case ScreenWindowGrabbing: // whether QScreen::grabWindow() is supported
@ -139,7 +137,7 @@ bool QWaylandIntegration::hasCapability(QPlatformIntegration::Capability cap) co
QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWindow *window) const
{
if ((window->surfaceType() == QWindow::OpenGLSurface || window->surfaceType() == QWindow::RasterGLSurface)
if (window->surfaceType() == QWindow::OpenGLSurface
&& mDisplay->clientBufferIntegration())
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)
{
Q_UNUSED(offset)
// Invoked when the window is of type RasterSurface or when the window is
// RasterGLSurface and there are no child widgets requiring OpenGL composition.
// Invoked when the window is of type RasterSurface.
// 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()) {
auto waylandWindow = static_cast<QWaylandWindow *>(window->handle());
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;
case ForeignWindows:
return true;
case RasterGLSurface:
return true;
case AllGLFunctionsQueryable:
return true;
case SwitchableWidgetComposition:

View File

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

View File

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

View File

@ -302,7 +302,7 @@ void QXcbWindow::create()
if (QPlatformWindow::parent()) {
// When using a Vulkan QWindow via QWidget::createWindowContainer() we
// 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.
// Therefore, take the parent's visual.
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, BufferQueueingOpenGL)
DUMP_CAPABILITY(str, platformIntegration, WindowMasks)
DUMP_CAPABILITY(str, platformIntegration, RasterGLSurface)
DUMP_CAPABILITY(str, platformIntegration, AllGLFunctionsQueryable)
str << '\n';

View File

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