summaryrefslogtreecommitdiffstats
path: root/src/core/resources
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2018-03-12 08:32:35 +0100
committerPaul Lemire <paul.lemire@kdab.com>2020-02-05 11:33:49 +0100
commit0e115ff000fb294de8519bf5b39beee0d6bfa605 (patch)
treec66c1f19ad5e4b7fc4f3be7951fa74d1d4df64bb /src/core/resources
parentf1f387c22dac8748a7edb1f4aa1ea6dac7dfbdfd (diff)
Make the OpenGL renderer a plugin
By default the QRenderAspect will try to load this plugin Change-Id: Ie55e207fb8e6d0b64f717bbb99699eb669eaa3f2 Task-number: QTBUG-61151 Reviewed-by: Mike Krus <mike.krus@kdab.com>
Diffstat (limited to 'src/core/resources')
-rw-r--r--src/core/resources/qresourcemanager_p.h39
1 files changed, 9 insertions, 30 deletions
diff --git a/src/core/resources/qresourcemanager_p.h b/src/core/resources/qresourcemanager_p.h
index ba39695a4..6e479d5ef 100644
--- a/src/core/resources/qresourcemanager_p.h
+++ b/src/core/resources/qresourcemanager_p.h
@@ -179,19 +179,7 @@ private:
template <typename T>
struct QResourceInfo
{
- enum
- {
- needsCleanup = false
- };
-};
-
-template <>
-struct QResourceInfo<void>
-{
- enum
- {
- needsCleanup = false
- };
+ static const bool needsCleanup = false;
};
enum
@@ -204,22 +192,10 @@ enum
template<> \
struct QResourceInfo<TYPE > \
{ \
- enum \
-{ \
- needsCleanup = ((FLAGS & Q_REQUIRES_CLEANUP) == 0) \
-}; \
+ static const bool needsCleanup = (FLAGS & Q_REQUIRES_CLEANUP) == 0;\
}; \
} // namespace Qt3DCore
-template <int v>
-struct Int2Type
-{
- enum
- {
- value = v
- };
-};
-
template<typename T>
class QHandleData : public QHandle<T>::Data
{
@@ -275,7 +251,7 @@ public:
typename Handle::Data *d = handle.data_ptr();
d->nextFree = freeList;
freeList = d;
- performCleanup(&static_cast<QHandleData<T> *>(d)->data, Int2Type<QResourceInfo<T>::needsCleanup>());
+ performCleanup(&static_cast<QHandleData<T> *>(d)->data, std::integral_constant<bool, QResourceInfo<T>::needsCleanup>{});
}
T *data(Handle h)
@@ -349,13 +325,16 @@ private:
}
}
- void performCleanup(T *r, Int2Type<true>)
+ template<typename Q = T>
+ void performCleanup(Q *r, std::integral_constant<bool, true>)
{
r->cleanup();
}
- void performCleanup(T *, Int2Type<false>)
- {}
+ template<typename Q = T>
+ void performCleanup(Q *, std::integral_constant<bool, false>)
+ {
+ }
};