Register QPlatformBackingStoreOpenGLSupport when needed
Static builds can not rely on a constructor function in the QtOpenGL library, as that will be linked out unless something in the application pulls it in. Instead we export a helper function that clients that depend on OpenGL support in QPlatformBackingStore can use to bring it it. Change-Id: Ic54058bf413a476287884c78df5624b862f97695 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
parent
d14cf6d3d9
commit
3d03f4e989
@ -450,18 +450,15 @@ GLuint QPlatformBackingStoreOpenGLSupport::toTexture(const QRegion &dirtyRegion,
|
||||
return textureId;
|
||||
}
|
||||
|
||||
static QPlatformBackingStoreOpenGLSupportBase *createOpenGLSupport()
|
||||
void qt_registerDefaultPlatformBackingStoreOpenGLSupport()
|
||||
{
|
||||
return new QPlatformBackingStoreOpenGLSupport;
|
||||
if (!QPlatformBackingStoreOpenGLSupportBase::factoryFunction()) {
|
||||
QPlatformBackingStoreOpenGLSupportBase::setFactoryFunction([]() -> QPlatformBackingStoreOpenGLSupportBase* {
|
||||
return new QPlatformBackingStoreOpenGLSupport;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
static void setDefaultOpenGLSupportFactoryFunction()
|
||||
{
|
||||
if (!QPlatformBackingStoreOpenGLSupportBase::factoryFunction())
|
||||
QPlatformBackingStoreOpenGLSupportBase::setFactoryFunction(createOpenGLSupport);
|
||||
}
|
||||
Q_CONSTRUCTOR_FUNCTION(setDefaultOpenGLSupportFactoryFunction);
|
||||
|
||||
#endif // QT_NO_OPENGL
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -78,6 +78,8 @@ private:
|
||||
QOpenGLTextureBlitter *blitter = nullptr;
|
||||
};
|
||||
|
||||
Q_OPENGL_EXPORT void qt_registerDefaultPlatformBackingStoreOpenGLSupport();
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_OPENGL
|
||||
|
@ -55,6 +55,7 @@
|
||||
#include <QtGui/private/qopenglcontext_p.h>
|
||||
#include <QtOpenGL/private/qopenglframebufferobject_p.h>
|
||||
#include <QtOpenGL/private/qopenglpaintdevice_p.h>
|
||||
#include <QtOpenGL/qpa/qplatformbackingstoreopenglsupport.h>
|
||||
|
||||
#include <QtWidgets/private/qwidget_p.h>
|
||||
|
||||
@ -1411,6 +1412,8 @@ bool QOpenGLWidget::event(QEvent *e)
|
||||
return QWidget::event(e);
|
||||
}
|
||||
|
||||
Q_CONSTRUCTOR_FUNCTION(qt_registerDefaultPlatformBackingStoreOpenGLSupport);
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include "moc_qopenglwidget.cpp"
|
||||
|
@ -43,6 +43,8 @@
|
||||
#include <QtGui/QOpenGLContext>
|
||||
#include <QtGui/private/qwindow_p.h>
|
||||
|
||||
#include <QtOpenGL/qpa/qplatformbackingstoreopenglsupport.h>
|
||||
|
||||
#include <QtDebug>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -88,4 +90,6 @@ void QIOSBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoin
|
||||
composeAndFlush(window, region, offset, &emptyTextureList, false);
|
||||
}
|
||||
|
||||
Q_CONSTRUCTOR_FUNCTION(qt_registerDefaultPlatformBackingStoreOpenGLSupport);
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -66,10 +66,6 @@
|
||||
|
||||
#import <AudioToolbox/AudioServices.h>
|
||||
|
||||
#if QT_CONFIG(opengl)
|
||||
#include <QtOpenGL/qpa/qplatformbackingstoreopenglsupport.h>
|
||||
#endif
|
||||
|
||||
#include <QtDebug>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
Loading…
Reference in New Issue
Block a user