summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2016-02-03 12:42:52 +0100
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2016-03-02 12:16:05 +0000
commit6b0a577bf85845780e9a7b101260cdf72fa1d33c (patch)
tree2ce5d8b2166c50024e648c3ef61ebcee7674bfa7 /src/gui
parent8f1fcb0142b26f8e12c51b6c646eca1242b35102 (diff)
Refactor initialization/caching code for versioned opengl functions
Saves around 80k in Qt Gui. Change-Id: I3f7068ae699136d0edf46a49694ade7e1df3c91d Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qopenglcontext.cpp24
-rw-r--r--src/gui/kernel/qopenglcontext.h4
-rw-r--r--src/gui/kernel/qopenglcontext_p.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_1_0.cpp22
-rw-r--r--src/gui/opengl/qopenglfunctions_1_1.cpp44
-rw-r--r--src/gui/opengl/qopenglfunctions_1_2.cpp66
-rw-r--r--src/gui/opengl/qopenglfunctions_1_3.cpp88
-rw-r--r--src/gui/opengl/qopenglfunctions_1_4.cpp110
-rw-r--r--src/gui/opengl/qopenglfunctions_1_5.cpp121
-rw-r--r--src/gui/opengl/qopenglfunctions_2_0.cpp132
-rw-r--r--src/gui/opengl/qopenglfunctions_2_1.cpp143
-rw-r--r--src/gui/opengl/qopenglfunctions_3_0.cpp154
-rw-r--r--src/gui/opengl/qopenglfunctions_3_1.cpp110
-rw-r--r--src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp176
-rw-r--r--src/gui/opengl/qopenglfunctions_3_2_core.cpp121
-rw-r--r--src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp198
-rw-r--r--src/gui/opengl/qopenglfunctions_3_3_core.cpp132
-rw-r--r--src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp209
-rw-r--r--src/gui/opengl/qopenglfunctions_4_0_core.cpp143
-rw-r--r--src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp220
-rw-r--r--src/gui/opengl/qopenglfunctions_4_1_core.cpp154
-rw-r--r--src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp231
-rw-r--r--src/gui/opengl/qopenglfunctions_4_2_core.cpp165
-rw-r--r--src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp242
-rw-r--r--src/gui/opengl/qopenglfunctions_4_3_core.cpp176
-rw-r--r--src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp253
-rw-r--r--src/gui/opengl/qopenglfunctions_4_4_core.cpp187
-rw-r--r--src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp275
-rw-r--r--src/gui/opengl/qopenglfunctions_4_5_core.cpp198
-rw-r--r--src/gui/opengl/qopenglversionfunctions.cpp54
-rw-r--r--src/gui/opengl/qopenglversionfunctions.h93
31 files changed, 1212 insertions, 3035 deletions
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index a45217ca29..61324d73f3 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -661,8 +661,6 @@ void QOpenGLContext::destroy()
d->externalVersionFunctions.clear();
qDeleteAll(d->versionFunctions);
d->versionFunctions.clear();
- qDeleteAll(d->versionFunctionsBackend);
- d->versionFunctionsBackend.clear();
delete d->textureFunctions;
d->textureFunctions = 0;
@@ -1302,28 +1300,10 @@ QOpenGLContext *QOpenGLContext::globalShareContext()
/*!
\internal
*/
-QOpenGLVersionFunctionsBackend *QOpenGLContext::functionsBackend(const QOpenGLVersionFunctionsBackend::Version v) const
+QOpenGLVersionFunctionsStorage *QOpenGLContext::functionsBackendStorage() const
{
Q_D(const QOpenGLContext);
- return d->versionFunctionsBackend.value(v, 0);
-}
-
-/*!
- \internal
-*/
-void QOpenGLContext::insertFunctionsBackend(const QOpenGLVersionFunctionsBackend::Version v, QOpenGLVersionFunctionsBackend *backend)
-{
- Q_D(QOpenGLContext);
- d->versionFunctionsBackend.insert(v, backend);
-}
-
-/*!
- \internal
-*/
-void QOpenGLContext::removeFunctionsBackend(const QOpenGLVersionFunctionsBackend::Version v)
-{
- Q_D(QOpenGLContext);
- d->versionFunctionsBackend.remove(v);
+ return &d->versionFunctionsStorage;
}
/*!
diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h
index 9bb48ab4fc..33e3f1c3f6 100644
--- a/src/gui/kernel/qopenglcontext.h
+++ b/src/gui/kernel/qopenglcontext.h
@@ -237,9 +237,7 @@ private:
void setQGLContextHandle(void *handle,void (*qGLContextDeleteFunction)(void *));
void deleteQGLContext();
- QOpenGLVersionFunctionsBackend* functionsBackend(QOpenGLVersionFunctionsBackend::Version v) const;
- void insertFunctionsBackend(const QOpenGLVersionFunctionsBackend::Version v, QOpenGLVersionFunctionsBackend *backend);
- void removeFunctionsBackend(const QOpenGLVersionFunctionsBackend::Version v);
+ QOpenGLVersionFunctionsStorage* functionsBackendStorage() const;
void insertExternalFunctions(QAbstractOpenGLFunctions *f);
void removeExternalFunctions(QAbstractOpenGLFunctions *f);
diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h
index 57053a6d61..4a5fbab364 100644
--- a/src/gui/kernel/qopenglcontext_p.h
+++ b/src/gui/kernel/qopenglcontext_p.h
@@ -222,7 +222,7 @@ public:
}
mutable QHash<QOpenGLVersionProfile, QAbstractOpenGLFunctions *> versionFunctions;
- mutable QHash<QOpenGLVersionFunctionsBackend::Version, QOpenGLVersionFunctionsBackend *> versionFunctionsBackend;
+ mutable QOpenGLVersionFunctionsStorage versionFunctionsStorage;
mutable QSet<QAbstractOpenGLFunctions *> externalVersionFunctions;
void *qGLContextHandle;
diff --git a/src/gui/opengl/qopenglfunctions_1_0.cpp b/src/gui/opengl/qopenglfunctions_1_0.cpp
index dcaff4b300..9d5a76380a 100644
--- a/src/gui/opengl/qopenglfunctions_1_0.cpp
+++ b/src/gui/opengl/qopenglfunctions_1_0.cpp
@@ -74,14 +74,12 @@ QOpenGLFunctions_1_0::QOpenGLFunctions_1_0()
QOpenGLFunctions_1_0::~QOpenGLFunctions_1_0()
{
- if (d_1_0_Core && !d_1_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Core->context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- delete d_1_0_Core;
- }
- if (d_1_0_Deprecated && !d_1_0_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Deprecated->context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- delete d_1_0_Deprecated;
- }
+ if (d_1_0_Core)
+ d_1_0_Core->refs.deref();
+ Q_ASSERT(d_1_0_Core->refs.load());
+ if (d_1_0_Deprecated)
+ d_1_0_Deprecated->refs.deref();
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
}
bool QOpenGLFunctions_1_0::initializeOpenGLFunctions()
@@ -100,18 +98,10 @@ bool QOpenGLFunctions_1_0::initializeOpenGLFunctions()
// Function pointers in the backends are resolved at creation time
QOpenGLVersionFunctionsBackend* d = 0;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus(), d);
- }
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus(), d);
- }
d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_1_1.cpp b/src/gui/opengl/qopenglfunctions_1_1.cpp
index 08bc20b81f..57385f1927 100644
--- a/src/gui/opengl/qopenglfunctions_1_1.cpp
+++ b/src/gui/opengl/qopenglfunctions_1_1.cpp
@@ -76,22 +76,18 @@ QOpenGLFunctions_1_1::QOpenGLFunctions_1_1()
QOpenGLFunctions_1_1::~QOpenGLFunctions_1_1()
{
- if (d_1_0_Core && !d_1_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Core->context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- delete d_1_0_Core;
- }
- if (d_1_1_Core && !d_1_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Core->context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- delete d_1_1_Core;
- }
- if (d_1_0_Deprecated && !d_1_0_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Deprecated->context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- delete d_1_0_Deprecated;
- }
- if (d_1_1_Deprecated && !d_1_1_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Deprecated->context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- delete d_1_1_Deprecated;
- }
+ if (d_1_0_Core)
+ d_1_0_Core->refs.deref();
+ Q_ASSERT(d_1_0_Core->refs.load());
+ if (d_1_1_Core)
+ d_1_1_Core->refs.deref();
+ Q_ASSERT(d_1_1_Core->refs.load());
+ if (d_1_0_Deprecated)
+ d_1_0_Deprecated->refs.deref();
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ if (d_1_1_Deprecated)
+ d_1_1_Deprecated->refs.deref();
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
}
bool QOpenGLFunctions_1_1::initializeOpenGLFunctions()
@@ -110,34 +106,18 @@ bool QOpenGLFunctions_1_1::initializeOpenGLFunctions()
// Function pointers in the backends are resolved at creation time
QOpenGLVersionFunctionsBackend* d = 0;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus(), d);
- }
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus(), d);
- }
d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus(), d);
- }
d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus(), d);
- }
d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_1_2.cpp b/src/gui/opengl/qopenglfunctions_1_2.cpp
index bbc524527c..9eaa13862d 100644
--- a/src/gui/opengl/qopenglfunctions_1_2.cpp
+++ b/src/gui/opengl/qopenglfunctions_1_2.cpp
@@ -78,30 +78,24 @@ QOpenGLFunctions_1_2::QOpenGLFunctions_1_2()
QOpenGLFunctions_1_2::~QOpenGLFunctions_1_2()
{
- if (d_1_0_Core && !d_1_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Core->context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- delete d_1_0_Core;
- }
- if (d_1_1_Core && !d_1_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Core->context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- delete d_1_1_Core;
- }
- if (d_1_2_Core && !d_1_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Core->context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- delete d_1_2_Core;
- }
- if (d_1_0_Deprecated && !d_1_0_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Deprecated->context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- delete d_1_0_Deprecated;
- }
- if (d_1_1_Deprecated && !d_1_1_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Deprecated->context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- delete d_1_1_Deprecated;
- }
- if (d_1_2_Deprecated && !d_1_2_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Deprecated->context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- delete d_1_2_Deprecated;
- }
+ if (d_1_0_Core)
+ d_1_0_Core->refs.deref();
+ Q_ASSERT(d_1_0_Core->refs.load());
+ if (d_1_1_Core)
+ d_1_1_Core->refs.deref();
+ Q_ASSERT(d_1_1_Core->refs.load());
+ if (d_1_2_Core)
+ d_1_2_Core->refs.deref();
+ Q_ASSERT(d_1_2_Core->refs.load());
+ if (d_1_0_Deprecated)
+ d_1_0_Deprecated->refs.deref();
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ if (d_1_1_Deprecated)
+ d_1_1_Deprecated->refs.deref();
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ if (d_1_2_Deprecated)
+ d_1_2_Deprecated->refs.deref();
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
}
bool QOpenGLFunctions_1_2::initializeOpenGLFunctions()
@@ -120,50 +114,26 @@ bool QOpenGLFunctions_1_2::initializeOpenGLFunctions()
// Function pointers in the backends are resolved at creation time
QOpenGLVersionFunctionsBackend* d = 0;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus(), d);
- }
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus(), d);
- }
d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus(), d);
- }
d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus(), d);
- }
d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus(), d);
- }
d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus(), d);
- }
d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_1_3.cpp b/src/gui/opengl/qopenglfunctions_1_3.cpp
index c7a9f2a1f2..6211997302 100644
--- a/src/gui/opengl/qopenglfunctions_1_3.cpp
+++ b/src/gui/opengl/qopenglfunctions_1_3.cpp
@@ -80,38 +80,30 @@ QOpenGLFunctions_1_3::QOpenGLFunctions_1_3()
QOpenGLFunctions_1_3::~QOpenGLFunctions_1_3()
{
- if (d_1_0_Core && !d_1_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Core->context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- delete d_1_0_Core;
- }
- if (d_1_1_Core && !d_1_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Core->context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- delete d_1_1_Core;
- }
- if (d_1_2_Core && !d_1_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Core->context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- delete d_1_2_Core;
- }
- if (d_1_3_Core && !d_1_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Core->context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- delete d_1_3_Core;
- }
- if (d_1_0_Deprecated && !d_1_0_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Deprecated->context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- delete d_1_0_Deprecated;
- }
- if (d_1_1_Deprecated && !d_1_1_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Deprecated->context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- delete d_1_1_Deprecated;
- }
- if (d_1_2_Deprecated && !d_1_2_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Deprecated->context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- delete d_1_2_Deprecated;
- }
- if (d_1_3_Deprecated && !d_1_3_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Deprecated->context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- delete d_1_3_Deprecated;
- }
+ if (d_1_0_Core)
+ d_1_0_Core->refs.deref();
+ Q_ASSERT(d_1_0_Core->refs.load());
+ if (d_1_1_Core)
+ d_1_1_Core->refs.deref();
+ Q_ASSERT(d_1_1_Core->refs.load());
+ if (d_1_2_Core)
+ d_1_2_Core->refs.deref();
+ Q_ASSERT(d_1_2_Core->refs.load());
+ if (d_1_3_Core)
+ d_1_3_Core->refs.deref();
+ Q_ASSERT(d_1_3_Core->refs.load());
+ if (d_1_0_Deprecated)
+ d_1_0_Deprecated->refs.deref();
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ if (d_1_1_Deprecated)
+ d_1_1_Deprecated->refs.deref();
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ if (d_1_2_Deprecated)
+ d_1_2_Deprecated->refs.deref();
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ if (d_1_3_Deprecated)
+ d_1_3_Deprecated->refs.deref();
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
}
bool QOpenGLFunctions_1_3::initializeOpenGLFunctions()
@@ -130,66 +122,34 @@ bool QOpenGLFunctions_1_3::initializeOpenGLFunctions()
// Function pointers in the backends are resolved at creation time
QOpenGLVersionFunctionsBackend* d = 0;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus(), d);
- }
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus(), d);
- }
d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus(), d);
- }
d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus(), d);
- }
d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus(), d);
- }
d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus(), d);
- }
d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus(), d);
- }
d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus(), d);
- }
d_1_3_Deprecated = static_cast<QOpenGLFunctions_1_3_DeprecatedBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_1_4.cpp b/src/gui/opengl/qopenglfunctions_1_4.cpp
index fc712a8cf1..5ff2c24014 100644
--- a/src/gui/opengl/qopenglfunctions_1_4.cpp
+++ b/src/gui/opengl/qopenglfunctions_1_4.cpp
@@ -82,46 +82,36 @@ QOpenGLFunctions_1_4::QOpenGLFunctions_1_4()
QOpenGLFunctions_1_4::~QOpenGLFunctions_1_4()
{
- if (d_1_0_Core && !d_1_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Core->context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- delete d_1_0_Core;
- }
- if (d_1_1_Core && !d_1_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Core->context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- delete d_1_1_Core;
- }
- if (d_1_2_Core && !d_1_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Core->context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- delete d_1_2_Core;
- }
- if (d_1_3_Core && !d_1_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Core->context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- delete d_1_3_Core;
- }
- if (d_1_4_Core && !d_1_4_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Core->context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- delete d_1_4_Core;
- }
- if (d_1_0_Deprecated && !d_1_0_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Deprecated->context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- delete d_1_0_Deprecated;
- }
- if (d_1_1_Deprecated && !d_1_1_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Deprecated->context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- delete d_1_1_Deprecated;
- }
- if (d_1_2_Deprecated && !d_1_2_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Deprecated->context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- delete d_1_2_Deprecated;
- }
- if (d_1_3_Deprecated && !d_1_3_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Deprecated->context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- delete d_1_3_Deprecated;
- }
- if (d_1_4_Deprecated && !d_1_4_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Deprecated->context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- delete d_1_4_Deprecated;
- }
+ if (d_1_0_Core)
+ d_1_0_Core->refs.deref();
+ Q_ASSERT(d_1_0_Core->refs.load());
+ if (d_1_1_Core)
+ d_1_1_Core->refs.deref();
+ Q_ASSERT(d_1_1_Core->refs.load());
+ if (d_1_2_Core)
+ d_1_2_Core->refs.deref();
+ Q_ASSERT(d_1_2_Core->refs.load());
+ if (d_1_3_Core)
+ d_1_3_Core->refs.deref();
+ Q_ASSERT(d_1_3_Core->refs.load());
+ if (d_1_4_Core)
+ d_1_4_Core->refs.deref();
+ Q_ASSERT(d_1_4_Core->refs.load());
+ if (d_1_0_Deprecated)
+ d_1_0_Deprecated->refs.deref();
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ if (d_1_1_Deprecated)
+ d_1_1_Deprecated->refs.deref();
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ if (d_1_2_Deprecated)
+ d_1_2_Deprecated->refs.deref();
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ if (d_1_3_Deprecated)
+ d_1_3_Deprecated->refs.deref();
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ if (d_1_4_Deprecated)
+ d_1_4_Deprecated->refs.deref();
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
}
bool QOpenGLFunctions_1_4::initializeOpenGLFunctions()
@@ -140,82 +130,42 @@ bool QOpenGLFunctions_1_4::initializeOpenGLFunctions()
// Function pointers in the backends are resolved at creation time
QOpenGLVersionFunctionsBackend* d = 0;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus(), d);
- }
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus(), d);
- }
d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus(), d);
- }
d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus(), d);
- }
d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus(), d);
- }
d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus(), d);
- }
d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus(), d);
- }
d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus(), d);
- }
d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus(), d);
- }
d_1_3_Deprecated = static_cast<QOpenGLFunctions_1_3_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus(), d);
- }
d_1_4_Deprecated = static_cast<QOpenGLFunctions_1_4_DeprecatedBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_1_5.cpp b/src/gui/opengl/qopenglfunctions_1_5.cpp
index b0cf705dc4..d07f1decec 100644
--- a/src/gui/opengl/qopenglfunctions_1_5.cpp
+++ b/src/gui/opengl/qopenglfunctions_1_5.cpp
@@ -83,50 +83,39 @@ QOpenGLFunctions_1_5::QOpenGLFunctions_1_5()
QOpenGLFunctions_1_5::~QOpenGLFunctions_1_5()
{
- if (d_1_0_Core && !d_1_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Core->context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- delete d_1_0_Core;
- }
- if (d_1_1_Core && !d_1_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Core->context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- delete d_1_1_Core;
- }
- if (d_1_2_Core && !d_1_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Core->context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- delete d_1_2_Core;
- }
- if (d_1_3_Core && !d_1_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Core->context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- delete d_1_3_Core;
- }
- if (d_1_4_Core && !d_1_4_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Core->context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- delete d_1_4_Core;
- }
- if (d_1_5_Core && !d_1_5_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_5_Core->context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- delete d_1_5_Core;
- }
- if (d_1_0_Deprecated && !d_1_0_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Deprecated->context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- delete d_1_0_Deprecated;
- }
- if (d_1_1_Deprecated && !d_1_1_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Deprecated->context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- delete d_1_1_Deprecated;
- }
- if (d_1_2_Deprecated && !d_1_2_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Deprecated->context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- delete d_1_2_Deprecated;
- }
- if (d_1_3_Deprecated && !d_1_3_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Deprecated->context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- delete d_1_3_Deprecated;
- }
- if (d_1_4_Deprecated && !d_1_4_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Deprecated->context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- delete d_1_4_Deprecated;
- }
+ if (d_1_0_Core)
+ d_1_0_Core->refs.deref();
+ Q_ASSERT(d_1_0_Core->refs.load());
+ if (d_1_1_Core)
+ d_1_1_Core->refs.deref();
+ Q_ASSERT(d_1_1_Core->refs.load());
+ if (d_1_2_Core)
+ d_1_2_Core->refs.deref();
+ Q_ASSERT(d_1_2_Core->refs.load());
+ if (d_1_3_Core)
+ d_1_3_Core->refs.deref();
+ Q_ASSERT(d_1_3_Core->refs.load());
+ if (d_1_4_Core)
+ d_1_4_Core->refs.deref();
+ Q_ASSERT(d_1_4_Core->refs.load());
+ if (d_1_5_Core)
+ d_1_5_Core->refs.deref();
+ Q_ASSERT(d_1_5_Core->refs.load());
+ if (d_1_0_Deprecated)
+ d_1_0_Deprecated->refs.deref();
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ if (d_1_1_Deprecated)
+ d_1_1_Deprecated->refs.deref();
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ if (d_1_2_Deprecated)
+ d_1_2_Deprecated->refs.deref();
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ if (d_1_3_Deprecated)
+ d_1_3_Deprecated->refs.deref();
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ if (d_1_4_Deprecated)
+ d_1_4_Deprecated->refs.deref();
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
}
bool QOpenGLFunctions_1_5::initializeOpenGLFunctions()
@@ -145,90 +134,46 @@ bool QOpenGLFunctions_1_5::initializeOpenGLFunctions()
// Function pointers in the backends are resolved at creation time
QOpenGLVersionFunctionsBackend* d = 0;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus(), d);
- }
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus(), d);
- }
d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus(), d);
- }
d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus(), d);
- }
d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus(), d);
- }
d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_5_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus(), d);
- }
d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus(), d);
- }
d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus(), d);
- }
d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus(), d);
- }
d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus(), d);
- }
d_1_3_Deprecated = static_cast<QOpenGLFunctions_1_3_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus(), d);
- }
d_1_4_Deprecated = static_cast<QOpenGLFunctions_1_4_DeprecatedBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_2_0.cpp b/src/gui/opengl/qopenglfunctions_2_0.cpp
index 645134a588..b7dc8ef458 100644
--- a/src/gui/opengl/qopenglfunctions_2_0.cpp
+++ b/src/gui/opengl/qopenglfunctions_2_0.cpp
@@ -85,54 +85,42 @@ QOpenGLFunctions_2_0::QOpenGLFunctions_2_0()
QOpenGLFunctions_2_0::~QOpenGLFunctions_2_0()
{
- if (d_1_0_Core && !d_1_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Core->context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- delete d_1_0_Core;
- }
- if (d_1_1_Core && !d_1_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Core->context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- delete d_1_1_Core;
- }
- if (d_1_2_Core && !d_1_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Core->context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- delete d_1_2_Core;
- }
- if (d_1_3_Core && !d_1_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Core->context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- delete d_1_3_Core;
- }
- if (d_1_4_Core && !d_1_4_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Core->context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- delete d_1_4_Core;
- }
- if (d_1_5_Core && !d_1_5_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_5_Core->context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- delete d_1_5_Core;
- }
- if (d_2_0_Core && !d_2_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_0_Core->context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- delete d_2_0_Core;
- }
- if (d_1_0_Deprecated && !d_1_0_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Deprecated->context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- delete d_1_0_Deprecated;
- }
- if (d_1_1_Deprecated && !d_1_1_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Deprecated->context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- delete d_1_1_Deprecated;
- }
- if (d_1_2_Deprecated && !d_1_2_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Deprecated->context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- delete d_1_2_Deprecated;
- }
- if (d_1_3_Deprecated && !d_1_3_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Deprecated->context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- delete d_1_3_Deprecated;
- }
- if (d_1_4_Deprecated && !d_1_4_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Deprecated->context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- delete d_1_4_Deprecated;
- }
+ if (d_1_0_Core)
+ d_1_0_Core->refs.deref();
+ Q_ASSERT(d_1_0_Core->refs.load());
+ if (d_1_1_Core)
+ d_1_1_Core->refs.deref();
+ Q_ASSERT(d_1_1_Core->refs.load());
+ if (d_1_2_Core)
+ d_1_2_Core->refs.deref();
+ Q_ASSERT(d_1_2_Core->refs.load());
+ if (d_1_3_Core)
+ d_1_3_Core->refs.deref();
+ Q_ASSERT(d_1_3_Core->refs.load());
+ if (d_1_4_Core)
+ d_1_4_Core->refs.deref();
+ Q_ASSERT(d_1_4_Core->refs.load());
+ if (d_1_5_Core)
+ d_1_5_Core->refs.deref();
+ Q_ASSERT(d_1_5_Core->refs.load());
+ if (d_2_0_Core)
+ d_2_0_Core->refs.deref();
+ Q_ASSERT(d_2_0_Core->refs.load());
+ if (d_1_0_Deprecated)
+ d_1_0_Deprecated->refs.deref();
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ if (d_1_1_Deprecated)
+ d_1_1_Deprecated->refs.deref();
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ if (d_1_2_Deprecated)
+ d_1_2_Deprecated->refs.deref();
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ if (d_1_3_Deprecated)
+ d_1_3_Deprecated->refs.deref();
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ if (d_1_4_Deprecated)
+ d_1_4_Deprecated->refs.deref();
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
}
bool QOpenGLFunctions_2_0::initializeOpenGLFunctions()
@@ -151,98 +139,50 @@ bool QOpenGLFunctions_2_0::initializeOpenGLFunctions()
// Function pointers in the backends are resolved at creation time
QOpenGLVersionFunctionsBackend* d = 0;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus(), d);
- }
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus(), d);
- }
d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus(), d);
- }
d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus(), d);
- }
d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus(), d);
- }
d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_5_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus(), d);
- }
d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus(), d);
- }
d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus(), d);
- }
d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus(), d);
- }
d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus(), d);
- }
d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus(), d);
- }
d_1_3_Deprecated = static_cast<QOpenGLFunctions_1_3_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus(), d);
- }
d_1_4_Deprecated = static_cast<QOpenGLFunctions_1_4_DeprecatedBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_2_1.cpp b/src/gui/opengl/qopenglfunctions_2_1.cpp
index 37574c7f44..e756685d10 100644
--- a/src/gui/opengl/qopenglfunctions_2_1.cpp
+++ b/src/gui/opengl/qopenglfunctions_2_1.cpp
@@ -86,58 +86,45 @@ QOpenGLFunctions_2_1::QOpenGLFunctions_2_1()
QOpenGLFunctions_2_1::~QOpenGLFunctions_2_1()
{
- if (d_1_0_Core && !d_1_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Core->context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- delete d_1_0_Core;
- }
- if (d_1_1_Core && !d_1_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Core->context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- delete d_1_1_Core;
- }
- if (d_1_2_Core && !d_1_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Core->context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- delete d_1_2_Core;
- }
- if (d_1_3_Core && !d_1_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Core->context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- delete d_1_3_Core;
- }
- if (d_1_4_Core && !d_1_4_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Core->context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- delete d_1_4_Core;
- }
- if (d_1_5_Core && !d_1_5_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_5_Core->context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- delete d_1_5_Core;
- }
- if (d_2_0_Core && !d_2_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_0_Core->context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- delete d_2_0_Core;
- }
- if (d_2_1_Core && !d_2_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_1_Core->context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- delete d_2_1_Core;
- }
- if (d_1_0_Deprecated && !d_1_0_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Deprecated->context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- delete d_1_0_Deprecated;
- }
- if (d_1_1_Deprecated && !d_1_1_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Deprecated->context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- delete d_1_1_Deprecated;
- }
- if (d_1_2_Deprecated && !d_1_2_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Deprecated->context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- delete d_1_2_Deprecated;
- }
- if (d_1_3_Deprecated && !d_1_3_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Deprecated->context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- delete d_1_3_Deprecated;
- }
- if (d_1_4_Deprecated && !d_1_4_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Deprecated->context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- delete d_1_4_Deprecated;
- }
+ if (d_1_0_Core)
+ d_1_0_Core->refs.deref();
+ Q_ASSERT(d_1_0_Core->refs.load());
+ if (d_1_1_Core)
+ d_1_1_Core->refs.deref();
+ Q_ASSERT(d_1_1_Core->refs.load());
+ if (d_1_2_Core)
+ d_1_2_Core->refs.deref();
+ Q_ASSERT(d_1_2_Core->refs.load());
+ if (d_1_3_Core)
+ d_1_3_Core->refs.deref();
+ Q_ASSERT(d_1_3_Core->refs.load());
+ if (d_1_4_Core)
+ d_1_4_Core->refs.deref();
+ Q_ASSERT(d_1_4_Core->refs.load());
+ if (d_1_5_Core)
+ d_1_5_Core->refs.deref();
+ Q_ASSERT(d_1_5_Core->refs.load());
+ if (d_2_0_Core)
+ d_2_0_Core->refs.deref();
+ Q_ASSERT(d_2_0_Core->refs.load());
+ if (d_2_1_Core)
+ d_2_1_Core->refs.deref();
+ Q_ASSERT(d_2_1_Core->refs.load());
+ if (d_1_0_Deprecated)
+ d_1_0_Deprecated->refs.deref();
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ if (d_1_1_Deprecated)
+ d_1_1_Deprecated->refs.deref();
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ if (d_1_2_Deprecated)
+ d_1_2_Deprecated->refs.deref();
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ if (d_1_3_Deprecated)
+ d_1_3_Deprecated->refs.deref();
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ if (d_1_4_Deprecated)
+ d_1_4_Deprecated->refs.deref();
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
}
bool QOpenGLFunctions_2_1::initializeOpenGLFunctions()
@@ -156,106 +143,54 @@ bool QOpenGLFunctions_2_1::initializeOpenGLFunctions()
// Function pointers in the backends are resolved at creation time
QOpenGLVersionFunctionsBackend* d = 0;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus(), d);
- }
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus(), d);
- }
d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus(), d);
- }
d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus(), d);
- }
d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus(), d);
- }
d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_5_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus(), d);
- }
d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus(), d);
- }
d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus(), d);
- }
d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus(), d);
- }
d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus(), d);
- }
d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus(), d);
- }
d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus(), d);
- }
d_1_3_Deprecated = static_cast<QOpenGLFunctions_1_3_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus(), d);
- }
d_1_4_Deprecated = static_cast<QOpenGLFunctions_1_4_DeprecatedBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_3_0.cpp b/src/gui/opengl/qopenglfunctions_3_0.cpp
index 7b7a0f1011..ee7f92855d 100644
--- a/src/gui/opengl/qopenglfunctions_3_0.cpp
+++ b/src/gui/opengl/qopenglfunctions_3_0.cpp
@@ -88,62 +88,48 @@ QOpenGLFunctions_3_0::QOpenGLFunctions_3_0()
QOpenGLFunctions_3_0::~QOpenGLFunctions_3_0()
{
- if (d_1_0_Core && !d_1_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Core->context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- delete d_1_0_Core;
- }
- if (d_1_1_Core && !d_1_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Core->context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- delete d_1_1_Core;
- }
- if (d_1_2_Core && !d_1_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Core->context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- delete d_1_2_Core;
- }
- if (d_1_3_Core && !d_1_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Core->context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- delete d_1_3_Core;
- }
- if (d_1_4_Core && !d_1_4_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Core->context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- delete d_1_4_Core;
- }
- if (d_1_5_Core && !d_1_5_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_5_Core->context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- delete d_1_5_Core;
- }
- if (d_2_0_Core && !d_2_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_0_Core->context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- delete d_2_0_Core;
- }
- if (d_2_1_Core && !d_2_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_1_Core->context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- delete d_2_1_Core;
- }
- if (d_3_0_Core && !d_3_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_0_Core->context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- delete d_3_0_Core;
- }
- if (d_1_0_Deprecated && !d_1_0_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Deprecated->context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- delete d_1_0_Deprecated;
- }
- if (d_1_1_Deprecated && !d_1_1_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Deprecated->context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- delete d_1_1_Deprecated;
- }
- if (d_1_2_Deprecated && !d_1_2_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Deprecated->context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- delete d_1_2_Deprecated;
- }
- if (d_1_3_Deprecated && !d_1_3_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Deprecated->context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- delete d_1_3_Deprecated;
- }
- if (d_1_4_Deprecated && !d_1_4_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Deprecated->context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- delete d_1_4_Deprecated;
- }
+ if (d_1_0_Core)
+ d_1_0_Core->refs.deref();
+ Q_ASSERT(d_1_0_Core->refs.load());
+ if (d_1_1_Core)
+ d_1_1_Core->refs.deref();
+ Q_ASSERT(d_1_1_Core->refs.load());
+ if (d_1_2_Core)
+ d_1_2_Core->refs.deref();
+ Q_ASSERT(d_1_2_Core->refs.load());
+ if (d_1_3_Core)
+ d_1_3_Core->refs.deref();
+ Q_ASSERT(d_1_3_Core->refs.load());
+ if (d_1_4_Core)
+ d_1_4_Core->refs.deref();
+ Q_ASSERT(d_1_4_Core->refs.load());
+ if (d_1_5_Core)
+ d_1_5_Core->refs.deref();
+ Q_ASSERT(d_1_5_Core->refs.load());
+ if (d_2_0_Core)
+ d_2_0_Core->refs.deref();
+ Q_ASSERT(d_2_0_Core->refs.load());
+ if (d_2_1_Core)
+ d_2_1_Core->refs.deref();
+ Q_ASSERT(d_2_1_Core->refs.load());
+ if (d_3_0_Core)
+ d_3_0_Core->refs.deref();
+ Q_ASSERT(d_3_0_Core->refs.load());
+ if (d_1_0_Deprecated)
+ d_1_0_Deprecated->refs.deref();
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ if (d_1_1_Deprecated)
+ d_1_1_Deprecated->refs.deref();
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ if (d_1_2_Deprecated)
+ d_1_2_Deprecated->refs.deref();
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ if (d_1_3_Deprecated)
+ d_1_3_Deprecated->refs.deref();
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ if (d_1_4_Deprecated)
+ d_1_4_Deprecated->refs.deref();
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
}
bool QOpenGLFunctions_3_0::initializeOpenGLFunctions()
@@ -162,114 +148,58 @@ bool QOpenGLFunctions_3_0::initializeOpenGLFunctions()
// Function pointers in the backends are resolved at creation time
QOpenGLVersionFunctionsBackend* d = 0;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus(), d);
- }
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus(), d);
- }
d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus(), d);
- }
d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus(), d);
- }
d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus(), d);
- }
d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_5_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus(), d);
- }
d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus(), d);
- }
d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus(), d);
- }
d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus(), d);
- }
d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus(), d);
- }
d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus(), d);
- }
d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus(), d);
- }
d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus(), d);
- }
d_1_3_Deprecated = static_cast<QOpenGLFunctions_1_3_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus(), d);
- }
d_1_4_Deprecated = static_cast<QOpenGLFunctions_1_4_DeprecatedBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_3_1.cpp b/src/gui/opengl/qopenglfunctions_3_1.cpp
index b1c16a08d0..a459ddf244 100644
--- a/src/gui/opengl/qopenglfunctions_3_1.cpp
+++ b/src/gui/opengl/qopenglfunctions_3_1.cpp
@@ -82,46 +82,36 @@ QOpenGLFunctions_3_1::QOpenGLFunctions_3_1()
QOpenGLFunctions_3_1::~QOpenGLFunctions_3_1()
{
- if (d_1_0_Core && !d_1_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Core->context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- delete d_1_0_Core;
- }
- if (d_1_1_Core && !d_1_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Core->context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- delete d_1_1_Core;
- }
- if (d_1_2_Core && !d_1_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Core->context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- delete d_1_2_Core;
- }
- if (d_1_3_Core && !d_1_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Core->context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- delete d_1_3_Core;
- }
- if (d_1_4_Core && !d_1_4_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Core->context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- delete d_1_4_Core;
- }
- if (d_1_5_Core && !d_1_5_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_5_Core->context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- delete d_1_5_Core;
- }
- if (d_2_0_Core && !d_2_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_0_Core->context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- delete d_2_0_Core;
- }
- if (d_2_1_Core && !d_2_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_1_Core->context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- delete d_2_1_Core;
- }
- if (d_3_0_Core && !d_3_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_0_Core->context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- delete d_3_0_Core;
- }
- if (d_3_1_Core && !d_3_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_1_Core->context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- delete d_3_1_Core;
- }
+ if (d_1_0_Core)
+ d_1_0_Core->refs.deref();
+ Q_ASSERT(d_1_0_Core->refs.load());
+ if (d_1_1_Core)
+ d_1_1_Core->refs.deref();
+ Q_ASSERT(d_1_1_Core->refs.load());
+ if (d_1_2_Core)
+ d_1_2_Core->refs.deref();
+ Q_ASSERT(d_1_2_Core->refs.load());
+ if (d_1_3_Core)
+ d_1_3_Core->refs.deref();
+ Q_ASSERT(d_1_3_Core->refs.load());
+ if (d_1_4_Core)
+ d_1_4_Core->refs.deref();
+ Q_ASSERT(d_1_4_Core->refs.load());
+ if (d_1_5_Core)
+ d_1_5_Core->refs.deref();
+ Q_ASSERT(d_1_5_Core->refs.load());
+ if (d_2_0_Core)
+ d_2_0_Core->refs.deref();
+ Q_ASSERT(d_2_0_Core->refs.load());
+ if (d_2_1_Core)
+ d_2_1_Core->refs.deref();
+ Q_ASSERT(d_2_1_Core->refs.load());
+ if (d_3_0_Core)
+ d_3_0_Core->refs.deref();
+ Q_ASSERT(d_3_0_Core->refs.load());
+ if (d_3_1_Core)
+ d_3_1_Core->refs.deref();
+ Q_ASSERT(d_3_1_Core->refs.load());
}
bool QOpenGLFunctions_3_1::initializeOpenGLFunctions()
@@ -140,82 +130,42 @@ bool QOpenGLFunctions_3_1::initializeOpenGLFunctions()
// Function pointers in the backends are resolved at creation time
QOpenGLVersionFunctionsBackend* d = 0;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus(), d);
- }
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus(), d);
- }
d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus(), d);
- }
d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus(), d);
- }
d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus(), d);
- }
d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_5_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus(), d);
- }
d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus(), d);
- }
d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus(), d);
- }
d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus(), d);
- }
d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus(), d);
- }
d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp b/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp
index e14a01ed05..09402db09a 100644
--- a/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp
@@ -90,70 +90,54 @@ QOpenGLFunctions_3_2_Compatibility::QOpenGLFunctions_3_2_Compatibility()
QOpenGLFunctions_3_2_Compatibility::~QOpenGLFunctions_3_2_Compatibility()
{
- if (d_1_0_Core && !d_1_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Core->context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- delete d_1_0_Core;
- }
- if (d_1_1_Core && !d_1_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Core->context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- delete d_1_1_Core;
- }
- if (d_1_2_Core && !d_1_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Core->context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- delete d_1_2_Core;
- }
- if (d_1_3_Core && !d_1_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Core->context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- delete d_1_3_Core;
- }
- if (d_1_4_Core && !d_1_4_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Core->context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- delete d_1_4_Core;
- }
- if (d_1_5_Core && !d_1_5_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_5_Core->context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- delete d_1_5_Core;
- }
- if (d_2_0_Core && !d_2_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_0_Core->context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- delete d_2_0_Core;
- }
- if (d_2_1_Core && !d_2_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_1_Core->context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- delete d_2_1_Core;
- }
- if (d_3_0_Core && !d_3_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_0_Core->context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- delete d_3_0_Core;
- }
- if (d_3_1_Core && !d_3_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_1_Core->context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- delete d_3_1_Core;
- }
- if (d_3_2_Core && !d_3_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_2_Core->context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- delete d_3_2_Core;
- }
- if (d_1_0_Deprecated && !d_1_0_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Deprecated->context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- delete d_1_0_Deprecated;
- }
- if (d_1_1_Deprecated && !d_1_1_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Deprecated->context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- delete d_1_1_Deprecated;
- }
- if (d_1_2_Deprecated && !d_1_2_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Deprecated->context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- delete d_1_2_Deprecated;
- }
- if (d_1_3_Deprecated && !d_1_3_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Deprecated->context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- delete d_1_3_Deprecated;
- }
- if (d_1_4_Deprecated && !d_1_4_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Deprecated->context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- delete d_1_4_Deprecated;
- }
+ if (d_1_0_Core)
+ d_1_0_Core->refs.deref();
+ Q_ASSERT(d_1_0_Core->refs.load());
+ if (d_1_1_Core)
+ d_1_1_Core->refs.deref();
+ Q_ASSERT(d_1_1_Core->refs.load());
+ if (d_1_2_Core)
+ d_1_2_Core->refs.deref();
+ Q_ASSERT(d_1_2_Core->refs.load());
+ if (d_1_3_Core)
+ d_1_3_Core->refs.deref();
+ Q_ASSERT(d_1_3_Core->refs.load());
+ if (d_1_4_Core)
+ d_1_4_Core->refs.deref();
+ Q_ASSERT(d_1_4_Core->refs.load());
+ if (d_1_5_Core)
+ d_1_5_Core->refs.deref();
+ Q_ASSERT(d_1_5_Core->refs.load());
+ if (d_2_0_Core)
+ d_2_0_Core->refs.deref();
+ Q_ASSERT(d_2_0_Core->refs.load());
+ if (d_2_1_Core)
+ d_2_1_Core->refs.deref();
+ Q_ASSERT(d_2_1_Core->refs.load());
+ if (d_3_0_Core)
+ d_3_0_Core->refs.deref();
+ Q_ASSERT(d_3_0_Core->refs.load());
+ if (d_3_1_Core)
+ d_3_1_Core->refs.deref();
+ Q_ASSERT(d_3_1_Core->refs.load());
+ if (d_3_2_Core)
+ d_3_2_Core->refs.deref();
+ Q_ASSERT(d_3_2_Core->refs.load());
+ if (d_1_0_Deprecated)
+ d_1_0_Deprecated->refs.deref();
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ if (d_1_1_Deprecated)
+ d_1_1_Deprecated->refs.deref();
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ if (d_1_2_Deprecated)
+ d_1_2_Deprecated->refs.deref();
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ if (d_1_3_Deprecated)
+ d_1_3_Deprecated->refs.deref();
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ if (d_1_4_Deprecated)
+ d_1_4_Deprecated->refs.deref();
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
}
bool QOpenGLFunctions_3_2_Compatibility::initializeOpenGLFunctions()
@@ -172,130 +156,66 @@ bool QOpenGLFunctions_3_2_Compatibility::initializeOpenGLFunctions()
// Function pointers in the backends are resolved at creation time
QOpenGLVersionFunctionsBackend* d = 0;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus(), d);
- }
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus(), d);
- }
d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus(), d);
- }
d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus(), d);
- }
d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus(), d);
- }
d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_5_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus(), d);
- }
d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus(), d);
- }
d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus(), d);
- }
d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus(), d);
- }
d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus(), d);
- }
d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus(), d);
- }
d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus(), d);
- }
d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus(), d);
- }
d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus(), d);
- }
d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus(), d);
- }
d_1_3_Deprecated = static_cast<QOpenGLFunctions_1_3_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus(), d);
- }
d_1_4_Deprecated = static_cast<QOpenGLFunctions_1_4_DeprecatedBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_3_2_core.cpp b/src/gui/opengl/qopenglfunctions_3_2_core.cpp
index 738fd32a37..177dc9e25d 100644
--- a/src/gui/opengl/qopenglfunctions_3_2_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_3_2_core.cpp
@@ -83,50 +83,39 @@ QOpenGLFunctions_3_2_Core::QOpenGLFunctions_3_2_Core()
QOpenGLFunctions_3_2_Core::~QOpenGLFunctions_3_2_Core()
{
- if (d_1_0_Core && !d_1_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Core->context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- delete d_1_0_Core;
- }
- if (d_1_1_Core && !d_1_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Core->context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- delete d_1_1_Core;
- }
- if (d_1_2_Core && !d_1_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Core->context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- delete d_1_2_Core;
- }
- if (d_1_3_Core && !d_1_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Core->context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- delete d_1_3_Core;
- }
- if (d_1_4_Core && !d_1_4_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Core->context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- delete d_1_4_Core;
- }
- if (d_1_5_Core && !d_1_5_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_5_Core->context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- delete d_1_5_Core;
- }
- if (d_2_0_Core && !d_2_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_0_Core->context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- delete d_2_0_Core;
- }
- if (d_2_1_Core && !d_2_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_1_Core->context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- delete d_2_1_Core;
- }
- if (d_3_0_Core && !d_3_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_0_Core->context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- delete d_3_0_Core;
- }
- if (d_3_1_Core && !d_3_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_1_Core->context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- delete d_3_1_Core;
- }
- if (d_3_2_Core && !d_3_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_2_Core->context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- delete d_3_2_Core;
- }
+ if (d_1_0_Core)
+ d_1_0_Core->refs.deref();
+ Q_ASSERT(d_1_0_Core->refs.load());
+ if (d_1_1_Core)
+ d_1_1_Core->refs.deref();
+ Q_ASSERT(d_1_1_Core->refs.load());
+ if (d_1_2_Core)
+ d_1_2_Core->refs.deref();
+ Q_ASSERT(d_1_2_Core->refs.load());
+ if (d_1_3_Core)
+ d_1_3_Core->refs.deref();
+ Q_ASSERT(d_1_3_Core->refs.load());
+ if (d_1_4_Core)
+ d_1_4_Core->refs.deref();
+ Q_ASSERT(d_1_4_Core->refs.load());
+ if (d_1_5_Core)
+ d_1_5_Core->refs.deref();
+ Q_ASSERT(d_1_5_Core->refs.load());
+ if (d_2_0_Core)
+ d_2_0_Core->refs.deref();
+ Q_ASSERT(d_2_0_Core->refs.load());
+ if (d_2_1_Core)
+ d_2_1_Core->refs.deref();
+ Q_ASSERT(d_2_1_Core->refs.load());
+ if (d_3_0_Core)
+ d_3_0_Core->refs.deref();
+ Q_ASSERT(d_3_0_Core->refs.load());
+ if (d_3_1_Core)
+ d_3_1_Core->refs.deref();
+ Q_ASSERT(d_3_1_Core->refs.load());
+ if (d_3_2_Core)
+ d_3_2_Core->refs.deref();
+ Q_ASSERT(d_3_2_Core->refs.load());
}
bool QOpenGLFunctions_3_2_Core::initializeOpenGLFunctions()
@@ -145,90 +134,46 @@ bool QOpenGLFunctions_3_2_Core::initializeOpenGLFunctions()
// Function pointers in the backends are resolved at creation time
QOpenGLVersionFunctionsBackend* d = 0;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus(), d);
- }
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus(), d);
- }
d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus(), d);
- }
d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus(), d);
- }
d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus(), d);
- }
d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_5_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus(), d);
- }
d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus(), d);
- }
d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus(), d);
- }
d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus(), d);
- }
d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus(), d);
- }
d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus(), d);
- }
d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp b/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp
index 89bcf84a91..110a49ea53 100644
--- a/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp
@@ -91,78 +91,60 @@ QOpenGLFunctions_3_3_Compatibility::QOpenGLFunctions_3_3_Compatibility()
QOpenGLFunctions_3_3_Compatibility::~QOpenGLFunctions_3_3_Compatibility()
{
- if (d_1_0_Core && !d_1_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Core->context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- delete d_1_0_Core;
- }
- if (d_1_1_Core && !d_1_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Core->context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- delete d_1_1_Core;
- }
- if (d_1_2_Core && !d_1_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Core->context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- delete d_1_2_Core;
- }
- if (d_1_3_Core && !d_1_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Core->context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- delete d_1_3_Core;
- }
- if (d_1_4_Core && !d_1_4_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Core->context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- delete d_1_4_Core;
- }
- if (d_1_5_Core && !d_1_5_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_5_Core->context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- delete d_1_5_Core;
- }
- if (d_2_0_Core && !d_2_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_0_Core->context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- delete d_2_0_Core;
- }
- if (d_2_1_Core && !d_2_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_1_Core->context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- delete d_2_1_Core;
- }
- if (d_3_0_Core && !d_3_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_0_Core->context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- delete d_3_0_Core;
- }
- if (d_3_1_Core && !d_3_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_1_Core->context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- delete d_3_1_Core;
- }
- if (d_3_2_Core && !d_3_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_2_Core->context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- delete d_3_2_Core;
- }
- if (d_3_3_Core && !d_3_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_3_Core->context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- delete d_3_3_Core;
- }
- if (d_1_0_Deprecated && !d_1_0_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Deprecated->context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- delete d_1_0_Deprecated;
- }
- if (d_1_1_Deprecated && !d_1_1_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Deprecated->context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- delete d_1_1_Deprecated;
- }
- if (d_1_2_Deprecated && !d_1_2_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Deprecated->context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- delete d_1_2_Deprecated;
- }
- if (d_1_3_Deprecated && !d_1_3_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Deprecated->context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- delete d_1_3_Deprecated;
- }
- if (d_1_4_Deprecated && !d_1_4_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Deprecated->context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- delete d_1_4_Deprecated;
- }
- if (d_3_3_Deprecated && !d_3_3_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_3_Deprecated->context, QOpenGLFunctions_3_3_DeprecatedBackend::versionStatus());
- delete d_3_3_Deprecated;
- }
+ if (d_1_0_Core)
+ d_1_0_Core->refs.deref();
+ Q_ASSERT(d_1_0_Core->refs.load());
+ if (d_1_1_Core)
+ d_1_1_Core->refs.deref();
+ Q_ASSERT(d_1_1_Core->refs.load());
+ if (d_1_2_Core)
+ d_1_2_Core->refs.deref();
+ Q_ASSERT(d_1_2_Core->refs.load());
+ if (d_1_3_Core)
+ d_1_3_Core->refs.deref();
+ Q_ASSERT(d_1_3_Core->refs.load());
+ if (d_1_4_Core)
+ d_1_4_Core->refs.deref();
+ Q_ASSERT(d_1_4_Core->refs.load());
+ if (d_1_5_Core)
+ d_1_5_Core->refs.deref();
+ Q_ASSERT(d_1_5_Core->refs.load());
+ if (d_2_0_Core)
+ d_2_0_Core->refs.deref();
+ Q_ASSERT(d_2_0_Core->refs.load());
+ if (d_2_1_Core)
+ d_2_1_Core->refs.deref();
+ Q_ASSERT(d_2_1_Core->refs.load());
+ if (d_3_0_Core)
+ d_3_0_Core->refs.deref();
+ Q_ASSERT(d_3_0_Core->refs.load());
+ if (d_3_1_Core)
+ d_3_1_Core->refs.deref();
+ Q_ASSERT(d_3_1_Core->refs.load());
+ if (d_3_2_Core)
+ d_3_2_Core->refs.deref();
+ Q_ASSERT(d_3_2_Core->refs.load());
+ if (d_3_3_Core)
+ d_3_3_Core->refs.deref();
+ Q_ASSERT(d_3_3_Core->refs.load());
+ if (d_1_0_Deprecated)
+ d_1_0_Deprecated->refs.deref();
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ if (d_1_1_Deprecated)
+ d_1_1_Deprecated->refs.deref();
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ if (d_1_2_Deprecated)
+ d_1_2_Deprecated->refs.deref();
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ if (d_1_3_Deprecated)
+ d_1_3_Deprecated->refs.deref();
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ if (d_1_4_Deprecated)
+ d_1_4_Deprecated->refs.deref();
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ if (d_3_3_Deprecated)
+ d_3_3_Deprecated->refs.deref();
+ Q_ASSERT(d_3_3_Deprecated->refs.load());
}
bool QOpenGLFunctions_3_3_Compatibility::initializeOpenGLFunctions()
@@ -181,146 +163,74 @@ bool QOpenGLFunctions_3_3_Compatibility::initializeOpenGLFunctions()
// Function pointers in the backends are resolved at creation time
QOpenGLVersionFunctionsBackend* d = 0;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus(), d);
- }
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus(), d);
- }
d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus(), d);
- }
d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus(), d);
- }
d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus(), d);
- }
d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_5_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus(), d);
- }
d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus(), d);
- }
d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus(), d);
- }
d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus(), d);
- }
d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus(), d);
- }
d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus(), d);
- }
d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus(), d);
- }
d_3_3_Core = static_cast<QOpenGLFunctions_3_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus(), d);
- }
d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus(), d);
- }
d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus(), d);
- }
d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus(), d);
- }
d_1_3_Deprecated = static_cast<QOpenGLFunctions_1_3_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus(), d);
- }
d_1_4_Deprecated = static_cast<QOpenGLFunctions_1_4_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_3_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_3_DeprecatedBackend::versionStatus(), d);
- }
d_3_3_Deprecated = static_cast<QOpenGLFunctions_3_3_DeprecatedBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_3_3_core.cpp b/src/gui/opengl/qopenglfunctions_3_3_core.cpp
index fc9ad6951c..2e706724d9 100644
--- a/src/gui/opengl/qopenglfunctions_3_3_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_3_3_core.cpp
@@ -84,54 +84,42 @@ QOpenGLFunctions_3_3_Core::QOpenGLFunctions_3_3_Core()
QOpenGLFunctions_3_3_Core::~QOpenGLFunctions_3_3_Core()
{
- if (d_1_0_Core && !d_1_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Core->context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- delete d_1_0_Core;
- }
- if (d_1_1_Core && !d_1_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Core->context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- delete d_1_1_Core;
- }
- if (d_1_2_Core && !d_1_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Core->context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- delete d_1_2_Core;
- }
- if (d_1_3_Core && !d_1_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Core->context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- delete d_1_3_Core;
- }
- if (d_1_4_Core && !d_1_4_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Core->context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- delete d_1_4_Core;
- }
- if (d_1_5_Core && !d_1_5_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_5_Core->context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- delete d_1_5_Core;
- }
- if (d_2_0_Core && !d_2_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_0_Core->context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- delete d_2_0_Core;
- }
- if (d_2_1_Core && !d_2_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_1_Core->context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- delete d_2_1_Core;
- }
- if (d_3_0_Core && !d_3_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_0_Core->context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- delete d_3_0_Core;
- }
- if (d_3_1_Core && !d_3_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_1_Core->context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- delete d_3_1_Core;
- }
- if (d_3_2_Core && !d_3_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_2_Core->context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- delete d_3_2_Core;
- }
- if (d_3_3_Core && !d_3_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_3_Core->context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- delete d_3_3_Core;
- }
+ if (d_1_0_Core)
+ d_1_0_Core->refs.deref();
+ Q_ASSERT(d_1_0_Core->refs.load());
+ if (d_1_1_Core)
+ d_1_1_Core->refs.deref();
+ Q_ASSERT(d_1_1_Core->refs.load());
+ if (d_1_2_Core)
+ d_1_2_Core->refs.deref();
+ Q_ASSERT(d_1_2_Core->refs.load());
+ if (d_1_3_Core)
+ d_1_3_Core->refs.deref();
+ Q_ASSERT(d_1_3_Core->refs.load());
+ if (d_1_4_Core)
+ d_1_4_Core->refs.deref();
+ Q_ASSERT(d_1_4_Core->refs.load());
+ if (d_1_5_Core)
+ d_1_5_Core->refs.deref();
+ Q_ASSERT(d_1_5_Core->refs.load());
+ if (d_2_0_Core)
+ d_2_0_Core->refs.deref();
+ Q_ASSERT(d_2_0_Core->refs.load());
+ if (d_2_1_Core)
+ d_2_1_Core->refs.deref();
+ Q_ASSERT(d_2_1_Core->refs.load());
+ if (d_3_0_Core)
+ d_3_0_Core->refs.deref();
+ Q_ASSERT(d_3_0_Core->refs.load());
+ if (d_3_1_Core)
+ d_3_1_Core->refs.deref();
+ Q_ASSERT(d_3_1_Core->refs.load());
+ if (d_3_2_Core)
+ d_3_2_Core->refs.deref();
+ Q_ASSERT(d_3_2_Core->refs.load());
+ if (d_3_3_Core)
+ d_3_3_Core->refs.deref();
+ Q_ASSERT(d_3_3_Core->refs.load());
}
bool QOpenGLFunctions_3_3_Core::initializeOpenGLFunctions()
@@ -150,98 +138,50 @@ bool QOpenGLFunctions_3_3_Core::initializeOpenGLFunctions()
// Function pointers in the backends are resolved at creation time
QOpenGLVersionFunctionsBackend* d = 0;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus(), d);
- }
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus(), d);
- }
d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus(), d);
- }
d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus(), d);
- }
d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus(), d);
- }
d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_5_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus(), d);
- }
d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus(), d);
- }
d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus(), d);
- }
d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus(), d);
- }
d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus(), d);
- }
d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus(), d);
- }
d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus(), d);
- }
d_3_3_Core = static_cast<QOpenGLFunctions_3_3_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp
index cc2b145ff4..14fb168c94 100644
--- a/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp
@@ -92,82 +92,63 @@ QOpenGLFunctions_4_0_Compatibility::QOpenGLFunctions_4_0_Compatibility()
QOpenGLFunctions_4_0_Compatibility::~QOpenGLFunctions_4_0_Compatibility()
{
- if (d_1_0_Core && !d_1_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Core->context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- delete d_1_0_Core;
- }
- if (d_1_1_Core && !d_1_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Core->context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- delete d_1_1_Core;
- }
- if (d_1_2_Core && !d_1_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Core->context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- delete d_1_2_Core;
- }
- if (d_1_3_Core && !d_1_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Core->context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- delete d_1_3_Core;
- }
- if (d_1_4_Core && !d_1_4_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Core->context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- delete d_1_4_Core;
- }
- if (d_1_5_Core && !d_1_5_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_5_Core->context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- delete d_1_5_Core;
- }
- if (d_2_0_Core && !d_2_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_0_Core->context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- delete d_2_0_Core;
- }
- if (d_2_1_Core && !d_2_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_1_Core->context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- delete d_2_1_Core;
- }
- if (d_3_0_Core && !d_3_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_0_Core->context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- delete d_3_0_Core;
- }
- if (d_3_1_Core && !d_3_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_1_Core->context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- delete d_3_1_Core;
- }
- if (d_3_2_Core && !d_3_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_2_Core->context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- delete d_3_2_Core;
- }
- if (d_3_3_Core && !d_3_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_3_Core->context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- delete d_3_3_Core;
- }
- if (d_4_0_Core && !d_4_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_0_Core->context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- delete d_4_0_Core;
- }
- if (d_1_0_Deprecated && !d_1_0_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Deprecated->context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- delete d_1_0_Deprecated;
- }
- if (d_1_1_Deprecated && !d_1_1_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Deprecated->context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- delete d_1_1_Deprecated;
- }
- if (d_1_2_Deprecated && !d_1_2_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Deprecated->context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- delete d_1_2_Deprecated;
- }
- if (d_1_3_Deprecated && !d_1_3_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Deprecated->context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- delete d_1_3_Deprecated;
- }
- if (d_1_4_Deprecated && !d_1_4_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Deprecated->context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- delete d_1_4_Deprecated;
- }
- if (d_3_3_Deprecated && !d_3_3_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_3_Deprecated->context, QOpenGLFunctions_3_3_DeprecatedBackend::versionStatus());
- delete d_3_3_Deprecated;
- }
+ if (d_1_0_Core)
+ d_1_0_Core->refs.deref();
+ Q_ASSERT(d_1_0_Core->refs.load());
+ if (d_1_1_Core)
+ d_1_1_Core->refs.deref();
+ Q_ASSERT(d_1_1_Core->refs.load());
+ if (d_1_2_Core)
+ d_1_2_Core->refs.deref();
+ Q_ASSERT(d_1_2_Core->refs.load());
+ if (d_1_3_Core)
+ d_1_3_Core->refs.deref();
+ Q_ASSERT(d_1_3_Core->refs.load());
+ if (d_1_4_Core)
+ d_1_4_Core->refs.deref();
+ Q_ASSERT(d_1_4_Core->refs.load());
+ if (d_1_5_Core)
+ d_1_5_Core->refs.deref();
+ Q_ASSERT(d_1_5_Core->refs.load());
+ if (d_2_0_Core)
+ d_2_0_Core->refs.deref();
+ Q_ASSERT(d_2_0_Core->refs.load());
+ if (d_2_1_Core)
+ d_2_1_Core->refs.deref();
+ Q_ASSERT(d_2_1_Core->refs.load());
+ if (d_3_0_Core)
+ d_3_0_Core->refs.deref();
+ Q_ASSERT(d_3_0_Core->refs.load());
+ if (d_3_1_Core)
+ d_3_1_Core->refs.deref();
+ Q_ASSERT(d_3_1_Core->refs.load());
+ if (d_3_2_Core)
+ d_3_2_Core->refs.deref();
+ Q_ASSERT(d_3_2_Core->refs.load());
+ if (d_3_3_Core)
+ d_3_3_Core->refs.deref();
+ Q_ASSERT(d_3_3_Core->refs.load());
+ if (d_4_0_Core)
+ d_4_0_Core->refs.deref();
+ Q_ASSERT(d_4_0_Core->refs.load());
+ if (d_1_0_Deprecated)
+ d_1_0_Deprecated->refs.deref();
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ if (d_1_1_Deprecated)
+ d_1_1_Deprecated->refs.deref();
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ if (d_1_2_Deprecated)
+ d_1_2_Deprecated->refs.deref();
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ if (d_1_3_Deprecated)
+ d_1_3_Deprecated->refs.deref();
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ if (d_1_4_Deprecated)
+ d_1_4_Deprecated->refs.deref();
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ if (d_3_3_Deprecated)
+ d_3_3_Deprecated->refs.deref();
+ Q_ASSERT(d_3_3_Deprecated->refs.load());
}
bool QOpenGLFunctions_4_0_Compatibility::initializeOpenGLFunctions()
@@ -186,154 +167,78 @@ bool QOpenGLFunctions_4_0_Compatibility::initializeOpenGLFunctions()
// Function pointers in the backends are resolved at creation time
QOpenGLVersionFunctionsBackend* d = 0;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus(), d);
- }
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus(), d);
- }
d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus(), d);
- }
d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus(), d);
- }
d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus(), d);
- }
d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_5_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus(), d);
- }
d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus(), d);
- }
d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus(), d);
- }
d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus(), d);
- }
d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus(), d);
- }
d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus(), d);
- }
d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus(), d);
- }
d_3_3_Core = static_cast<QOpenGLFunctions_3_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus(), d);
- }
d_4_0_Core = static_cast<QOpenGLFunctions_4_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus(), d);
- }
d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus(), d);
- }
d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus(), d);
- }
d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus(), d);
- }
d_1_3_Deprecated = static_cast<QOpenGLFunctions_1_3_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus(), d);
- }
d_1_4_Deprecated = static_cast<QOpenGLFunctions_1_4_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_3_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_3_DeprecatedBackend::versionStatus(), d);
- }
d_3_3_Deprecated = static_cast<QOpenGLFunctions_3_3_DeprecatedBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_4_0_core.cpp b/src/gui/opengl/qopenglfunctions_4_0_core.cpp
index 022a27ccd6..6dc94153c8 100644
--- a/src/gui/opengl/qopenglfunctions_4_0_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_0_core.cpp
@@ -85,58 +85,45 @@ QOpenGLFunctions_4_0_Core::QOpenGLFunctions_4_0_Core()
QOpenGLFunctions_4_0_Core::~QOpenGLFunctions_4_0_Core()
{
- if (d_1_0_Core && !d_1_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Core->context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- delete d_1_0_Core;
- }
- if (d_1_1_Core && !d_1_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Core->context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- delete d_1_1_Core;
- }
- if (d_1_2_Core && !d_1_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Core->context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- delete d_1_2_Core;
- }
- if (d_1_3_Core && !d_1_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Core->context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- delete d_1_3_Core;
- }
- if (d_1_4_Core && !d_1_4_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Core->context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- delete d_1_4_Core;
- }
- if (d_1_5_Core && !d_1_5_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_5_Core->context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- delete d_1_5_Core;
- }
- if (d_2_0_Core && !d_2_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_0_Core->context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- delete d_2_0_Core;
- }
- if (d_2_1_Core && !d_2_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_1_Core->context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- delete d_2_1_Core;
- }
- if (d_3_0_Core && !d_3_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_0_Core->context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- delete d_3_0_Core;
- }
- if (d_3_1_Core && !d_3_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_1_Core->context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- delete d_3_1_Core;
- }
- if (d_3_2_Core && !d_3_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_2_Core->context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- delete d_3_2_Core;
- }
- if (d_3_3_Core && !d_3_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_3_Core->context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- delete d_3_3_Core;
- }
- if (d_4_0_Core && !d_4_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_0_Core->context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- delete d_4_0_Core;
- }
+ if (d_1_0_Core)
+ d_1_0_Core->refs.deref();
+ Q_ASSERT(d_1_0_Core->refs.load());
+ if (d_1_1_Core)
+ d_1_1_Core->refs.deref();
+ Q_ASSERT(d_1_1_Core->refs.load());
+ if (d_1_2_Core)
+ d_1_2_Core->refs.deref();
+ Q_ASSERT(d_1_2_Core->refs.load());
+ if (d_1_3_Core)
+ d_1_3_Core->refs.deref();
+ Q_ASSERT(d_1_3_Core->refs.load());
+ if (d_1_4_Core)
+ d_1_4_Core->refs.deref();
+ Q_ASSERT(d_1_4_Core->refs.load());
+ if (d_1_5_Core)
+ d_1_5_Core->refs.deref();
+ Q_ASSERT(d_1_5_Core->refs.load());
+ if (d_2_0_Core)
+ d_2_0_Core->refs.deref();
+ Q_ASSERT(d_2_0_Core->refs.load());
+ if (d_2_1_Core)
+ d_2_1_Core->refs.deref();
+ Q_ASSERT(d_2_1_Core->refs.load());
+ if (d_3_0_Core)
+ d_3_0_Core->refs.deref();
+ Q_ASSERT(d_3_0_Core->refs.load());
+ if (d_3_1_Core)
+ d_3_1_Core->refs.deref();
+ Q_ASSERT(d_3_1_Core->refs.load());
+ if (d_3_2_Core)
+ d_3_2_Core->refs.deref();
+ Q_ASSERT(d_3_2_Core->refs.load());
+ if (d_3_3_Core)
+ d_3_3_Core->refs.deref();
+ Q_ASSERT(d_3_3_Core->refs.load());
+ if (d_4_0_Core)
+ d_4_0_Core->refs.deref();
+ Q_ASSERT(d_4_0_Core->refs.load());
}
bool QOpenGLFunctions_4_0_Core::initializeOpenGLFunctions()
@@ -155,106 +142,54 @@ bool QOpenGLFunctions_4_0_Core::initializeOpenGLFunctions()
// Function pointers in the backends are resolved at creation time
QOpenGLVersionFunctionsBackend* d = 0;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus(), d);
- }
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus(), d);
- }
d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus(), d);
- }
d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus(), d);
- }
d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus(), d);
- }
d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_5_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus(), d);
- }
d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus(), d);
- }
d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus(), d);
- }
d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus(), d);
- }
d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus(), d);
- }
d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus(), d);
- }
d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus(), d);
- }
d_3_3_Core = static_cast<QOpenGLFunctions_3_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus(), d);
- }
d_4_0_Core = static_cast<QOpenGLFunctions_4_0_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp
index f1a3bb5b05..293409ddef 100644
--- a/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp
@@ -93,86 +93,66 @@ QOpenGLFunctions_4_1_Compatibility::QOpenGLFunctions_4_1_Compatibility()
QOpenGLFunctions_4_1_Compatibility::~QOpenGLFunctions_4_1_Compatibility()
{
- if (d_1_0_Core && !d_1_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Core->context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- delete d_1_0_Core;
- }
- if (d_1_1_Core && !d_1_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Core->context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- delete d_1_1_Core;
- }
- if (d_1_2_Core && !d_1_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Core->context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- delete d_1_2_Core;
- }
- if (d_1_3_Core && !d_1_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Core->context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- delete d_1_3_Core;
- }
- if (d_1_4_Core && !d_1_4_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Core->context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- delete d_1_4_Core;
- }
- if (d_1_5_Core && !d_1_5_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_5_Core->context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- delete d_1_5_Core;
- }
- if (d_2_0_Core && !d_2_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_0_Core->context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- delete d_2_0_Core;
- }
- if (d_2_1_Core && !d_2_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_1_Core->context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- delete d_2_1_Core;
- }
- if (d_3_0_Core && !d_3_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_0_Core->context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- delete d_3_0_Core;
- }
- if (d_3_1_Core && !d_3_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_1_Core->context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- delete d_3_1_Core;
- }
- if (d_3_2_Core && !d_3_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_2_Core->context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- delete d_3_2_Core;
- }
- if (d_3_3_Core && !d_3_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_3_Core->context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- delete d_3_3_Core;
- }
- if (d_4_0_Core && !d_4_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_0_Core->context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- delete d_4_0_Core;
- }
- if (d_4_1_Core && !d_4_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_1_Core->context, QOpenGLFunctions_4_1_CoreBackend::versionStatus());
- delete d_4_1_Core;
- }
- if (d_1_0_Deprecated && !d_1_0_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Deprecated->context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- delete d_1_0_Deprecated;
- }
- if (d_1_1_Deprecated && !d_1_1_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Deprecated->context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- delete d_1_1_Deprecated;
- }
- if (d_1_2_Deprecated && !d_1_2_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Deprecated->context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- delete d_1_2_Deprecated;
- }
- if (d_1_3_Deprecated && !d_1_3_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Deprecated->context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- delete d_1_3_Deprecated;
- }
- if (d_1_4_Deprecated && !d_1_4_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Deprecated->context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- delete d_1_4_Deprecated;
- }
- if (d_3_3_Deprecated && !d_3_3_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_3_Deprecated->context, QOpenGLFunctions_3_3_DeprecatedBackend::versionStatus());
- delete d_3_3_Deprecated;
- }
+ if (d_1_0_Core)
+ d_1_0_Core->refs.deref();
+ Q_ASSERT(d_1_0_Core->refs.load());
+ if (d_1_1_Core)
+ d_1_1_Core->refs.deref();
+ Q_ASSERT(d_1_1_Core->refs.load());
+ if (d_1_2_Core)
+ d_1_2_Core->refs.deref();
+ Q_ASSERT(d_1_2_Core->refs.load());
+ if (d_1_3_Core)
+ d_1_3_Core->refs.deref();
+ Q_ASSERT(d_1_3_Core->refs.load());
+ if (d_1_4_Core)
+ d_1_4_Core->refs.deref();
+ Q_ASSERT(d_1_4_Core->refs.load());
+ if (d_1_5_Core)
+ d_1_5_Core->refs.deref();
+ Q_ASSERT(d_1_5_Core->refs.load());
+ if (d_2_0_Core)
+ d_2_0_Core->refs.deref();
+ Q_ASSERT(d_2_0_Core->refs.load());
+ if (d_2_1_Core)
+ d_2_1_Core->refs.deref();
+ Q_ASSERT(d_2_1_Core->refs.load());
+ if (d_3_0_Core)
+ d_3_0_Core->refs.deref();
+ Q_ASSERT(d_3_0_Core->refs.load());
+ if (d_3_1_Core)
+ d_3_1_Core->refs.deref();
+ Q_ASSERT(d_3_1_Core->refs.load());
+ if (d_3_2_Core)
+ d_3_2_Core->refs.deref();
+ Q_ASSERT(d_3_2_Core->refs.load());
+ if (d_3_3_Core)
+ d_3_3_Core->refs.deref();
+ Q_ASSERT(d_3_3_Core->refs.load());
+ if (d_4_0_Core)
+ d_4_0_Core->refs.deref();
+ Q_ASSERT(d_4_0_Core->refs.load());
+ if (d_4_1_Core)
+ d_4_1_Core->refs.deref();
+ Q_ASSERT(d_4_1_Core->refs.load());
+ if (d_1_0_Deprecated)
+ d_1_0_Deprecated->refs.deref();
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ if (d_1_1_Deprecated)
+ d_1_1_Deprecated->refs.deref();
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ if (d_1_2_Deprecated)
+ d_1_2_Deprecated->refs.deref();
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ if (d_1_3_Deprecated)
+ d_1_3_Deprecated->refs.deref();
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ if (d_1_4_Deprecated)
+ d_1_4_Deprecated->refs.deref();
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ if (d_3_3_Deprecated)
+ d_3_3_Deprecated->refs.deref();
+ Q_ASSERT(d_3_3_Deprecated->refs.load());
}
bool QOpenGLFunctions_4_1_Compatibility::initializeOpenGLFunctions()
@@ -191,162 +171,82 @@ bool QOpenGLFunctions_4_1_Compatibility::initializeOpenGLFunctions()
// Function pointers in the backends are resolved at creation time
QOpenGLVersionFunctionsBackend* d = 0;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus(), d);
- }
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus(), d);
- }
d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus(), d);
- }
d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus(), d);
- }
d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus(), d);
- }
d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_5_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus(), d);
- }
d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus(), d);
- }
d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus(), d);
- }
d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus(), d);
- }
d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus(), d);
- }
d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus(), d);
- }
d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus(), d);
- }
d_3_3_Core = static_cast<QOpenGLFunctions_3_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus(), d);
- }
d_4_0_Core = static_cast<QOpenGLFunctions_4_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_1_CoreBackend::versionStatus(), d);
- }
d_4_1_Core = static_cast<QOpenGLFunctions_4_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus(), d);
- }
d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus(), d);
- }
d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus(), d);
- }
d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus(), d);
- }
d_1_3_Deprecated = static_cast<QOpenGLFunctions_1_3_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus(), d);
- }
d_1_4_Deprecated = static_cast<QOpenGLFunctions_1_4_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_3_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_3_DeprecatedBackend::versionStatus(), d);
- }
d_3_3_Deprecated = static_cast<QOpenGLFunctions_3_3_DeprecatedBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_4_1_core.cpp b/src/gui/opengl/qopenglfunctions_4_1_core.cpp
index b3c2c11d60..ff3d191781 100644
--- a/src/gui/opengl/qopenglfunctions_4_1_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_1_core.cpp
@@ -86,62 +86,48 @@ QOpenGLFunctions_4_1_Core::QOpenGLFunctions_4_1_Core()
QOpenGLFunctions_4_1_Core::~QOpenGLFunctions_4_1_Core()
{
- if (d_1_0_Core && !d_1_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Core->context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- delete d_1_0_Core;
- }
- if (d_1_1_Core && !d_1_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Core->context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- delete d_1_1_Core;
- }
- if (d_1_2_Core && !d_1_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Core->context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- delete d_1_2_Core;
- }
- if (d_1_3_Core && !d_1_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Core->context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- delete d_1_3_Core;
- }
- if (d_1_4_Core && !d_1_4_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Core->context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- delete d_1_4_Core;
- }
- if (d_1_5_Core && !d_1_5_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_5_Core->context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- delete d_1_5_Core;
- }
- if (d_2_0_Core && !d_2_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_0_Core->context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- delete d_2_0_Core;
- }
- if (d_2_1_Core && !d_2_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_1_Core->context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- delete d_2_1_Core;
- }
- if (d_3_0_Core && !d_3_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_0_Core->context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- delete d_3_0_Core;
- }
- if (d_3_1_Core && !d_3_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_1_Core->context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- delete d_3_1_Core;
- }
- if (d_3_2_Core && !d_3_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_2_Core->context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- delete d_3_2_Core;
- }
- if (d_3_3_Core && !d_3_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_3_Core->context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- delete d_3_3_Core;
- }
- if (d_4_0_Core && !d_4_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_0_Core->context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- delete d_4_0_Core;
- }
- if (d_4_1_Core && !d_4_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_1_Core->context, QOpenGLFunctions_4_1_CoreBackend::versionStatus());
- delete d_4_1_Core;
- }
+ if (d_1_0_Core)
+ d_1_0_Core->refs.deref();
+ Q_ASSERT(d_1_0_Core->refs.load());
+ if (d_1_1_Core)
+ d_1_1_Core->refs.deref();
+ Q_ASSERT(d_1_1_Core->refs.load());
+ if (d_1_2_Core)
+ d_1_2_Core->refs.deref();
+ Q_ASSERT(d_1_2_Core->refs.load());
+ if (d_1_3_Core)
+ d_1_3_Core->refs.deref();
+ Q_ASSERT(d_1_3_Core->refs.load());
+ if (d_1_4_Core)
+ d_1_4_Core->refs.deref();
+ Q_ASSERT(d_1_4_Core->refs.load());
+ if (d_1_5_Core)
+ d_1_5_Core->refs.deref();
+ Q_ASSERT(d_1_5_Core->refs.load());
+ if (d_2_0_Core)
+ d_2_0_Core->refs.deref();
+ Q_ASSERT(d_2_0_Core->refs.load());
+ if (d_2_1_Core)
+ d_2_1_Core->refs.deref();
+ Q_ASSERT(d_2_1_Core->refs.load());
+ if (d_3_0_Core)
+ d_3_0_Core->refs.deref();
+ Q_ASSERT(d_3_0_Core->refs.load());
+ if (d_3_1_Core)
+ d_3_1_Core->refs.deref();
+ Q_ASSERT(d_3_1_Core->refs.load());
+ if (d_3_2_Core)
+ d_3_2_Core->refs.deref();
+ Q_ASSERT(d_3_2_Core->refs.load());
+ if (d_3_3_Core)
+ d_3_3_Core->refs.deref();
+ Q_ASSERT(d_3_3_Core->refs.load());
+ if (d_4_0_Core)
+ d_4_0_Core->refs.deref();
+ Q_ASSERT(d_4_0_Core->refs.load());
+ if (d_4_1_Core)
+ d_4_1_Core->refs.deref();
+ Q_ASSERT(d_4_1_Core->refs.load());
}
bool QOpenGLFunctions_4_1_Core::initializeOpenGLFunctions()
@@ -160,114 +146,58 @@ bool QOpenGLFunctions_4_1_Core::initializeOpenGLFunctions()
// Function pointers in the backends are resolved at creation time
QOpenGLVersionFunctionsBackend* d = 0;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus(), d);
- }
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus(), d);
- }
d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus(), d);
- }
d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus(), d);
- }
d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus(), d);
- }
d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_5_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus(), d);
- }
d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus(), d);
- }
d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus(), d);
- }
d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus(), d);
- }
d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus(), d);
- }
d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus(), d);
- }
d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus(), d);
- }
d_3_3_Core = static_cast<QOpenGLFunctions_3_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus(), d);
- }
d_4_0_Core = static_cast<QOpenGLFunctions_4_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_1_CoreBackend::versionStatus(), d);
- }
d_4_1_Core = static_cast<QOpenGLFunctions_4_1_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp
index 2f6dbc9b78..58527e92b5 100644
--- a/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp
@@ -94,90 +94,69 @@ QOpenGLFunctions_4_2_Compatibility::QOpenGLFunctions_4_2_Compatibility()
QOpenGLFunctions_4_2_Compatibility::~QOpenGLFunctions_4_2_Compatibility()
{
- if (d_1_0_Core && !d_1_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Core->context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- delete d_1_0_Core;
- }
- if (d_1_1_Core && !d_1_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Core->context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- delete d_1_1_Core;
- }
- if (d_1_2_Core && !d_1_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Core->context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- delete d_1_2_Core;
- }
- if (d_1_3_Core && !d_1_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Core->context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- delete d_1_3_Core;
- }
- if (d_1_4_Core && !d_1_4_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Core->context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- delete d_1_4_Core;
- }
- if (d_1_5_Core && !d_1_5_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_5_Core->context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- delete d_1_5_Core;
- }
- if (d_2_0_Core && !d_2_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_0_Core->context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- delete d_2_0_Core;
- }
- if (d_2_1_Core && !d_2_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_1_Core->context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- delete d_2_1_Core;
- }
- if (d_3_0_Core && !d_3_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_0_Core->context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- delete d_3_0_Core;
- }
- if (d_3_1_Core && !d_3_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_1_Core->context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- delete d_3_1_Core;
- }
- if (d_3_2_Core && !d_3_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_2_Core->context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- delete d_3_2_Core;
- }
- if (d_3_3_Core && !d_3_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_3_Core->context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- delete d_3_3_Core;
- }
- if (d_4_0_Core && !d_4_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_0_Core->context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- delete d_4_0_Core;
- }
- if (d_4_1_Core && !d_4_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_1_Core->context, QOpenGLFunctions_4_1_CoreBackend::versionStatus());
- delete d_4_1_Core;
- }
- if (d_4_2_Core && !d_4_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_2_Core->context, QOpenGLFunctions_4_2_CoreBackend::versionStatus());
- delete d_4_2_Core;
- }
- if (d_1_0_Deprecated && !d_1_0_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Deprecated->context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- delete d_1_0_Deprecated;
- }
- if (d_1_1_Deprecated && !d_1_1_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Deprecated->context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- delete d_1_1_Deprecated;
- }
- if (d_1_2_Deprecated && !d_1_2_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Deprecated->context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- delete d_1_2_Deprecated;
- }
- if (d_1_3_Deprecated && !d_1_3_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Deprecated->context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- delete d_1_3_Deprecated;
- }
- if (d_1_4_Deprecated && !d_1_4_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Deprecated->context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- delete d_1_4_Deprecated;
- }
- if (d_3_3_Deprecated && !d_3_3_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_3_Deprecated->context, QOpenGLFunctions_3_3_DeprecatedBackend::versionStatus());
- delete d_3_3_Deprecated;
- }
+ if (d_1_0_Core)
+ d_1_0_Core->refs.deref();
+ Q_ASSERT(d_1_0_Core->refs.load());
+ if (d_1_1_Core)
+ d_1_1_Core->refs.deref();
+ Q_ASSERT(d_1_1_Core->refs.load());
+ if (d_1_2_Core)
+ d_1_2_Core->refs.deref();
+ Q_ASSERT(d_1_2_Core->refs.load());
+ if (d_1_3_Core)
+ d_1_3_Core->refs.deref();
+ Q_ASSERT(d_1_3_Core->refs.load());
+ if (d_1_4_Core)
+ d_1_4_Core->refs.deref();
+ Q_ASSERT(d_1_4_Core->refs.load());
+ if (d_1_5_Core)
+ d_1_5_Core->refs.deref();
+ Q_ASSERT(d_1_5_Core->refs.load());
+ if (d_2_0_Core)
+ d_2_0_Core->refs.deref();
+ Q_ASSERT(d_2_0_Core->refs.load());
+ if (d_2_1_Core)
+ d_2_1_Core->refs.deref();
+ Q_ASSERT(d_2_1_Core->refs.load());
+ if (d_3_0_Core)
+ d_3_0_Core->refs.deref();
+ Q_ASSERT(d_3_0_Core->refs.load());
+ if (d_3_1_Core)
+ d_3_1_Core->refs.deref();
+ Q_ASSERT(d_3_1_Core->refs.load());
+ if (d_3_2_Core)
+ d_3_2_Core->refs.deref();
+ Q_ASSERT(d_3_2_Core->refs.load());
+ if (d_3_3_Core)
+ d_3_3_Core->refs.deref();
+ Q_ASSERT(d_3_3_Core->refs.load());
+ if (d_4_0_Core)
+ d_4_0_Core->refs.deref();
+ Q_ASSERT(d_4_0_Core->refs.load());
+ if (d_4_1_Core)
+ d_4_1_Core->refs.deref();
+ Q_ASSERT(d_4_1_Core->refs.load());
+ if (d_4_2_Core)
+ d_4_2_Core->refs.deref();
+ Q_ASSERT(d_4_2_Core->refs.load());
+ if (d_1_0_Deprecated)
+ d_1_0_Deprecated->refs.deref();
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ if (d_1_1_Deprecated)
+ d_1_1_Deprecated->refs.deref();
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ if (d_1_2_Deprecated)
+ d_1_2_Deprecated->refs.deref();
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ if (d_1_3_Deprecated)
+ d_1_3_Deprecated->refs.deref();
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ if (d_1_4_Deprecated)
+ d_1_4_Deprecated->refs.deref();
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ if (d_3_3_Deprecated)
+ d_3_3_Deprecated->refs.deref();
+ Q_ASSERT(d_3_3_Deprecated->refs.load());
}
bool QOpenGLFunctions_4_2_Compatibility::initializeOpenGLFunctions()
@@ -196,170 +175,86 @@ bool QOpenGLFunctions_4_2_Compatibility::initializeOpenGLFunctions()
// Function pointers in the backends are resolved at creation time
QOpenGLVersionFunctionsBackend* d = 0;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus(), d);
- }
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus(), d);
- }
d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus(), d);
- }
d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus(), d);
- }
d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus(), d);
- }
d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_5_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus(), d);
- }
d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus(), d);
- }
d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus(), d);
- }
d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus(), d);
- }
d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus(), d);
- }
d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus(), d);
- }
d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus(), d);
- }
d_3_3_Core = static_cast<QOpenGLFunctions_3_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus(), d);
- }
d_4_0_Core = static_cast<QOpenGLFunctions_4_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_1_CoreBackend::versionStatus(), d);
- }
d_4_1_Core = static_cast<QOpenGLFunctions_4_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_2_CoreBackend::versionStatus(), d);
- }
d_4_2_Core = static_cast<QOpenGLFunctions_4_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus(), d);
- }
d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus(), d);
- }
d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus(), d);
- }
d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus(), d);
- }
d_1_3_Deprecated = static_cast<QOpenGLFunctions_1_3_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus(), d);
- }
d_1_4_Deprecated = static_cast<QOpenGLFunctions_1_4_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_3_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_3_DeprecatedBackend::versionStatus(), d);
- }
d_3_3_Deprecated = static_cast<QOpenGLFunctions_3_3_DeprecatedBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_4_2_core.cpp b/src/gui/opengl/qopenglfunctions_4_2_core.cpp
index 800d4679c5..b929abcf6a 100644
--- a/src/gui/opengl/qopenglfunctions_4_2_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_2_core.cpp
@@ -87,66 +87,51 @@ QOpenGLFunctions_4_2_Core::QOpenGLFunctions_4_2_Core()
QOpenGLFunctions_4_2_Core::~QOpenGLFunctions_4_2_Core()
{
- if (d_1_0_Core && !d_1_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Core->context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- delete d_1_0_Core;
- }
- if (d_1_1_Core && !d_1_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Core->context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- delete d_1_1_Core;
- }
- if (d_1_2_Core && !d_1_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Core->context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- delete d_1_2_Core;
- }
- if (d_1_3_Core && !d_1_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Core->context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- delete d_1_3_Core;
- }
- if (d_1_4_Core && !d_1_4_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Core->context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- delete d_1_4_Core;
- }
- if (d_1_5_Core && !d_1_5_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_5_Core->context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- delete d_1_5_Core;
- }
- if (d_2_0_Core && !d_2_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_0_Core->context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- delete d_2_0_Core;
- }
- if (d_2_1_Core && !d_2_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_1_Core->context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- delete d_2_1_Core;
- }
- if (d_3_0_Core && !d_3_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_0_Core->context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- delete d_3_0_Core;
- }
- if (d_3_1_Core && !d_3_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_1_Core->context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- delete d_3_1_Core;
- }
- if (d_3_2_Core && !d_3_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_2_Core->context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- delete d_3_2_Core;
- }
- if (d_3_3_Core && !d_3_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_3_Core->context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- delete d_3_3_Core;
- }
- if (d_4_0_Core && !d_4_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_0_Core->context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- delete d_4_0_Core;
- }
- if (d_4_1_Core && !d_4_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_1_Core->context, QOpenGLFunctions_4_1_CoreBackend::versionStatus());
- delete d_4_1_Core;
- }
- if (d_4_2_Core && !d_4_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_2_Core->context, QOpenGLFunctions_4_2_CoreBackend::versionStatus());
- delete d_4_2_Core;
- }
+ if (d_1_0_Core)
+ d_1_0_Core->refs.deref();
+ Q_ASSERT(d_1_0_Core->refs.load());
+ if (d_1_1_Core)
+ d_1_1_Core->refs.deref();
+ Q_ASSERT(d_1_1_Core->refs.load());
+ if (d_1_2_Core)
+ d_1_2_Core->refs.deref();
+ Q_ASSERT(d_1_2_Core->refs.load());
+ if (d_1_3_Core)
+ d_1_3_Core->refs.deref();
+ Q_ASSERT(d_1_3_Core->refs.load());
+ if (d_1_4_Core)
+ d_1_4_Core->refs.deref();
+ Q_ASSERT(d_1_4_Core->refs.load());
+ if (d_1_5_Core)
+ d_1_5_Core->refs.deref();
+ Q_ASSERT(d_1_5_Core->refs.load());
+ if (d_2_0_Core)
+ d_2_0_Core->refs.deref();
+ Q_ASSERT(d_2_0_Core->refs.load());
+ if (d_2_1_Core)
+ d_2_1_Core->refs.deref();
+ Q_ASSERT(d_2_1_Core->refs.load());
+ if (d_3_0_Core)
+ d_3_0_Core->refs.deref();
+ Q_ASSERT(d_3_0_Core->refs.load());
+ if (d_3_1_Core)
+ d_3_1_Core->refs.deref();
+ Q_ASSERT(d_3_1_Core->refs.load());
+ if (d_3_2_Core)
+ d_3_2_Core->refs.deref();
+ Q_ASSERT(d_3_2_Core->refs.load());
+ if (d_3_3_Core)
+ d_3_3_Core->refs.deref();
+ Q_ASSERT(d_3_3_Core->refs.load());
+ if (d_4_0_Core)
+ d_4_0_Core->refs.deref();
+ Q_ASSERT(d_4_0_Core->refs.load());
+ if (d_4_1_Core)
+ d_4_1_Core->refs.deref();
+ Q_ASSERT(d_4_1_Core->refs.load());
+ if (d_4_2_Core)
+ d_4_2_Core->refs.deref();
+ Q_ASSERT(d_4_2_Core->refs.load());
}
bool QOpenGLFunctions_4_2_Core::initializeOpenGLFunctions()
@@ -165,122 +150,62 @@ bool QOpenGLFunctions_4_2_Core::initializeOpenGLFunctions()
// Function pointers in the backends are resolved at creation time
QOpenGLVersionFunctionsBackend* d = 0;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus(), d);
- }
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus(), d);
- }
d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus(), d);
- }
d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus(), d);
- }
d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus(), d);
- }
d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_5_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus(), d);
- }
d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus(), d);
- }
d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus(), d);
- }
d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus(), d);
- }
d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus(), d);
- }
d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus(), d);
- }
d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus(), d);
- }
d_3_3_Core = static_cast<QOpenGLFunctions_3_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus(), d);
- }
d_4_0_Core = static_cast<QOpenGLFunctions_4_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_1_CoreBackend::versionStatus(), d);
- }
d_4_1_Core = static_cast<QOpenGLFunctions_4_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_2_CoreBackend::versionStatus(), d);
- }
d_4_2_Core = static_cast<QOpenGLFunctions_4_2_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp
index 0cf5c467ea..a9f15083ad 100644
--- a/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp
@@ -95,94 +95,72 @@ QOpenGLFunctions_4_3_Compatibility::QOpenGLFunctions_4_3_Compatibility()
QOpenGLFunctions_4_3_Compatibility::~QOpenGLFunctions_4_3_Compatibility()
{
- if (d_1_0_Core && !d_1_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Core->context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- delete d_1_0_Core;
- }
- if (d_1_1_Core && !d_1_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Core->context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- delete d_1_1_Core;
- }
- if (d_1_2_Core && !d_1_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Core->context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- delete d_1_2_Core;
- }
- if (d_1_3_Core && !d_1_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Core->context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- delete d_1_3_Core;
- }
- if (d_1_4_Core && !d_1_4_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Core->context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- delete d_1_4_Core;
- }
- if (d_1_5_Core && !d_1_5_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_5_Core->context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- delete d_1_5_Core;
- }
- if (d_2_0_Core && !d_2_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_0_Core->context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- delete d_2_0_Core;
- }
- if (d_2_1_Core && !d_2_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_1_Core->context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- delete d_2_1_Core;
- }
- if (d_3_0_Core && !d_3_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_0_Core->context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- delete d_3_0_Core;
- }
- if (d_3_1_Core && !d_3_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_1_Core->context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- delete d_3_1_Core;
- }
- if (d_3_2_Core && !d_3_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_2_Core->context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- delete d_3_2_Core;
- }
- if (d_3_3_Core && !d_3_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_3_Core->context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- delete d_3_3_Core;
- }
- if (d_4_0_Core && !d_4_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_0_Core->context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- delete d_4_0_Core;
- }
- if (d_4_1_Core && !d_4_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_1_Core->context, QOpenGLFunctions_4_1_CoreBackend::versionStatus());
- delete d_4_1_Core;
- }
- if (d_4_2_Core && !d_4_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_2_Core->context, QOpenGLFunctions_4_2_CoreBackend::versionStatus());
- delete d_4_2_Core;
- }
- if (d_4_3_Core && !d_4_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_3_Core->context, QOpenGLFunctions_4_3_CoreBackend::versionStatus());
- delete d_4_3_Core;
- }
- if (d_1_0_Deprecated && !d_1_0_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Deprecated->context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- delete d_1_0_Deprecated;
- }
- if (d_1_1_Deprecated && !d_1_1_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Deprecated->context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- delete d_1_1_Deprecated;
- }
- if (d_1_2_Deprecated && !d_1_2_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Deprecated->context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- delete d_1_2_Deprecated;
- }
- if (d_1_3_Deprecated && !d_1_3_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Deprecated->context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- delete d_1_3_Deprecated;
- }
- if (d_1_4_Deprecated && !d_1_4_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Deprecated->context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- delete d_1_4_Deprecated;
- }
- if (d_3_3_Deprecated && !d_3_3_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_3_Deprecated->context, QOpenGLFunctions_3_3_DeprecatedBackend::versionStatus());
- delete d_3_3_Deprecated;
- }
+ if (d_1_0_Core)
+ d_1_0_Core->refs.deref();
+ Q_ASSERT(d_1_0_Core->refs.load());
+ if (d_1_1_Core)
+ d_1_1_Core->refs.deref();
+ Q_ASSERT(d_1_1_Core->refs.load());
+ if (d_1_2_Core)
+ d_1_2_Core->refs.deref();
+ Q_ASSERT(d_1_2_Core->refs.load());
+ if (d_1_3_Core)
+ d_1_3_Core->refs.deref();
+ Q_ASSERT(d_1_3_Core->refs.load());
+ if (d_1_4_Core)
+ d_1_4_Core->refs.deref();
+ Q_ASSERT(d_1_4_Core->refs.load());
+ if (d_1_5_Core)
+ d_1_5_Core->refs.deref();
+ Q_ASSERT(d_1_5_Core->refs.load());
+ if (d_2_0_Core)
+ d_2_0_Core->refs.deref();
+ Q_ASSERT(d_2_0_Core->refs.load());
+ if (d_2_1_Core)
+ d_2_1_Core->refs.deref();
+ Q_ASSERT(d_2_1_Core->refs.load());
+ if (d_3_0_Core)
+ d_3_0_Core->refs.deref();
+ Q_ASSERT(d_3_0_Core->refs.load());
+ if (d_3_1_Core)
+ d_3_1_Core->refs.deref();
+ Q_ASSERT(d_3_1_Core->refs.load());
+ if (d_3_2_Core)
+ d_3_2_Core->refs.deref();
+ Q_ASSERT(d_3_2_Core->refs.load());
+ if (d_3_3_Core)
+ d_3_3_Core->refs.deref();
+ Q_ASSERT(d_3_3_Core->refs.load());
+ if (d_4_0_Core)
+ d_4_0_Core->refs.deref();
+ Q_ASSERT(d_4_0_Core->refs.load());
+ if (d_4_1_Core)
+ d_4_1_Core->refs.deref();
+ Q_ASSERT(d_4_1_Core->refs.load());
+ if (d_4_2_Core)
+ d_4_2_Core->refs.deref();
+ Q_ASSERT(d_4_2_Core->refs.load());
+ if (d_4_3_Core)
+ d_4_3_Core->refs.deref();
+ Q_ASSERT(d_4_3_Core->refs.load());
+ if (d_1_0_Deprecated)
+ d_1_0_Deprecated->refs.deref();
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ if (d_1_1_Deprecated)
+ d_1_1_Deprecated->refs.deref();
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ if (d_1_2_Deprecated)
+ d_1_2_Deprecated->refs.deref();
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ if (d_1_3_Deprecated)
+ d_1_3_Deprecated->refs.deref();
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ if (d_1_4_Deprecated)
+ d_1_4_Deprecated->refs.deref();
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ if (d_3_3_Deprecated)
+ d_3_3_Deprecated->refs.deref();
+ Q_ASSERT(d_3_3_Deprecated->refs.load());
}
bool QOpenGLFunctions_4_3_Compatibility::initializeOpenGLFunctions()
@@ -201,178 +179,90 @@ bool QOpenGLFunctions_4_3_Compatibility::initializeOpenGLFunctions()
// Function pointers in the backends are resolved at creation time
QOpenGLVersionFunctionsBackend* d = 0;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus(), d);
- }
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus(), d);
- }
d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus(), d);
- }
d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus(), d);
- }
d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus(), d);
- }
d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_5_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus(), d);
- }
d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus(), d);
- }
d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus(), d);
- }
d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus(), d);
- }
d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus(), d);
- }
d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus(), d);
- }
d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus(), d);
- }
d_3_3_Core = static_cast<QOpenGLFunctions_3_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus(), d);
- }
d_4_0_Core = static_cast<QOpenGLFunctions_4_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_1_CoreBackend::versionStatus(), d);
- }
d_4_1_Core = static_cast<QOpenGLFunctions_4_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_2_CoreBackend::versionStatus(), d);
- }
d_4_2_Core = static_cast<QOpenGLFunctions_4_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_3_CoreBackend::versionStatus(), d);
- }
d_4_3_Core = static_cast<QOpenGLFunctions_4_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus(), d);
- }
d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus(), d);
- }
d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus(), d);
- }
d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus(), d);
- }
d_1_3_Deprecated = static_cast<QOpenGLFunctions_1_3_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus(), d);
- }
d_1_4_Deprecated = static_cast<QOpenGLFunctions_1_4_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_3_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_3_DeprecatedBackend::versionStatus(), d);
- }
d_3_3_Deprecated = static_cast<QOpenGLFunctions_3_3_DeprecatedBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_4_3_core.cpp b/src/gui/opengl/qopenglfunctions_4_3_core.cpp
index 5d8bb179ce..d3f988ba0d 100644
--- a/src/gui/opengl/qopenglfunctions_4_3_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_3_core.cpp
@@ -88,70 +88,54 @@ QOpenGLFunctions_4_3_Core::QOpenGLFunctions_4_3_Core()
QOpenGLFunctions_4_3_Core::~QOpenGLFunctions_4_3_Core()
{
- if (d_1_0_Core && !d_1_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Core->context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- delete d_1_0_Core;
- }
- if (d_1_1_Core && !d_1_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Core->context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- delete d_1_1_Core;
- }
- if (d_1_2_Core && !d_1_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Core->context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- delete d_1_2_Core;
- }
- if (d_1_3_Core && !d_1_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Core->context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- delete d_1_3_Core;
- }
- if (d_1_4_Core && !d_1_4_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Core->context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- delete d_1_4_Core;
- }
- if (d_1_5_Core && !d_1_5_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_5_Core->context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- delete d_1_5_Core;
- }
- if (d_2_0_Core && !d_2_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_0_Core->context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- delete d_2_0_Core;
- }
- if (d_2_1_Core && !d_2_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_1_Core->context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- delete d_2_1_Core;
- }
- if (d_3_0_Core && !d_3_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_0_Core->context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- delete d_3_0_Core;
- }
- if (d_3_1_Core && !d_3_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_1_Core->context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- delete d_3_1_Core;
- }
- if (d_3_2_Core && !d_3_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_2_Core->context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- delete d_3_2_Core;
- }
- if (d_3_3_Core && !d_3_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_3_Core->context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- delete d_3_3_Core;
- }
- if (d_4_0_Core && !d_4_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_0_Core->context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- delete d_4_0_Core;
- }
- if (d_4_1_Core && !d_4_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_1_Core->context, QOpenGLFunctions_4_1_CoreBackend::versionStatus());
- delete d_4_1_Core;
- }
- if (d_4_2_Core && !d_4_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_2_Core->context, QOpenGLFunctions_4_2_CoreBackend::versionStatus());
- delete d_4_2_Core;
- }
- if (d_4_3_Core && !d_4_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_3_Core->context, QOpenGLFunctions_4_3_CoreBackend::versionStatus());
- delete d_4_3_Core;
- }
+ if (d_1_0_Core)
+ d_1_0_Core->refs.deref();
+ Q_ASSERT(d_1_0_Core->refs.load());
+ if (d_1_1_Core)
+ d_1_1_Core->refs.deref();
+ Q_ASSERT(d_1_1_Core->refs.load());
+ if (d_1_2_Core)
+ d_1_2_Core->refs.deref();
+ Q_ASSERT(d_1_2_Core->refs.load());
+ if (d_1_3_Core)
+ d_1_3_Core->refs.deref();
+ Q_ASSERT(d_1_3_Core->refs.load());
+ if (d_1_4_Core)
+ d_1_4_Core->refs.deref();
+ Q_ASSERT(d_1_4_Core->refs.load());
+ if (d_1_5_Core)
+ d_1_5_Core->refs.deref();
+ Q_ASSERT(d_1_5_Core->refs.load());
+ if (d_2_0_Core)
+ d_2_0_Core->refs.deref();
+ Q_ASSERT(d_2_0_Core->refs.load());
+ if (d_2_1_Core)
+ d_2_1_Core->refs.deref();
+ Q_ASSERT(d_2_1_Core->refs.load());
+ if (d_3_0_Core)
+ d_3_0_Core->refs.deref();
+ Q_ASSERT(d_3_0_Core->refs.load());
+ if (d_3_1_Core)
+ d_3_1_Core->refs.deref();
+ Q_ASSERT(d_3_1_Core->refs.load());
+ if (d_3_2_Core)
+ d_3_2_Core->refs.deref();
+ Q_ASSERT(d_3_2_Core->refs.load());
+ if (d_3_3_Core)
+ d_3_3_Core->refs.deref();
+ Q_ASSERT(d_3_3_Core->refs.load());
+ if (d_4_0_Core)
+ d_4_0_Core->refs.deref();
+ Q_ASSERT(d_4_0_Core->refs.load());
+ if (d_4_1_Core)
+ d_4_1_Core->refs.deref();
+ Q_ASSERT(d_4_1_Core->refs.load());
+ if (d_4_2_Core)
+ d_4_2_Core->refs.deref();
+ Q_ASSERT(d_4_2_Core->refs.load());
+ if (d_4_3_Core)
+ d_4_3_Core->refs.deref();
+ Q_ASSERT(d_4_3_Core->refs.load());
}
bool QOpenGLFunctions_4_3_Core::initializeOpenGLFunctions()
@@ -170,130 +154,66 @@ bool QOpenGLFunctions_4_3_Core::initializeOpenGLFunctions()
// Function pointers in the backends are resolved at creation time
QOpenGLVersionFunctionsBackend* d = 0;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus(), d);
- }
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus(), d);
- }
d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus(), d);
- }
d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus(), d);
- }
d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus(), d);
- }
d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_5_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus(), d);
- }
d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus(), d);
- }
d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus(), d);
- }
d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus(), d);
- }
d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus(), d);
- }
d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus(), d);
- }
d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus(), d);
- }
d_3_3_Core = static_cast<QOpenGLFunctions_3_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus(), d);
- }
d_4_0_Core = static_cast<QOpenGLFunctions_4_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_1_CoreBackend::versionStatus(), d);
- }
d_4_1_Core = static_cast<QOpenGLFunctions_4_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_2_CoreBackend::versionStatus(), d);
- }
d_4_2_Core = static_cast<QOpenGLFunctions_4_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_3_CoreBackend::versionStatus(), d);
- }
d_4_3_Core = static_cast<QOpenGLFunctions_4_3_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp
index 0f0bf925c9..8cbb94c1a1 100644
--- a/src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp
@@ -95,98 +95,75 @@ QOpenGLFunctions_4_4_Compatibility::QOpenGLFunctions_4_4_Compatibility()
QOpenGLFunctions_4_4_Compatibility::~QOpenGLFunctions_4_4_Compatibility()
{
- if (d_1_0_Core && !d_1_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Core->context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- delete d_1_0_Core;
- }
- if (d_1_1_Core && !d_1_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Core->context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- delete d_1_1_Core;
- }
- if (d_1_2_Core && !d_1_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Core->context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- delete d_1_2_Core;
- }
- if (d_1_3_Core && !d_1_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Core->context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- delete d_1_3_Core;
- }
- if (d_1_4_Core && !d_1_4_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Core->context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- delete d_1_4_Core;
- }
- if (d_1_5_Core && !d_1_5_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_5_Core->context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- delete d_1_5_Core;
- }
- if (d_2_0_Core && !d_2_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_0_Core->context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- delete d_2_0_Core;
- }
- if (d_2_1_Core && !d_2_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_1_Core->context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- delete d_2_1_Core;
- }
- if (d_3_0_Core && !d_3_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_0_Core->context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- delete d_3_0_Core;
- }
- if (d_3_1_Core && !d_3_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_1_Core->context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- delete d_3_1_Core;
- }
- if (d_3_2_Core && !d_3_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_2_Core->context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- delete d_3_2_Core;
- }
- if (d_3_3_Core && !d_3_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_3_Core->context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- delete d_3_3_Core;
- }
- if (d_4_0_Core && !d_4_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_0_Core->context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- delete d_4_0_Core;
- }
- if (d_4_1_Core && !d_4_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_1_Core->context, QOpenGLFunctions_4_1_CoreBackend::versionStatus());
- delete d_4_1_Core;
- }
- if (d_4_2_Core && !d_4_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_2_Core->context, QOpenGLFunctions_4_2_CoreBackend::versionStatus());
- delete d_4_2_Core;
- }
- if (d_4_3_Core && !d_4_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_3_Core->context, QOpenGLFunctions_4_3_CoreBackend::versionStatus());
- delete d_4_3_Core;
- }
- if (d_4_4_Core && !d_4_4_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_4_Core->context, QOpenGLFunctions_4_4_CoreBackend::versionStatus());
- delete d_4_4_Core;
- }
- if (d_1_0_Deprecated && !d_1_0_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Deprecated->context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- delete d_1_0_Deprecated;
- }
- if (d_1_1_Deprecated && !d_1_1_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Deprecated->context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- delete d_1_1_Deprecated;
- }
- if (d_1_2_Deprecated && !d_1_2_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Deprecated->context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- delete d_1_2_Deprecated;
- }
- if (d_1_3_Deprecated && !d_1_3_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Deprecated->context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- delete d_1_3_Deprecated;
- }
- if (d_1_4_Deprecated && !d_1_4_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Deprecated->context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- delete d_1_4_Deprecated;
- }
- if (d_3_3_Deprecated && !d_3_3_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_3_Deprecated->context, QOpenGLFunctions_3_3_DeprecatedBackend::versionStatus());
- delete d_3_3_Deprecated;
- }
+ if (d_1_0_Core)
+ d_1_0_Core->refs.deref();
+ Q_ASSERT(d_1_0_Core->refs.load());
+ if (d_1_1_Core)
+ d_1_1_Core->refs.deref();
+ Q_ASSERT(d_1_1_Core->refs.load());
+ if (d_1_2_Core)
+ d_1_2_Core->refs.deref();
+ Q_ASSERT(d_1_2_Core->refs.load());
+ if (d_1_3_Core)
+ d_1_3_Core->refs.deref();
+ Q_ASSERT(d_1_3_Core->refs.load());
+ if (d_1_4_Core)
+ d_1_4_Core->refs.deref();
+ Q_ASSERT(d_1_4_Core->refs.load());
+ if (d_1_5_Core)
+ d_1_5_Core->refs.deref();
+ Q_ASSERT(d_1_5_Core->refs.load());
+ if (d_2_0_Core)
+ d_2_0_Core->refs.deref();
+ Q_ASSERT(d_2_0_Core->refs.load());
+ if (d_2_1_Core)
+ d_2_1_Core->refs.deref();
+ Q_ASSERT(d_2_1_Core->refs.load());
+ if (d_3_0_Core)
+ d_3_0_Core->refs.deref();
+ Q_ASSERT(d_3_0_Core->refs.load());
+ if (d_3_1_Core)
+ d_3_1_Core->refs.deref();
+ Q_ASSERT(d_3_1_Core->refs.load());
+ if (d_3_2_Core)
+ d_3_2_Core->refs.deref();
+ Q_ASSERT(d_3_2_Core->refs.load());
+ if (d_3_3_Core)
+ d_3_3_Core->refs.deref();
+ Q_ASSERT(d_3_3_Core->refs.load());
+ if (d_4_0_Core)
+ d_4_0_Core->refs.deref();
+ Q_ASSERT(d_4_0_Core->refs.load());
+ if (d_4_1_Core)
+ d_4_1_Core->refs.deref();
+ Q_ASSERT(d_4_1_Core->refs.load());
+ if (d_4_2_Core)
+ d_4_2_Core->refs.deref();
+ Q_ASSERT(d_4_2_Core->refs.load());
+ if (d_4_3_Core)
+ d_4_3_Core->refs.deref();
+ Q_ASSERT(d_4_3_Core->refs.load());
+ if (d_4_4_Core)
+ d_4_4_Core->refs.deref();
+ Q_ASSERT(d_4_4_Core->refs.load());
+ if (d_1_0_Deprecated)
+ d_1_0_Deprecated->refs.deref();
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ if (d_1_1_Deprecated)
+ d_1_1_Deprecated->refs.deref();
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ if (d_1_2_Deprecated)
+ d_1_2_Deprecated->refs.deref();
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ if (d_1_3_Deprecated)
+ d_1_3_Deprecated->refs.deref();
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ if (d_1_4_Deprecated)
+ d_1_4_Deprecated->refs.deref();
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ if (d_3_3_Deprecated)
+ d_3_3_Deprecated->refs.deref();
+ Q_ASSERT(d_3_3_Deprecated->refs.load());
}
bool QOpenGLFunctions_4_4_Compatibility::initializeOpenGLFunctions()
@@ -205,186 +182,94 @@ bool QOpenGLFunctions_4_4_Compatibility::initializeOpenGLFunctions()
// Function pointers in the backends are resolved at creation time
QOpenGLVersionFunctionsBackend* d = 0;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus(), d);
- }
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus(), d);
- }
d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus(), d);
- }
d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus(), d);
- }
d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus(), d);
- }
d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_5_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus(), d);
- }
d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus(), d);
- }
d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus(), d);
- }
d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus(), d);
- }
d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus(), d);
- }
d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus(), d);
- }
d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus(), d);
- }
d_3_3_Core = static_cast<QOpenGLFunctions_3_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus(), d);
- }
d_4_0_Core = static_cast<QOpenGLFunctions_4_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_1_CoreBackend::versionStatus(), d);
- }
d_4_1_Core = static_cast<QOpenGLFunctions_4_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_2_CoreBackend::versionStatus(), d);
- }
d_4_2_Core = static_cast<QOpenGLFunctions_4_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_3_CoreBackend::versionStatus(), d);
- }
d_4_3_Core = static_cast<QOpenGLFunctions_4_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_4_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_4_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_4_CoreBackend::versionStatus(), d);
- }
d_4_4_Core = static_cast<QOpenGLFunctions_4_4_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus(), d);
- }
d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus(), d);
- }
d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus(), d);
- }
d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus(), d);
- }
d_1_3_Deprecated = static_cast<QOpenGLFunctions_1_3_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus(), d);
- }
d_1_4_Deprecated = static_cast<QOpenGLFunctions_1_4_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_3_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_3_DeprecatedBackend::versionStatus(), d);
- }
d_3_3_Deprecated = static_cast<QOpenGLFunctions_3_3_DeprecatedBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_4_4_core.cpp b/src/gui/opengl/qopenglfunctions_4_4_core.cpp
index dcf57f64b1..95bfc3a438 100644
--- a/src/gui/opengl/qopenglfunctions_4_4_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_4_core.cpp
@@ -89,74 +89,57 @@ QOpenGLFunctions_4_4_Core::QOpenGLFunctions_4_4_Core()
QOpenGLFunctions_4_4_Core::~QOpenGLFunctions_4_4_Core()
{
- if (d_1_0_Core && !d_1_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Core->context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- delete d_1_0_Core;
- }
- if (d_1_1_Core && !d_1_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Core->context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- delete d_1_1_Core;
- }
- if (d_1_2_Core && !d_1_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Core->context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- delete d_1_2_Core;
- }
- if (d_1_3_Core && !d_1_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Core->context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- delete d_1_3_Core;
- }
- if (d_1_4_Core && !d_1_4_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Core->context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- delete d_1_4_Core;
- }
- if (d_1_5_Core && !d_1_5_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_5_Core->context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- delete d_1_5_Core;
- }
- if (d_2_0_Core && !d_2_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_0_Core->context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- delete d_2_0_Core;
- }
- if (d_2_1_Core && !d_2_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_1_Core->context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- delete d_2_1_Core;
- }
- if (d_3_0_Core && !d_3_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_0_Core->context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- delete d_3_0_Core;
- }
- if (d_3_1_Core && !d_3_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_1_Core->context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- delete d_3_1_Core;
- }
- if (d_3_2_Core && !d_3_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_2_Core->context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- delete d_3_2_Core;
- }
- if (d_3_3_Core && !d_3_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_3_Core->context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- delete d_3_3_Core;
- }
- if (d_4_0_Core && !d_4_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_0_Core->context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- delete d_4_0_Core;
- }
- if (d_4_1_Core && !d_4_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_1_Core->context, QOpenGLFunctions_4_1_CoreBackend::versionStatus());
- delete d_4_1_Core;
- }
- if (d_4_2_Core && !d_4_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_2_Core->context, QOpenGLFunctions_4_2_CoreBackend::versionStatus());
- delete d_4_2_Core;
- }
- if (d_4_3_Core && !d_4_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_3_Core->context, QOpenGLFunctions_4_3_CoreBackend::versionStatus());
- delete d_4_3_Core;
- }
- if (d_4_4_Core && !d_4_4_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_4_Core->context, QOpenGLFunctions_4_4_CoreBackend::versionStatus());
- delete d_4_4_Core;
- }
+ if (d_1_0_Core)
+ d_1_0_Core->refs.deref();
+ Q_ASSERT(d_1_0_Core->refs.load());
+ if (d_1_1_Core)
+ d_1_1_Core->refs.deref();
+ Q_ASSERT(d_1_1_Core->refs.load());
+ if (d_1_2_Core)
+ d_1_2_Core->refs.deref();
+ Q_ASSERT(d_1_2_Core->refs.load());
+ if (d_1_3_Core)
+ d_1_3_Core->refs.deref();
+ Q_ASSERT(d_1_3_Core->refs.load());
+ if (d_1_4_Core)
+ d_1_4_Core->refs.deref();
+ Q_ASSERT(d_1_4_Core->refs.load());
+ if (d_1_5_Core)
+ d_1_5_Core->refs.deref();
+ Q_ASSERT(d_1_5_Core->refs.load());
+ if (d_2_0_Core)
+ d_2_0_Core->refs.deref();
+ Q_ASSERT(d_2_0_Core->refs.load());
+ if (d_2_1_Core)
+ d_2_1_Core->refs.deref();
+ Q_ASSERT(d_2_1_Core->refs.load());
+ if (d_3_0_Core)
+ d_3_0_Core->refs.deref();
+ Q_ASSERT(d_3_0_Core->refs.load());
+ if (d_3_1_Core)
+ d_3_1_Core->refs.deref();
+ Q_ASSERT(d_3_1_Core->refs.load());
+ if (d_3_2_Core)
+ d_3_2_Core->refs.deref();
+ Q_ASSERT(d_3_2_Core->refs.load());
+ if (d_3_3_Core)
+ d_3_3_Core->refs.deref();
+ Q_ASSERT(d_3_3_Core->refs.load());
+ if (d_4_0_Core)
+ d_4_0_Core->refs.deref();
+ Q_ASSERT(d_4_0_Core->refs.load());
+ if (d_4_1_Core)
+ d_4_1_Core->refs.deref();
+ Q_ASSERT(d_4_1_Core->refs.load());
+ if (d_4_2_Core)
+ d_4_2_Core->refs.deref();
+ Q_ASSERT(d_4_2_Core->refs.load());
+ if (d_4_3_Core)
+ d_4_3_Core->refs.deref();
+ Q_ASSERT(d_4_3_Core->refs.load());
+ if (d_4_4_Core)
+ d_4_4_Core->refs.deref();
+ Q_ASSERT(d_4_4_Core->refs.load());
}
bool QOpenGLFunctions_4_4_Core::initializeOpenGLFunctions()
@@ -175,138 +158,70 @@ bool QOpenGLFunctions_4_4_Core::initializeOpenGLFunctions()
// Function pointers in the backends are resolved at creation time
QOpenGLVersionFunctionsBackend* d = 0;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus(), d);
- }
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus(), d);
- }
d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus(), d);
- }
d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus(), d);
- }
d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus(), d);
- }
d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_5_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus(), d);
- }
d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus(), d);
- }
d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus(), d);
- }
d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus(), d);
- }
d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus(), d);
- }
d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus(), d);
- }
d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus(), d);
- }
d_3_3_Core = static_cast<QOpenGLFunctions_3_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus(), d);
- }
d_4_0_Core = static_cast<QOpenGLFunctions_4_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_1_CoreBackend::versionStatus(), d);
- }
d_4_1_Core = static_cast<QOpenGLFunctions_4_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_2_CoreBackend::versionStatus(), d);
- }
d_4_2_Core = static_cast<QOpenGLFunctions_4_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_3_CoreBackend::versionStatus(), d);
- }
d_4_3_Core = static_cast<QOpenGLFunctions_4_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_4_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_4_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_4_CoreBackend::versionStatus(), d);
- }
d_4_4_Core = static_cast<QOpenGLFunctions_4_4_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp
index d568d17f56..81ee8559a5 100644
--- a/src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp
@@ -97,106 +97,81 @@ QOpenGLFunctions_4_5_Compatibility::QOpenGLFunctions_4_5_Compatibility()
QOpenGLFunctions_4_5_Compatibility::~QOpenGLFunctions_4_5_Compatibility()
{
- if (d_1_0_Core && !d_1_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Core->context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- delete d_1_0_Core;
- }
- if (d_1_1_Core && !d_1_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Core->context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- delete d_1_1_Core;
- }
- if (d_1_2_Core && !d_1_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Core->context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- delete d_1_2_Core;
- }
- if (d_1_3_Core && !d_1_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Core->context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- delete d_1_3_Core;
- }
- if (d_1_4_Core && !d_1_4_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Core->context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- delete d_1_4_Core;
- }
- if (d_1_5_Core && !d_1_5_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_5_Core->context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- delete d_1_5_Core;
- }
- if (d_2_0_Core && !d_2_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_0_Core->context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- delete d_2_0_Core;
- }
- if (d_2_1_Core && !d_2_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_1_Core->context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- delete d_2_1_Core;
- }
- if (d_3_0_Core && !d_3_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_0_Core->context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- delete d_3_0_Core;
- }
- if (d_3_1_Core && !d_3_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_1_Core->context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- delete d_3_1_Core;
- }
- if (d_3_2_Core && !d_3_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_2_Core->context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- delete d_3_2_Core;
- }
- if (d_3_3_Core && !d_3_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_3_Core->context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- delete d_3_3_Core;
- }
- if (d_4_0_Core && !d_4_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_0_Core->context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- delete d_4_0_Core;
- }
- if (d_4_1_Core && !d_4_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_1_Core->context, QOpenGLFunctions_4_1_CoreBackend::versionStatus());
- delete d_4_1_Core;
- }
- if (d_4_2_Core && !d_4_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_2_Core->context, QOpenGLFunctions_4_2_CoreBackend::versionStatus());
- delete d_4_2_Core;
- }
- if (d_4_3_Core && !d_4_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_3_Core->context, QOpenGLFunctions_4_3_CoreBackend::versionStatus());
- delete d_4_3_Core;
- }
- if (d_4_4_Core && !d_4_4_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_4_Core->context, QOpenGLFunctions_4_4_CoreBackend::versionStatus());
- delete d_4_4_Core;
- }
- if (d_4_5_Core && !d_4_5_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_5_Core->context, QOpenGLFunctions_4_5_CoreBackend::versionStatus());
- delete d_4_5_Core;
- }
- if (d_1_0_Deprecated && !d_1_0_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Deprecated->context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- delete d_1_0_Deprecated;
- }
- if (d_1_1_Deprecated && !d_1_1_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Deprecated->context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- delete d_1_1_Deprecated;
- }
- if (d_1_2_Deprecated && !d_1_2_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Deprecated->context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- delete d_1_2_Deprecated;
- }
- if (d_1_3_Deprecated && !d_1_3_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Deprecated->context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- delete d_1_3_Deprecated;
- }
- if (d_1_4_Deprecated && !d_1_4_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Deprecated->context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- delete d_1_4_Deprecated;
- }
- if (d_3_3_Deprecated && !d_3_3_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_3_Deprecated->context, QOpenGLFunctions_3_3_DeprecatedBackend::versionStatus());
- delete d_3_3_Deprecated;
- }
- if (d_4_5_Deprecated && !d_4_5_Deprecated->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_5_Deprecated->context, QOpenGLFunctions_4_5_DeprecatedBackend::versionStatus());
- delete d_4_5_Deprecated;
- }
+ if (d_1_0_Core)
+ d_1_0_Core->refs.deref();
+ Q_ASSERT(d_1_0_Core->refs.load());
+ if (d_1_1_Core)
+ d_1_1_Core->refs.deref();
+ Q_ASSERT(d_1_1_Core->refs.load());
+ if (d_1_2_Core)
+ d_1_2_Core->refs.deref();
+ Q_ASSERT(d_1_2_Core->refs.load());
+ if (d_1_3_Core)
+ d_1_3_Core->refs.deref();
+ Q_ASSERT(d_1_3_Core->refs.load());
+ if (d_1_4_Core)
+ d_1_4_Core->refs.deref();
+ Q_ASSERT(d_1_4_Core->refs.load());
+ if (d_1_5_Core)
+ d_1_5_Core->refs.deref();
+ Q_ASSERT(d_1_5_Core->refs.load());
+ if (d_2_0_Core)
+ d_2_0_Core->refs.deref();
+ Q_ASSERT(d_2_0_Core->refs.load());
+ if (d_2_1_Core)
+ d_2_1_Core->refs.deref();
+ Q_ASSERT(d_2_1_Core->refs.load());
+ if (d_3_0_Core)
+ d_3_0_Core->refs.deref();
+ Q_ASSERT(d_3_0_Core->refs.load());
+ if (d_3_1_Core)
+ d_3_1_Core->refs.deref();
+ Q_ASSERT(d_3_1_Core->refs.load());
+ if (d_3_2_Core)
+ d_3_2_Core->refs.deref();
+ Q_ASSERT(d_3_2_Core->refs.load());
+ if (d_3_3_Core)
+ d_3_3_Core->refs.deref();
+ Q_ASSERT(d_3_3_Core->refs.load());
+ if (d_4_0_Core)
+ d_4_0_Core->refs.deref();
+ Q_ASSERT(d_4_0_Core->refs.load());
+ if (d_4_1_Core)
+ d_4_1_Core->refs.deref();
+ Q_ASSERT(d_4_1_Core->refs.load());
+ if (d_4_2_Core)
+ d_4_2_Core->refs.deref();
+ Q_ASSERT(d_4_2_Core->refs.load());
+ if (d_4_3_Core)
+ d_4_3_Core->refs.deref();
+ Q_ASSERT(d_4_3_Core->refs.load());
+ if (d_4_4_Core)
+ d_4_4_Core->refs.deref();
+ Q_ASSERT(d_4_4_Core->refs.load());
+ if (d_4_5_Core)
+ d_4_5_Core->refs.deref();
+ Q_ASSERT(d_4_5_Core->refs.load());
+ if (d_1_0_Deprecated)
+ d_1_0_Deprecated->refs.deref();
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ if (d_1_1_Deprecated)
+ d_1_1_Deprecated->refs.deref();
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ if (d_1_2_Deprecated)
+ d_1_2_Deprecated->refs.deref();
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ if (d_1_3_Deprecated)
+ d_1_3_Deprecated->refs.deref();
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ if (d_1_4_Deprecated)
+ d_1_4_Deprecated->refs.deref();
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ if (d_3_3_Deprecated)
+ d_3_3_Deprecated->refs.deref();
+ Q_ASSERT(d_3_3_Deprecated->refs.load());
+ if (d_4_5_Deprecated)
+ d_4_5_Deprecated->refs.deref();
+ Q_ASSERT(d_4_5_Deprecated->refs.load());
}
bool QOpenGLFunctions_4_5_Compatibility::initializeOpenGLFunctions()
@@ -215,202 +190,102 @@ bool QOpenGLFunctions_4_5_Compatibility::initializeOpenGLFunctions()
// Function pointers in the backends are resolved at creation time
QOpenGLVersionFunctionsBackend* d = 0;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus(), d);
- }
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus(), d);
- }
d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus(), d);
- }
d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus(), d);
- }
d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus(), d);
- }
d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_5_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus(), d);
- }
d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus(), d);
- }
d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus(), d);
- }
d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus(), d);
- }
d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus(), d);
- }
d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus(), d);
- }
d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus(), d);
- }
d_3_3_Core = static_cast<QOpenGLFunctions_3_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus(), d);
- }
d_4_0_Core = static_cast<QOpenGLFunctions_4_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_1_CoreBackend::versionStatus(), d);
- }
d_4_1_Core = static_cast<QOpenGLFunctions_4_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_2_CoreBackend::versionStatus(), d);
- }
d_4_2_Core = static_cast<QOpenGLFunctions_4_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_3_CoreBackend::versionStatus(), d);
- }
d_4_3_Core = static_cast<QOpenGLFunctions_4_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_4_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_4_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_4_CoreBackend::versionStatus(), d);
- }
d_4_4_Core = static_cast<QOpenGLFunctions_4_4_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_5_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_5_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_5_CoreBackend::versionStatus(), d);
- }
d_4_5_Core = static_cast<QOpenGLFunctions_4_5_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus(), d);
- }
d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus(), d);
- }
d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus(), d);
- }
d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_DeprecatedBackend::versionStatus(), d);
- }
d_1_3_Deprecated = static_cast<QOpenGLFunctions_1_3_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_DeprecatedBackend::versionStatus(), d);
- }
d_1_4_Deprecated = static_cast<QOpenGLFunctions_1_4_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_3_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_3_DeprecatedBackend::versionStatus(), d);
- }
d_3_3_Deprecated = static_cast<QOpenGLFunctions_3_3_DeprecatedBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_5_DeprecatedBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_5_DeprecatedBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_5_DeprecatedBackend::versionStatus(), d);
- }
d_4_5_Deprecated = static_cast<QOpenGLFunctions_4_5_DeprecatedBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglfunctions_4_5_core.cpp b/src/gui/opengl/qopenglfunctions_4_5_core.cpp
index be08a76a69..2fdb9ef855 100644
--- a/src/gui/opengl/qopenglfunctions_4_5_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_5_core.cpp
@@ -90,78 +90,60 @@ QOpenGLFunctions_4_5_Core::QOpenGLFunctions_4_5_Core()
QOpenGLFunctions_4_5_Core::~QOpenGLFunctions_4_5_Core()
{
- if (d_1_0_Core && !d_1_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_0_Core->context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- delete d_1_0_Core;
- }
- if (d_1_1_Core && !d_1_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_1_Core->context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- delete d_1_1_Core;
- }
- if (d_1_2_Core && !d_1_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_2_Core->context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- delete d_1_2_Core;
- }
- if (d_1_3_Core && !d_1_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_3_Core->context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- delete d_1_3_Core;
- }
- if (d_1_4_Core && !d_1_4_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_4_Core->context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- delete d_1_4_Core;
- }
- if (d_1_5_Core && !d_1_5_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_1_5_Core->context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- delete d_1_5_Core;
- }
- if (d_2_0_Core && !d_2_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_0_Core->context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- delete d_2_0_Core;
- }
- if (d_2_1_Core && !d_2_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_2_1_Core->context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- delete d_2_1_Core;
- }
- if (d_3_0_Core && !d_3_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_0_Core->context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- delete d_3_0_Core;
- }
- if (d_3_1_Core && !d_3_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_1_Core->context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- delete d_3_1_Core;
- }
- if (d_3_2_Core && !d_3_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_2_Core->context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- delete d_3_2_Core;
- }
- if (d_3_3_Core && !d_3_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_3_3_Core->context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- delete d_3_3_Core;
- }
- if (d_4_0_Core && !d_4_0_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_0_Core->context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- delete d_4_0_Core;
- }
- if (d_4_1_Core && !d_4_1_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_1_Core->context, QOpenGLFunctions_4_1_CoreBackend::versionStatus());
- delete d_4_1_Core;
- }
- if (d_4_2_Core && !d_4_2_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_2_Core->context, QOpenGLFunctions_4_2_CoreBackend::versionStatus());
- delete d_4_2_Core;
- }
- if (d_4_3_Core && !d_4_3_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_3_Core->context, QOpenGLFunctions_4_3_CoreBackend::versionStatus());
- delete d_4_3_Core;
- }
- if (d_4_4_Core && !d_4_4_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_4_Core->context, QOpenGLFunctions_4_4_CoreBackend::versionStatus());
- delete d_4_4_Core;
- }
- if (d_4_5_Core && !d_4_5_Core->refs.deref()) {
- QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(d_4_5_Core->context, QOpenGLFunctions_4_5_CoreBackend::versionStatus());
- delete d_4_5_Core;
- }
+ if (d_1_0_Core)
+ d_1_0_Core->refs.deref();
+ Q_ASSERT(d_1_0_Core->refs.load());
+ if (d_1_1_Core)
+ d_1_1_Core->refs.deref();
+ Q_ASSERT(d_1_1_Core->refs.load());
+ if (d_1_2_Core)
+ d_1_2_Core->refs.deref();
+ Q_ASSERT(d_1_2_Core->refs.load());
+ if (d_1_3_Core)
+ d_1_3_Core->refs.deref();
+ Q_ASSERT(d_1_3_Core->refs.load());
+ if (d_1_4_Core)
+ d_1_4_Core->refs.deref();
+ Q_ASSERT(d_1_4_Core->refs.load());
+ if (d_1_5_Core)
+ d_1_5_Core->refs.deref();
+ Q_ASSERT(d_1_5_Core->refs.load());
+ if (d_2_0_Core)
+ d_2_0_Core->refs.deref();
+ Q_ASSERT(d_2_0_Core->refs.load());
+ if (d_2_1_Core)
+ d_2_1_Core->refs.deref();
+ Q_ASSERT(d_2_1_Core->refs.load());
+ if (d_3_0_Core)
+ d_3_0_Core->refs.deref();
+ Q_ASSERT(d_3_0_Core->refs.load());
+ if (d_3_1_Core)
+ d_3_1_Core->refs.deref();
+ Q_ASSERT(d_3_1_Core->refs.load());
+ if (d_3_2_Core)
+ d_3_2_Core->refs.deref();
+ Q_ASSERT(d_3_2_Core->refs.load());
+ if (d_3_3_Core)
+ d_3_3_Core->refs.deref();
+ Q_ASSERT(d_3_3_Core->refs.load());
+ if (d_4_0_Core)
+ d_4_0_Core->refs.deref();
+ Q_ASSERT(d_4_0_Core->refs.load());
+ if (d_4_1_Core)
+ d_4_1_Core->refs.deref();
+ Q_ASSERT(d_4_1_Core->refs.load());
+ if (d_4_2_Core)
+ d_4_2_Core->refs.deref();
+ Q_ASSERT(d_4_2_Core->refs.load());
+ if (d_4_3_Core)
+ d_4_3_Core->refs.deref();
+ Q_ASSERT(d_4_3_Core->refs.load());
+ if (d_4_4_Core)
+ d_4_4_Core->refs.deref();
+ Q_ASSERT(d_4_4_Core->refs.load());
+ if (d_4_5_Core)
+ d_4_5_Core->refs.deref();
+ Q_ASSERT(d_4_5_Core->refs.load());
}
bool QOpenGLFunctions_4_5_Core::initializeOpenGLFunctions()
@@ -180,146 +162,74 @@ bool QOpenGLFunctions_4_5_Core::initializeOpenGLFunctions()
// Function pointers in the backends are resolved at creation time
QOpenGLVersionFunctionsBackend* d = 0;
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus(), d);
- }
d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus(), d);
- }
d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus(), d);
- }
d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_3_CoreBackend::versionStatus(), d);
- }
d_1_3_Core = static_cast<QOpenGLFunctions_1_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_4_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_4_CoreBackend::versionStatus(), d);
- }
d_1_4_Core = static_cast<QOpenGLFunctions_1_4_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_1_5_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_1_5_CoreBackend::versionStatus(), d);
- }
d_1_5_Core = static_cast<QOpenGLFunctions_1_5_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_0_CoreBackend::versionStatus(), d);
- }
d_2_0_Core = static_cast<QOpenGLFunctions_2_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_2_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_2_1_CoreBackend::versionStatus(), d);
- }
d_2_1_Core = static_cast<QOpenGLFunctions_2_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_0_CoreBackend::versionStatus(), d);
- }
d_3_0_Core = static_cast<QOpenGLFunctions_3_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_1_CoreBackend::versionStatus(), d);
- }
d_3_1_Core = static_cast<QOpenGLFunctions_3_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_2_CoreBackend::versionStatus(), d);
- }
d_3_2_Core = static_cast<QOpenGLFunctions_3_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_3_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_3_3_CoreBackend::versionStatus(), d);
- }
d_3_3_Core = static_cast<QOpenGLFunctions_3_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_0_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_0_CoreBackend::versionStatus(), d);
- }
d_4_0_Core = static_cast<QOpenGLFunctions_4_0_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_1_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_1_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_1_CoreBackend::versionStatus(), d);
- }
d_4_1_Core = static_cast<QOpenGLFunctions_4_1_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_2_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_2_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_2_CoreBackend::versionStatus(), d);
- }
d_4_2_Core = static_cast<QOpenGLFunctions_4_2_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_3_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_3_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_3_CoreBackend::versionStatus(), d);
- }
d_4_3_Core = static_cast<QOpenGLFunctions_4_3_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_4_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_4_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_4_CoreBackend::versionStatus(), d);
- }
d_4_4_Core = static_cast<QOpenGLFunctions_4_4_CoreBackend*>(d);
d->refs.ref();
d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_4_5_CoreBackend::versionStatus());
- if (!d) {
- d = new QOpenGLFunctions_4_5_CoreBackend(context);
- QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(context, QOpenGLFunctions_4_5_CoreBackend::versionStatus(), d);
- }
d_4_5_Core = static_cast<QOpenGLFunctions_4_5_CoreBackend*>(d);
d->refs.ref();
diff --git a/src/gui/opengl/qopenglversionfunctions.cpp b/src/gui/opengl/qopenglversionfunctions.cpp
index a5b03315e6..3fba00bc47 100644
--- a/src/gui/opengl/qopenglversionfunctions.cpp
+++ b/src/gui/opengl/qopenglversionfunctions.cpp
@@ -85,23 +85,59 @@ void CLASS::init() \
#define QT_OPENGL_IMPLEMENT_WIN QT_OPENGL_IMPLEMENT
#endif
-QOpenGLVersionFunctionsBackend *QAbstractOpenGLFunctionsPrivate::functionsBackend(QOpenGLContext *context, QOpenGLVersionFunctionsBackend::Version v)
+QOpenGLVersionFunctionsStorage::QOpenGLVersionFunctionsStorage()
+ : backends(0)
{
- Q_ASSERT(context);
- return context->functionsBackend(v);
}
-void QAbstractOpenGLFunctionsPrivate::insertFunctionsBackend(QOpenGLContext *context, QOpenGLVersionFunctionsBackend::Version v,
- QOpenGLVersionFunctionsBackend *backend)
+QOpenGLVersionFunctionsStorage::~QOpenGLVersionFunctionsStorage()
{
- Q_ASSERT(context);
- context->insertFunctionsBackend(v, backend);
+ if (backends) {
+ for (int i = 0; i < QOpenGLVersionFunctionsBackend::OpenGLVersionBackendCount; ++i) {
+ if (backends[i] && !--backends[i]->refs) {
+ // deleting the base class is ok, as the derived classes don't have a destructor
+ delete backends[i];
+ }
+ }
+ delete[] backends;
+ }
+}
+
+QOpenGLVersionFunctionsBackend *QOpenGLVersionFunctionsStorage::backend(QOpenGLContext *context, QOpenGLVersionFunctionsBackend::Version v)
+{
+#ifdef QT_OPENGL_ES
+ Q_UNUSED(context);
+ Q_UNUSED(v);
+ return 0;
+#else
+ if (!backends) {
+ backends = new QOpenGLVersionFunctionsBackend *[QOpenGLVersionFunctionsBackend::OpenGLVersionBackendCount];
+ memset(backends, 0, sizeof(QOpenGLVersionFunctionsBackend *)*QOpenGLVersionFunctionsBackend::OpenGLVersionBackendCount);
+ }
+ if (backends[v])
+ return backends[v];
+
+ switch(v) {
+#define VERSION_ENUM(X) QOpenGLVersionFunctionsBackend::OpenGL_##X
+#define CREATE_BACKEND(X) \
+ case VERSION_ENUM(X): \
+ backends[VERSION_ENUM(X)] = new QOpenGLFunctions_##X##Backend(context); \
+ break;
+ QT_OPENGL_VERSIONS(CREATE_BACKEND)
+ case QOpenGLVersionFunctionsBackend::OpenGLVersionBackendCount:
+ Q_UNREACHABLE();
+ }
+ // the storage keeps one ref
+ ++backends[v]->refs;
+ return backends[v];
+#endif
}
-void QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(QOpenGLContext *context, QOpenGLVersionFunctionsBackend::Version v)
+QOpenGLVersionFunctionsBackend *QAbstractOpenGLFunctionsPrivate::functionsBackend(QOpenGLContext *context, QOpenGLVersionFunctionsBackend::Version v)
{
Q_ASSERT(context);
- context->removeFunctionsBackend(v);
+ QOpenGLVersionFunctionsStorage *storage = context->functionsBackendStorage();
+ return storage->backend(context, v);
}
void QAbstractOpenGLFunctionsPrivate::insertExternalFunctions(QOpenGLContext *context, QAbstractOpenGLFunctions *f)
diff --git a/src/gui/opengl/qopenglversionfunctions.h b/src/gui/opengl/qopenglversionfunctions.h
index 7d2616a5d9..7f991b1955 100644
--- a/src/gui/opengl/qopenglversionfunctions.h
+++ b/src/gui/opengl/qopenglversionfunctions.h
@@ -132,36 +132,41 @@ private: \
class QOpenGLVersionFunctionsBackend
{
public:
+#define QT_OPENGL_VERSIONS(F) \
+ F(1_0_Core) \
+ F(1_1_Core) \
+ F(1_2_Core) \
+ F(1_3_Core) \
+ F(1_4_Core) \
+ F(1_5_Core) \
+ F(2_0_Core) \
+ F(2_1_Core) \
+ F(3_0_Core) \
+ F(3_1_Core) \
+ F(3_2_Core) \
+ F(3_3_Core) \
+ F(4_0_Core) \
+ F(4_1_Core) \
+ F(4_2_Core) \
+ F(4_3_Core) \
+ F(4_4_Core) \
+ F(4_5_Core) \
+ F(1_0_Deprecated) \
+ F(1_1_Deprecated) \
+ F(1_2_Deprecated) \
+ F(1_3_Deprecated) \
+ F(1_4_Deprecated) \
+ F(2_0_Deprecated) \
+ F(3_0_Deprecated) \
+ F(3_3_Deprecated) \
+ F(4_5_Deprecated) \
+
+#define VERSION_ENUM(X) OpenGL_##X,
enum Version {
- OpenGL_1_0,
- OpenGL_1_1,
- OpenGL_1_2,
- OpenGL_1_3,
- OpenGL_1_4,
- OpenGL_1_5,
- OpenGL_2_0,
- OpenGL_2_1,
- OpenGL_3_0,
- OpenGL_3_1,
- OpenGL_3_2_Core,
- OpenGL_3_3_Core,
- OpenGL_4_0_Core,
- OpenGL_4_1_Core,
- OpenGL_4_2_Core,
- OpenGL_4_3_Core,
- OpenGL_4_4_Core,
- OpenGL_4_5_Core,
- OpenGL_1_0_Deprecated,
- OpenGL_1_1_Deprecated,
- OpenGL_1_2_Deprecated,
- OpenGL_1_3_Deprecated,
- OpenGL_1_4_Deprecated,
- OpenGL_2_0_Deprecated,
- OpenGL_3_0_Deprecated,
- OpenGL_3_3_Deprecated,
- OpenGL_4_5_Deprecated,
+ QT_OPENGL_VERSIONS(VERSION_ENUM)
OpenGLVersionBackendCount
};
+#undef VERSION_ENUM
QOpenGLVersionFunctionsBackend(QOpenGLContext *ctx)
: context(ctx)
@@ -171,6 +176,17 @@ public:
QAtomicInt refs;
};
+class QOpenGLVersionFunctionsStorage
+{
+public:
+ QOpenGLVersionFunctionsStorage();
+ ~QOpenGLVersionFunctionsStorage();
+
+ QOpenGLVersionFunctionsBackend *backend(QOpenGLContext *context, QOpenGLVersionFunctionsBackend::Version v);
+
+ QOpenGLVersionFunctionsBackend **backends;
+};
+
class QAbstractOpenGLFunctions;
class QAbstractOpenGLFunctionsPrivate
@@ -182,9 +198,6 @@ public:
{}
static QOpenGLVersionFunctionsBackend *functionsBackend(QOpenGLContext *context, QOpenGLVersionFunctionsBackend::Version v);
- static void insertFunctionsBackend(QOpenGLContext *context, QOpenGLVersionFunctionsBackend::Version v,
- QOpenGLVersionFunctionsBackend *backend);
- static void removeFunctionsBackend(QOpenGLContext *context, QOpenGLVersionFunctionsBackend::Version v);
static void insertExternalFunctions(QOpenGLContext *context, QAbstractOpenGLFunctions *f);
static void removeExternalFunctions(QOpenGLContext *context, QAbstractOpenGLFunctions *f);
@@ -232,7 +245,7 @@ public:
}
Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_1_0; }
+ { return OpenGL_1_0_Core; }
// OpenGL 1.0 core functions
#define QT_OPENGL_1_0_FUNCTIONS(F) \
@@ -298,7 +311,7 @@ public:
}
Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_1_1; }
+ { return OpenGL_1_1_Core; }
// OpenGL 1.1 core functions
#define QT_OPENGL_1_1_FUNCTIONS(F) \
@@ -332,7 +345,7 @@ public:
}
Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_1_2; }
+ { return OpenGL_1_2_Core; }
// OpenGL 1.2 core functions
#define QT_OPENGL_1_2_FUNCTIONS(F) \
@@ -356,7 +369,7 @@ public:
}
Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_1_3; }
+ { return OpenGL_1_3_Core; }
// OpenGL 1.3 core functions
#define QT_OPENGL_1_3_FUNCTIONS(F) \
@@ -383,7 +396,7 @@ public:
}
Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_1_4; }
+ { return OpenGL_1_4_Core; }
// OpenGL 1.4 core functions
#define QT_OPENGL_1_4_FUNCTIONS(F) \
@@ -408,7 +421,7 @@ public:
}
Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_1_5; }
+ { return OpenGL_1_5_Core; }
// OpenGL 1.5 core functions
#define QT_OPENGL_1_5_FUNCTIONS(F) \
@@ -445,7 +458,7 @@ public:
}
Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_2_0; }
+ { return OpenGL_2_0_Core; }
// OpenGL 2.0 core functions
#define QT_OPENGL_2_0_FUNCTIONS(F) \
@@ -556,7 +569,7 @@ public:
}
Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_2_1; }
+ { return OpenGL_2_1_Core; }
// OpenGL 2.1 core functions
#define QT_OPENGL_2_1_FUNCTIONS(F) \
@@ -580,7 +593,7 @@ public:
}
Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_3_0; }
+ { return OpenGL_3_0_Core; }
// OpenGL 3.0 core functions
#define QT_OPENGL_3_0_FUNCTIONS(F) \
@@ -682,7 +695,7 @@ public:
}
Q_DECL_CONSTEXPR static Version versionStatus()
- { return OpenGL_3_1; }
+ { return OpenGL_3_1_Core; }
// OpenGL 3.1 core functions
#define QT_OPENGL_3_1_FUNCTIONS(F) \