QOpenGLContext: de-inline virtual dtors of private classes

... pinning the vtables to a single TU instead of duplicating them for
every user.

Pick-to: 6.4
Task-number: QTBUG-45582
Change-Id: I728a5c47edaafe7ef4fdca1db8d0247ed4be9713
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Marc Mutz 2022-07-12 19:43:47 +02:00
parent b36d7076e4
commit 12f8b583cf
2 changed files with 22 additions and 8 deletions

View File

@ -360,6 +360,14 @@ bool QOpenGLContext::create()
return isValid(); return isValid();
} }
QOpenGLContextPrivate::~QOpenGLContextPrivate()
{
//do not delete the QOpenGLContext handle here as it is deleted in
//QWidgetPrivate::deleteTLSysExtra()
delete versionFunctions;
}
void QOpenGLContextPrivate::adopt(QPlatformOpenGLContext *context) void QOpenGLContextPrivate::adopt(QPlatformOpenGLContext *context)
{ {
Q_Q(QOpenGLContext); Q_Q(QOpenGLContext);
@ -995,6 +1003,9 @@ QOpenGLContextGroup *QOpenGLContextGroup::currentContextGroup()
return current ? current->shareGroup() : nullptr; return current ? current->shareGroup() : nullptr;
} }
QOpenGLContextGroupPrivate::~QOpenGLContextGroupPrivate()
= default;
void QOpenGLContextGroupPrivate::addContext(QOpenGLContext *ctx) void QOpenGLContextGroupPrivate::addContext(QOpenGLContext *ctx)
{ {
const auto locker = qt_scoped_lock(m_mutex); const auto locker = qt_scoped_lock(m_mutex);
@ -1136,6 +1147,10 @@ void QOpenGLSharedResource::free()
\inmodule QtGui \inmodule QtGui
*/ */
QOpenGLSharedResourceGuard::~QOpenGLSharedResourceGuard()
= default;
void QOpenGLSharedResourceGuard::freeResource(QOpenGLContext *context) void QOpenGLSharedResourceGuard::freeResource(QOpenGLContext *context)
{ {
if (m_id) { if (m_id) {
@ -1235,6 +1250,9 @@ void QOpenGLMultiGroupSharedResource::cleanup(QOpenGLContextGroup *group, QOpenG
m_groups.removeOne(group); m_groups.removeOne(group);
} }
QOpenGLContextVersionFunctionHelper::~QOpenGLContextVersionFunctionHelper()
= default;
#ifndef QT_NO_DEBUG_STREAM #ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug debug, const QOpenGLContext *ctx) QDebug operator<<(QDebug debug, const QOpenGLContext *ctx)
{ {

View File

@ -74,6 +74,7 @@ public:
, m_func(func) , m_func(func)
{ {
} }
~QOpenGLSharedResourceGuard() override;
GLuint id() const { return m_id; } GLuint id() const { return m_id; }
@ -99,6 +100,7 @@ public:
, m_refs(0) , m_refs(0)
{ {
} }
~QOpenGLContextGroupPrivate() override;
void addContext(QOpenGLContext *ctx); void addContext(QOpenGLContext *ctx);
void removeContext(QOpenGLContext *ctx); void removeContext(QOpenGLContext *ctx);
@ -160,7 +162,7 @@ class QOpenGLVertexArrayObjectHelper;
class Q_GUI_EXPORT QOpenGLContextVersionFunctionHelper class Q_GUI_EXPORT QOpenGLContextVersionFunctionHelper
{ {
public: public:
virtual ~QOpenGLContextVersionFunctionHelper() {} virtual ~QOpenGLContextVersionFunctionHelper();
}; };
class Q_GUI_EXPORT QOpenGLContextPrivate : public QObjectPrivate class Q_GUI_EXPORT QOpenGLContextPrivate : public QObjectPrivate
@ -190,13 +192,7 @@ public:
requestedFormat = QSurfaceFormat::defaultFormat(); requestedFormat = QSurfaceFormat::defaultFormat();
} }
~QOpenGLContextPrivate() ~QOpenGLContextPrivate() override;
{
//do not delete the QOpenGLContext handle here as it is deleted in
//QWidgetPrivate::deleteTLSysExtra()
delete versionFunctions;
}
void adopt(QPlatformOpenGLContext *); void adopt(QPlatformOpenGLContext *);