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/qopenglextensions_p.h>
|
||||||
#include <private/qopenglversionfunctionsfactory_p.h>
|
#include <private/qopenglversionfunctionsfactory_p.h>
|
||||||
|
|
||||||
#include <private/qopengltexturehelper_p.h>
|
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#ifndef QT_OPENGL_ES_2
|
#ifndef QT_OPENGL_ES_2
|
||||||
@ -664,7 +662,10 @@ void QOpenGLContext::destroy()
|
|||||||
qDeleteAll(d->versionFunctions);
|
qDeleteAll(d->versionFunctions);
|
||||||
d->versionFunctions.clear();
|
d->versionFunctions.clear();
|
||||||
|
|
||||||
delete d->textureFunctions;
|
if (d->textureFunctionsDestroyCallback) {
|
||||||
|
d->textureFunctionsDestroyCallback();
|
||||||
|
d->textureFunctionsDestroyCallback = nullptr;
|
||||||
|
}
|
||||||
d->textureFunctions = nullptr;
|
d->textureFunctions = nullptr;
|
||||||
|
|
||||||
d->nativeHandle = QVariant();
|
d->nativeHandle = QVariant();
|
||||||
@ -1388,10 +1389,11 @@ QOpenGLTextureHelper* QOpenGLContext::textureFunctions() const
|
|||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
*/
|
*/
|
||||||
void QOpenGLContext::setTextureFunctions(QOpenGLTextureHelper* textureFuncs)
|
void QOpenGLContext::setTextureFunctions(QOpenGLTextureHelper* textureFuncs, std::function<void()> destroyCallback)
|
||||||
{
|
{
|
||||||
Q_D(QOpenGLContext);
|
Q_D(QOpenGLContext);
|
||||||
d->textureFunctions = textureFuncs;
|
d->textureFunctions = textureFuncs;
|
||||||
|
d->textureFunctionsDestroyCallback = destroyCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -243,7 +243,7 @@ private:
|
|||||||
void removeExternalFunctions(QAbstractOpenGLFunctions *f);
|
void removeExternalFunctions(QAbstractOpenGLFunctions *f);
|
||||||
|
|
||||||
QOpenGLTextureHelper* textureFunctions() const;
|
QOpenGLTextureHelper* textureFunctions() const;
|
||||||
void setTextureFunctions(QOpenGLTextureHelper* textureFuncs);
|
void setTextureFunctions(QOpenGLTextureHelper* textureFuncs, std::function<void()> destroyCallback);
|
||||||
|
|
||||||
void destroy();
|
void destroy();
|
||||||
|
|
||||||
|
@ -240,6 +240,7 @@ public:
|
|||||||
QOpenGLFunctions *functions;
|
QOpenGLFunctions *functions;
|
||||||
mutable QSet<QByteArray> extensionNames;
|
mutable QSet<QByteArray> extensionNames;
|
||||||
QOpenGLTextureHelper* textureFunctions;
|
QOpenGLTextureHelper* textureFunctions;
|
||||||
|
std::function<void()> textureFunctionsDestroyCallback;
|
||||||
|
|
||||||
GLint max_texture_size;
|
GLint max_texture_size;
|
||||||
|
|
||||||
|
@ -151,7 +151,8 @@ void QOpenGLTexturePrivate::initializeOpenGLFunctions()
|
|||||||
texFuncs = context->textureFunctions();
|
texFuncs = context->textureFunctions();
|
||||||
if (!texFuncs) {
|
if (!texFuncs) {
|
||||||
texFuncs = new QOpenGLTextureHelper(context);
|
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