Remove QOpenGLTextureHelper dependency from QOpenGLContext
It's now just a pointer to a forward declared class Task-number: QTBUG-74409 Change-Id: I34df385154dcff2bbba2f6318825ab5258fa6695 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
parent
35a461d026
commit
06bb315beb
@ -56,8 +56,6 @@
|
||||
#include <private/qopenglextensions_p.h>
|
||||
#include <private/qopenglversionfunctionsfactory_p.h>
|
||||
|
||||
#include <private/qopengltexturehelper_p.h>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#ifndef QT_OPENGL_ES_2
|
||||
@ -664,7 +662,10 @@ void QOpenGLContext::destroy()
|
||||
qDeleteAll(d->versionFunctions);
|
||||
d->versionFunctions.clear();
|
||||
|
||||
delete d->textureFunctions;
|
||||
if (d->textureFunctionsDestroyCallback) {
|
||||
d->textureFunctionsDestroyCallback();
|
||||
d->textureFunctionsDestroyCallback = nullptr;
|
||||
}
|
||||
d->textureFunctions = nullptr;
|
||||
|
||||
d->nativeHandle = QVariant();
|
||||
@ -1388,10 +1389,11 @@ QOpenGLTextureHelper* QOpenGLContext::textureFunctions() const
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
void QOpenGLContext::setTextureFunctions(QOpenGLTextureHelper* textureFuncs)
|
||||
void QOpenGLContext::setTextureFunctions(QOpenGLTextureHelper* textureFuncs, std::function<void()> destroyCallback)
|
||||
{
|
||||
Q_D(QOpenGLContext);
|
||||
d->textureFunctions = textureFuncs;
|
||||
d->textureFunctionsDestroyCallback = destroyCallback;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -243,7 +243,7 @@ private:
|
||||
void removeExternalFunctions(QAbstractOpenGLFunctions *f);
|
||||
|
||||
QOpenGLTextureHelper* textureFunctions() const;
|
||||
void setTextureFunctions(QOpenGLTextureHelper* textureFuncs);
|
||||
void setTextureFunctions(QOpenGLTextureHelper* textureFuncs, std::function<void()> destroyCallback);
|
||||
|
||||
void destroy();
|
||||
|
||||
|
@ -240,6 +240,7 @@ public:
|
||||
QOpenGLFunctions *functions;
|
||||
mutable QSet<QByteArray> extensionNames;
|
||||
QOpenGLTextureHelper* textureFunctions;
|
||||
std::function<void()> textureFunctionsDestroyCallback;
|
||||
|
||||
GLint max_texture_size;
|
||||
|
||||
|
@ -151,7 +151,8 @@ void QOpenGLTexturePrivate::initializeOpenGLFunctions()
|
||||
texFuncs = context->textureFunctions();
|
||||
if (!texFuncs) {
|
||||
texFuncs = new QOpenGLTextureHelper(context);
|
||||
context->setTextureFunctions(texFuncs);
|
||||
auto *funcs = texFuncs; // lets us capture by pointer value below
|
||||
context->setTextureFunctions(funcs, [funcs] { delete funcs; });
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user