summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-09-08 12:18:26 +0200
committerSvenn-Arne Dragly <svenn-arne.dragly@qt.io>2017-12-13 18:53:05 +0000
commitc2e8b0dc4ddaaea9d20175cddea352e39f26896e (patch)
tree6642fe22d1151f7d1466e73f6a2c686c65dee700
parent37d78994de56cd11a06ccd1a777cf0ac8ec8e801 (diff)
Get rid of the INDEXBITS template argument for QHandle
It's not required anymore, as the resource manager can grow as needed. Change-Id: If509de7f2ef90e1af9729d8fc60d7ecb08ede687 Reviewed-by: Svenn-Arne Dragly <svenn-arne.dragly@qt.io> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
-rw-r--r--src/animation/backend/handle_types_p.h10
-rw-r--r--src/animation/backend/managers_p.h15
-rw-r--r--src/core/resources/qhandle_p.h16
-rw-r--r--src/core/resources/qresourcemanager_p.h50
-rw-r--r--src/input/backend/handle_types_p.h32
-rw-r--r--src/input/backend/inputmanagers_p.h48
-rw-r--r--src/logic/handle_types_p.h2
-rw-r--r--src/logic/managers_p.h3
-rw-r--r--src/plugins/renderplugins/scene2d/scene2dplugin.h1
-rw-r--r--src/render/backend/entity_p.h12
-rw-r--r--src/render/backend/handle_types_p.h64
-rw-r--r--src/render/backend/managers_p.h27
-rw-r--r--src/render/backend/renderview.cpp4
-rw-r--r--src/render/framegraph/renderpassfilternode_p.h2
-rw-r--r--src/render/framegraph/techniquefilternode_p.h2
-rw-r--r--src/render/geometry/buffermanager_p.h1
-rw-r--r--src/render/geometry/geometryrenderermanager_p.h1
-rw-r--r--src/render/io/scenemanager.cpp1
-rw-r--r--src/render/io/scenemanager_p.h1
-rw-r--r--src/render/jobs/pickboundingvolumejob.cpp4
-rw-r--r--src/render/jobs/pickboundingvolumeutils.cpp8
-rw-r--r--src/render/materialsystem/techniquemanager_p.h1
-rw-r--r--tests/auto/core/qresourcemanager/tst_qresourcemanager.cpp73
-rw-r--r--tests/benchmarks/core/qresourcesmanager/qresourcesmanager/tst_bench_qresourcesmanager.cpp12
24 files changed, 164 insertions, 226 deletions
diff --git a/src/animation/backend/handle_types_p.h b/src/animation/backend/handle_types_p.h
index f6f77eb20..fbdc5d83f 100644
--- a/src/animation/backend/handle_types_p.h
+++ b/src/animation/backend/handle_types_p.h
@@ -64,11 +64,11 @@ class BlendedClipAnimator;
class ChannelMapping;
class ChannelMapper;
-typedef Qt3DCore::QHandle<AnimationClip, 16> HAnimationClip;
-typedef Qt3DCore::QHandle<ClipAnimator, 16> HClipAnimator;
-typedef Qt3DCore::QHandle<BlendedClipAnimator, 12> HBlendedClipAnimator;
-typedef Qt3DCore::QHandle<ChannelMapping, 16> HChannelMapping;
-typedef Qt3DCore::QHandle<ChannelMapper, 16> HChannelMapper;
+typedef Qt3DCore::QHandle<AnimationClip> HAnimationClip;
+typedef Qt3DCore::QHandle<ClipAnimator> HClipAnimator;
+typedef Qt3DCore::QHandle<BlendedClipAnimator> HBlendedClipAnimator;
+typedef Qt3DCore::QHandle<ChannelMapping> HChannelMapping;
+typedef Qt3DCore::QHandle<ChannelMapper> HChannelMapper;
} // namespace Animation
} // namespace Qt3DAnimation
diff --git a/src/animation/backend/managers_p.h b/src/animation/backend/managers_p.h
index 3c670a8d2..68d4c67ff 100644
--- a/src/animation/backend/managers_p.h
+++ b/src/animation/backend/managers_p.h
@@ -69,8 +69,7 @@ class ClipBlendNode;
class AnimationClipLoaderManager : public Qt3DCore::QResourceManager<
AnimationClip,
- Qt3DCore::QNodeId,
- 16>
+ Qt3DCore::QNodeId>
{
public:
AnimationClipLoaderManager() {}
@@ -78,8 +77,7 @@ public:
class ClipAnimatorManager : public Qt3DCore::QResourceManager<
ClipAnimator,
- Qt3DCore::QNodeId,
- 16>
+ Qt3DCore::QNodeId>
{
public:
ClipAnimatorManager() {}
@@ -87,8 +85,7 @@ public:
class BlendedClipAnimatorManager : public Qt3DCore::QResourceManager<
BlendedClipAnimator,
- Qt3DCore::QNodeId,
- 12>
+ Qt3DCore::QNodeId>
{
public:
BlendedClipAnimatorManager() {}
@@ -96,8 +93,7 @@ public:
class ChannelMappingManager : public Qt3DCore::QResourceManager<
ChannelMapping,
- Qt3DCore::QNodeId,
- 16>
+ Qt3DCore::QNodeId>
{
public:
ChannelMappingManager() {}
@@ -105,8 +101,7 @@ public:
class ChannelMapperManager : public Qt3DCore::QResourceManager<
ChannelMapper,
- Qt3DCore::QNodeId,
- 16>
+ Qt3DCore::QNodeId>
{
public:
ChannelMapperManager() {}
diff --git a/src/core/resources/qhandle_p.h b/src/core/resources/qhandle_p.h
index 95483d197..46bd5f5d4 100644
--- a/src/core/resources/qhandle_p.h
+++ b/src/core/resources/qhandle_p.h
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DCore {
-template <typename T, uint INDEXBITS = 16>
+template <typename T>
class QHandle
{
public:
@@ -106,8 +106,8 @@ private:
};
-template <typename T, uint INDEXBITS>
-QDebug operator<<(QDebug dbg, const QHandle<T, INDEXBITS> &h)
+template <typename T>
+QDebug operator<<(QDebug dbg, const QHandle<T> &h)
{
QDebugStateSaver saver(dbg);
QString binNumber = QString::number(h.handle(), 2).rightJustified(32, QChar::fromLatin1('0'));
@@ -116,8 +116,8 @@ QDebug operator<<(QDebug dbg, const QHandle<T, INDEXBITS> &h)
return dbg;
}
-template <typename T, uint INDEXBITS = 16>
-uint qHash(const QHandle<T, INDEXBITS> &h, uint seed)
+template <typename T>
+uint qHash(const QHandle<T> &h, uint seed)
{
using QT_PREPEND_NAMESPACE(qHash);
return qHash(h.handle(), seed);
@@ -126,9 +126,9 @@ uint qHash(const QHandle<T, INDEXBITS> &h, uint seed)
} // Qt3DCore
// simpler than fighting the Q_DECLARE_TYPEINFO macro, use QString as a dummy to get movable semantics
-template <typename T, uint I>
-class QTypeInfo<Qt3DCore::QHandle<T,I> >
- : public QTypeInfoMerger<Qt3DCore::QHandle<T,I>, QString> {};
+template <typename T>
+class QTypeInfo<Qt3DCore::QHandle<T> >
+ : public QTypeInfoMerger<Qt3DCore::QHandle<T>, QString> {};
QT_END_NAMESPACE
diff --git a/src/core/resources/qresourcemanager_p.h b/src/core/resources/qresourcemanager_p.h
index 8f0440498..0ed86ef21 100644
--- a/src/core/resources/qresourcemanager_p.h
+++ b/src/core/resources/qresourcemanager_p.h
@@ -220,24 +220,24 @@ struct Int2Type
};
};
-template<typename T, uint INDEXBITS = 16>
-class QHandleData : public QHandle<T, INDEXBITS>::Data
+template<typename T>
+class QHandleData : public QHandle<T>::Data
{
public:
T data;
};
-template<typename T, uint INDEXBITS>
-inline T *QHandle<T, INDEXBITS>::operator->() const { return (d && counter == d->counter) ? &static_cast<QHandleData<T, INDEXBITS> *>(d)->data : nullptr; }
-template<typename T, uint INDEXBITS>
-inline T *QHandle<T, INDEXBITS>::data() const { return (d && counter == d->counter) ? &static_cast<QHandleData<T, INDEXBITS> *>(d)->data : nullptr; }
+template<typename T>
+inline T *QHandle<T>::operator->() const { return (d && counter == d->counter) ? &static_cast<QHandleData<T> *>(d)->data : nullptr; }
+template<typename T>
+inline T *QHandle<T>::data() const { return (d && counter == d->counter) ? &static_cast<QHandleData<T> *>(d)->data : nullptr; }
-template <typename T, uint INDEXBITS = 16>
+template <typename T>
class ArrayAllocatingPolicy
{
public:
- typedef QHandleData<T, INDEXBITS> HandleData;
- typedef QHandle<T, INDEXBITS> Handle;
+ typedef QHandleData<T> HandleData;
+ typedef QHandle<T> Handle;
ArrayAllocatingPolicy()
{
}
@@ -267,7 +267,7 @@ public:
typename Handle::Data *d = handle.data_ptr();
d->nextFree = freeList;
freeList = d;
- performCleanup(&static_cast<QHandleData<T, INDEXBITS> *>(d)->data, Int2Type<QResourceInfo<T>::needsCleanup>());
+ performCleanup(&static_cast<QHandleData<T> *>(d)->data, Int2Type<QResourceInfo<T>::needsCleanup>());
}
T *data(Handle h) {
@@ -340,31 +340,30 @@ private:
};
#ifndef QT_NO_DEBUG_STREAM
-template <typename ValueType, typename KeyType, uint INDEXBITS,
+template <typename ValueType, typename KeyType,
template <class> class LockingPolicy
>
class QResourceManager;
-template <typename ValueType, typename KeyType, uint INDEXBITS = 16,
+template <typename ValueType, typename KeyType,
template <class> class LockingPolicy = NonLockingPolicy
>
-QDebug operator<<(QDebug dbg, const QResourceManager<ValueType, KeyType, INDEXBITS, LockingPolicy> &manager);
+QDebug operator<<(QDebug dbg, const QResourceManager<ValueType, KeyType, LockingPolicy> &manager);
#endif
-template <typename ValueType, typename KeyType, uint INDEXBITS = 16,
+template <typename ValueType, typename KeyType,
template <class> class LockingPolicy = NonLockingPolicy
>
class QResourceManager
- : public ArrayAllocatingPolicy<ValueType, INDEXBITS>
- , public LockingPolicy< QResourceManager<ValueType, KeyType, INDEXBITS, LockingPolicy> >
+ : public ArrayAllocatingPolicy<ValueType>
+ , public LockingPolicy< QResourceManager<ValueType, KeyType, LockingPolicy> >
{
public:
- typedef ArrayAllocatingPolicy<ValueType, INDEXBITS> Allocator;
- typedef QHandle<ValueType, INDEXBITS> Handle;
+ typedef ArrayAllocatingPolicy<ValueType> Allocator;
+ typedef QHandle<ValueType> Handle;
QResourceManager() :
- Allocator(),
- m_maxSize((1 << INDEXBITS) - 1)
+ Allocator()
{
}
@@ -443,24 +442,21 @@ public:
Allocator::releaseResource(handle);
}
- int maximumSize() const { return m_maxSize; }
-
protected:
QHash<KeyType, Handle > m_keyToHandleMap;
- const int m_maxSize;
private:
- friend QDebug operator<< <>(QDebug dbg, const QResourceManager<ValueType, KeyType, INDEXBITS, LockingPolicy> &manager);
+ friend QDebug operator<< <>(QDebug dbg, const QResourceManager<ValueType, KeyType, LockingPolicy> &manager);
};
#ifndef QT_NO_DEBUG_STREAM
-template <typename ValueType, typename KeyType, uint INDEXBITS,
+template <typename ValueType, typename KeyType,
template <class> class LockingPolicy
>
-QDebug operator<<(QDebug dbg, const QResourceManager<ValueType, KeyType, INDEXBITS, LockingPolicy> &manager)
+QDebug operator<<(QDebug dbg, const QResourceManager<ValueType, KeyType, LockingPolicy> &manager)
{
QDebugStateSaver saver(dbg);
- dbg << "Contains" << manager.count() << "items" << "of a maximum" << manager.maximumSize() << endl;
+ dbg << "Contains" << manager.count() << "items" << endl;
dbg << "Key to Handle Map:" << endl;
const auto end = manager.m_keyToHandleMap.cend();
diff --git a/src/input/backend/handle_types_p.h b/src/input/backend/handle_types_p.h
index c132fdc99..cfe4e66b4 100644
--- a/src/input/backend/handle_types_p.h
+++ b/src/input/backend/handle_types_p.h
@@ -75,22 +75,22 @@ class GenericDeviceBackendNode;
class PhysicalDeviceProxy;
class AxisAccumulator;
-typedef Qt3DCore::QHandle<KeyboardDevice, 8> HKeyboardDevice;
-typedef Qt3DCore::QHandle<KeyboardHandler, 16> HKeyboardHandler;
-typedef Qt3DCore::QHandle<MouseHandler, 16> HMouseHandler;
-typedef Qt3DCore::QHandle<MouseDevice, 8> HMouseDevice;
-typedef Qt3DCore::QHandle<Axis, 16> HAxis;
-typedef Qt3DCore::QHandle<AxisActionHandler, 16> HAxisActionHandler;
-typedef Qt3DCore::QHandle<AxisSetting, 16> HAxisSetting;
-typedef Qt3DCore::QHandle<Action, 16> HAction;
-typedef Qt3DCore::QHandle<AbstractAxisInput, 16> HAxisInput;
-typedef Qt3DCore::QHandle<ActionInput, 16> HActionInput;
-typedef Qt3DCore::QHandle<InputSequence, 16> HInputSequence;
-typedef Qt3DCore::QHandle<InputChord, 16> HInputChord;
-typedef Qt3DCore::QHandle<LogicalDevice, 16> HLogicalDevice;
-typedef Qt3DCore::QHandle<GenericDeviceBackendNode, 8> HGenericDeviceBackendNode;
-typedef Qt3DCore::QHandle<PhysicalDeviceProxy, 16> HPhysicalDeviceProxy;
-typedef Qt3DCore::QHandle<AxisAccumulator, 16> HAxisAccumulator;
+typedef Qt3DCore::QHandle<KeyboardDevice> HKeyboardDevice;
+typedef Qt3DCore::QHandle<KeyboardHandler> HKeyboardHandler;
+typedef Qt3DCore::QHandle<MouseHandler> HMouseHandler;
+typedef Qt3DCore::QHandle<MouseDevice> HMouseDevice;
+typedef Qt3DCore::QHandle<Axis> HAxis;
+typedef Qt3DCore::QHandle<AxisActionHandler> HAxisActionHandler;
+typedef Qt3DCore::QHandle<AxisSetting> HAxisSetting;
+typedef Qt3DCore::QHandle<Action> HAction;
+typedef Qt3DCore::QHandle<AbstractAxisInput> HAxisInput;
+typedef Qt3DCore::QHandle<ActionInput> HActionInput;
+typedef Qt3DCore::QHandle<InputSequence> HInputSequence;
+typedef Qt3DCore::QHandle<InputChord> HInputChord;
+typedef Qt3DCore::QHandle<LogicalDevice> HLogicalDevice;
+typedef Qt3DCore::QHandle<GenericDeviceBackendNode> HGenericDeviceBackendNode;
+typedef Qt3DCore::QHandle<PhysicalDeviceProxy> HPhysicalDeviceProxy;
+typedef Qt3DCore::QHandle<AxisAccumulator> HAxisAccumulator;
} // namespace Input
} // namespace Qt3DInput
diff --git a/src/input/backend/inputmanagers_p.h b/src/input/backend/inputmanagers_p.h
index 956b0ab8b..eee8b27d3 100644
--- a/src/input/backend/inputmanagers_p.h
+++ b/src/input/backend/inputmanagers_p.h
@@ -79,8 +79,7 @@ namespace Input {
class KeyboardInputManager : public Qt3DCore::QResourceManager<
KeyboardHandler,
- Qt3DCore::QNodeId,
- 16>
+ Qt3DCore::QNodeId>
{
public:
KeyboardInputManager() {}
@@ -88,8 +87,7 @@ public:
class KeyboardDeviceManager : public Qt3DCore::QResourceManager<
KeyboardDevice,
- Qt3DCore::QNodeId,
- 8>
+ Qt3DCore::QNodeId>
{
public:
KeyboardDeviceManager() {}
@@ -97,8 +95,7 @@ public:
class MouseDeviceManager : public Qt3DCore::QResourceManager<
MouseDevice,
- Qt3DCore::QNodeId,
- 8>
+ Qt3DCore::QNodeId>
{
public:
MouseDeviceManager() {}
@@ -106,8 +103,7 @@ public:
class MouseInputManager : public Qt3DCore::QResourceManager<
MouseHandler,
- Qt3DCore::QNodeId,
- 16>
+ Qt3DCore::QNodeId>
{
public:
MouseInputManager() {}
@@ -115,8 +111,7 @@ public:
class AxisManager : public Qt3DCore::QResourceManager<
Axis,
- Qt3DCore::QNodeId,
- 16>
+ Qt3DCore::QNodeId>
{
public:
AxisManager() {}
@@ -124,8 +119,7 @@ public:
class AxisSettingManager : public Qt3DCore::QResourceManager<
AxisSetting,
- Qt3DCore::QNodeId,
- 16>
+ Qt3DCore::QNodeId>
{
public:
AxisSettingManager() {}
@@ -133,8 +127,7 @@ public:
class ActionManager : public Qt3DCore::QResourceManager<
Action,
- Qt3DCore::QNodeId,
- 16>
+ Qt3DCore::QNodeId>
{
public:
ActionManager() {}
@@ -142,8 +135,7 @@ public:
class ActionInputManager : public Qt3DCore::QResourceManager<
ActionInput,
- Qt3DCore::QNodeId,
- 16>
+ Qt3DCore::QNodeId>
{
public:
ActionInputManager() {}
@@ -151,8 +143,7 @@ public:
class AnalogAxisInputManager : public Qt3DCore::QResourceManager<
AnalogAxisInput,
- Qt3DCore::QNodeId,
- 16>
+ Qt3DCore::QNodeId>
{
public:
AnalogAxisInputManager() {}
@@ -160,8 +151,7 @@ public:
class ButtonAxisInputManager : public Qt3DCore::QResourceManager<
ButtonAxisInput,
- Qt3DCore::QNodeId,
- 16>
+ Qt3DCore::QNodeId>
{
public:
ButtonAxisInputManager() {}
@@ -169,8 +159,7 @@ public:
class InputChordManager : public Qt3DCore::QResourceManager<
InputChord,
- Qt3DCore::QNodeId,
- 16>
+ Qt3DCore::QNodeId>
{
public:
InputChordManager() {}
@@ -178,8 +167,7 @@ public:
class InputSequenceManager : public Qt3DCore::QResourceManager<
InputSequence,
- Qt3DCore::QNodeId,
- 16>
+ Qt3DCore::QNodeId>
{
public:
InputSequenceManager() {}
@@ -187,8 +175,7 @@ public:
class LogicalDeviceManager : public Qt3DCore::QResourceManager<
LogicalDevice,
- Qt3DCore::QNodeId,
- 16>
+ Qt3DCore::QNodeId>
{
public:
LogicalDeviceManager() {}
@@ -203,8 +190,7 @@ private:
class GenericDeviceBackendNodeManager : public Qt3DCore::QResourceManager<
GenericDeviceBackendNode,
- Qt3DCore::QNodeId,
- 8>
+ Qt3DCore::QNodeId>
{
public:
GenericDeviceBackendNodeManager() {}
@@ -212,8 +198,7 @@ public:
class Q_AUTOTEST_EXPORT PhysicalDeviceProxyManager : public Qt3DCore::QResourceManager<
PhysicalDeviceProxy,
- Qt3DCore::QNodeId,
- 16>
+ Qt3DCore::QNodeId>
{
public:
PhysicalDeviceProxyManager() {}
@@ -227,8 +212,7 @@ private:
class AxisAccumulatorManager : public Qt3DCore::QResourceManager<
AxisAccumulator,
- Qt3DCore::QNodeId,
- 16>
+ Qt3DCore::QNodeId>
{
public:
AxisAccumulatorManager() {}
diff --git a/src/logic/handle_types_p.h b/src/logic/handle_types_p.h
index d137a4047..106241e2c 100644
--- a/src/logic/handle_types_p.h
+++ b/src/logic/handle_types_p.h
@@ -59,7 +59,7 @@ namespace Qt3DLogic {
namespace Logic {
class Handler;
-typedef Qt3DCore::QHandle<Handler, 16> HHandler;
+typedef Qt3DCore::QHandle<Handler> HHandler;
} // namespace Logic
} // namespace Qt3DLogic
diff --git a/src/logic/managers_p.h b/src/logic/managers_p.h
index 3d48aab24..17c230d28 100644
--- a/src/logic/managers_p.h
+++ b/src/logic/managers_p.h
@@ -64,8 +64,7 @@ namespace Logic {
class HandlerManager : public Qt3DCore::QResourceManager<
Handler,
- Qt3DCore::QNodeId,
- 16>
+ Qt3DCore::QNodeId>
{
public:
HandlerManager() {}
diff --git a/src/plugins/renderplugins/scene2d/scene2dplugin.h b/src/plugins/renderplugins/scene2d/scene2dplugin.h
index 3b4471d55..5f39615af 100644
--- a/src/plugins/renderplugins/scene2d/scene2dplugin.h
+++ b/src/plugins/renderplugins/scene2d/scene2dplugin.h
@@ -67,7 +67,6 @@ class Scene2DNode;
class Scene2DNodeManager : public Qt3DCore::QResourceManager<
Render::Quick::Scene2D,
Qt3DCore::QNodeId,
- 16,
Qt3DCore::ObjectLevelLockingPolicy>
{
};
diff --git a/src/render/backend/entity_p.h b/src/render/backend/entity_p.h
index 4619314ad..8bb65280a 100644
--- a/src/render/backend/entity_p.h
+++ b/src/render/backend/entity_p.h
@@ -120,16 +120,16 @@ public:
void setTreeEnabled(bool enabled) { m_treeEnabled = enabled; }
bool isTreeEnabled() const { return m_treeEnabled; }
- template<class Backend, uint INDEXBITS>
- Qt3DCore::QHandle<Backend, INDEXBITS> componentHandle() const
+ template<class Backend>
+ Qt3DCore::QHandle<Backend> componentHandle() const
{
- return Qt3DCore::QHandle<Backend, INDEXBITS>();
+ return Qt3DCore::QHandle<Backend>();
}
- template<class Backend, uint INDEXBITS>
- QVector<Qt3DCore::QHandle<Backend, INDEXBITS> > componentsHandle() const
+ template<class Backend>
+ QVector<Qt3DCore::QHandle<Backend> > componentsHandle() const
{
- return QVector<Qt3DCore::QHandle<Backend, INDEXBITS> >();
+ return QVector<Qt3DCore::QHandle<Backend> >();
}
template<class Backend>
diff --git a/src/render/backend/handle_types_p.h b/src/render/backend/handle_types_p.h
index 352519e75..9e3d6d522 100644
--- a/src/render/backend/handle_types_p.h
+++ b/src/render/backend/handle_types_p.h
@@ -95,38 +95,38 @@ class ComputeCommand;
class GLBuffer;
class RenderStateNode;
-typedef Qt3DCore::QHandle<RenderTargetOutput, 16> HAttachment;
-typedef Qt3DCore::QHandle<CameraLens, 8> HCamera;
-typedef Qt3DCore::QHandle<FilterKey, 16> HFilterKey;
-typedef Qt3DCore::QHandle<Effect, 16> HEffect;
-typedef Qt3DCore::QHandle<Entity, 16> HEntity;
-typedef Qt3DCore::QHandle<FrameGraphNode *, 8> HFrameGraphNode;
-typedef Qt3DCore::QHandle<Layer, 16> HLayer;
-typedef Qt3DCore::QHandle<LevelOfDetail, 16> HLevelOfDetail;
-typedef Qt3DCore::QHandle<Material, 16> HMaterial;
-typedef Qt3DCore::QHandle<QMatrix4x4, 16> HMatrix;
-typedef Qt3DCore::QHandle<OpenGLVertexArrayObject, 16> HVao;
-typedef Qt3DCore::QHandle<Shader, 16> HShader;
-typedef Qt3DCore::QHandle<Technique, 16> HTechnique;
-typedef Qt3DCore::QHandle<Texture, 16> HTexture;
-typedef Qt3DCore::QHandle<Transform, 16> HTransform;
-typedef Qt3DCore::QHandle<RenderTarget, 8> HTarget;
-typedef Qt3DCore::QHandle<RenderPass, 16> HRenderPass;
-typedef Qt3DCore::QHandle<QTextureImageData, 16> HTextureData;
-typedef Qt3DCore::QHandle<Parameter, 16> HParameter;
-typedef Qt3DCore::QHandle<ShaderData, 16> HShaderData;
-typedef Qt3DCore::QHandle<TextureImage, 16> HTextureImage;
-typedef Qt3DCore::QHandle<Buffer, 16> HBuffer;
-typedef Qt3DCore::QHandle<Attribute, 20> HAttribute;
-typedef Qt3DCore::QHandle<Geometry, 16> HGeometry;
-typedef Qt3DCore::QHandle<GeometryRenderer, 16> HGeometryRenderer;
-typedef Qt3DCore::QHandle<ObjectPicker, 16> HObjectPicker;
-typedef Qt3DCore::QHandle<BoundingVolumeDebug, 16> HBoundingVolumeDebug;
-typedef Qt3DCore::QHandle<Light, 16> HLight;
-typedef Qt3DCore::QHandle<EnvironmentLight, 16> HEnvironmentLight;
-typedef Qt3DCore::QHandle<ComputeCommand, 16> HComputeCommand;
-typedef Qt3DCore::QHandle<GLBuffer, 16> HGLBuffer;
-typedef Qt3DCore::QHandle<RenderStateNode, 16> HRenderState;
+typedef Qt3DCore::QHandle<RenderTargetOutput> HAttachment;
+typedef Qt3DCore::QHandle<CameraLens> HCamera;
+typedef Qt3DCore::QHandle<FilterKey> HFilterKey;
+typedef Qt3DCore::QHandle<Effect> HEffect;
+typedef Qt3DCore::QHandle<Entity> HEntity;
+typedef Qt3DCore::QHandle<FrameGraphNode *> HFrameGraphNode;
+typedef Qt3DCore::QHandle<Layer> HLayer;
+typedef Qt3DCore::QHandle<LevelOfDetail> HLevelOfDetail;
+typedef Qt3DCore::QHandle<Material> HMaterial;
+typedef Qt3DCore::QHandle<QMatrix4x4> HMatrix;
+typedef Qt3DCore::QHandle<OpenGLVertexArrayObject> HVao;
+typedef Qt3DCore::QHandle<Shader> HShader;
+typedef Qt3DCore::QHandle<Technique> HTechnique;
+typedef Qt3DCore::QHandle<Texture> HTexture;
+typedef Qt3DCore::QHandle<Transform> HTransform;
+typedef Qt3DCore::QHandle<RenderTarget> HTarget;
+typedef Qt3DCore::QHandle<RenderPass> HRenderPass;
+typedef Qt3DCore::QHandle<QTextureImageData> HTextureData;
+typedef Qt3DCore::QHandle<Parameter> HParameter;
+typedef Qt3DCore::QHandle<ShaderData> HShaderData;
+typedef Qt3DCore::QHandle<TextureImage> HTextureImage;
+typedef Qt3DCore::QHandle<Buffer> HBuffer;
+typedef Qt3DCore::QHandle<Attribute> HAttribute;
+typedef Qt3DCore::QHandle<Geometry> HGeometry;
+typedef Qt3DCore::QHandle<GeometryRenderer> HGeometryRenderer;
+typedef Qt3DCore::QHandle<ObjectPicker> HObjectPicker;
+typedef Qt3DCore::QHandle<BoundingVolumeDebug> HBoundingVolumeDebug;
+typedef Qt3DCore::QHandle<Light> HLight;
+typedef Qt3DCore::QHandle<EnvironmentLight> HEnvironmentLight;
+typedef Qt3DCore::QHandle<ComputeCommand> HComputeCommand;
+typedef Qt3DCore::QHandle<GLBuffer> HGLBuffer;
+typedef Qt3DCore::QHandle<RenderStateNode> HRenderState;
} // namespace Render
diff --git a/src/render/backend/managers_p.h b/src/render/backend/managers_p.h
index c5af93b8d..3be7e31b4 100644
--- a/src/render/backend/managers_p.h
+++ b/src/render/backend/managers_p.h
@@ -89,7 +89,6 @@ namespace Render {
class AttachmentManager : public Qt3DCore::QResourceManager<
RenderTargetOutput,
Qt3DCore::QNodeId,
- 16,
Qt3DCore::NonLockingPolicy>
{
public:
@@ -99,7 +98,6 @@ public:
class CameraManager : public Qt3DCore::QResourceManager<
CameraLens,
Qt3DCore::QNodeId,
- 8,
Qt3DCore::NonLockingPolicy>
{
public:
@@ -109,7 +107,6 @@ public:
class FilterKeyManager : public Qt3DCore::QResourceManager<
FilterKey,
Qt3DCore::QNodeId,
- 16,
Qt3DCore::NonLockingPolicy>
{
@@ -120,7 +117,6 @@ public:
class EffectManager : public Qt3DCore::QResourceManager<
Effect,
Qt3DCore::QNodeId,
- 16,
Qt3DCore::NonLockingPolicy>
{
public:
@@ -130,7 +126,6 @@ public:
class Q_AUTOTEST_EXPORT EntityManager : public Qt3DCore::QResourceManager<
Entity,
Qt3DCore::QNodeId,
- 16,
Qt3DCore::NonLockingPolicy>
{
public:
@@ -164,7 +159,6 @@ private:
class LayerManager : public Qt3DCore::QResourceManager<
Layer,
Qt3DCore::QNodeId,
- 16,
Qt3DCore::NonLockingPolicy>
{
public:
@@ -174,7 +168,6 @@ public:
class LevelOfDetailManager : public Qt3DCore::QResourceManager<
LevelOfDetail,
Qt3DCore::QNodeId,
- 16,
Qt3DCore::NonLockingPolicy>
{
public:
@@ -184,7 +177,6 @@ public:
class MaterialManager : public Qt3DCore::QResourceManager<
Material,
Qt3DCore::QNodeId,
- 16,
Qt3DCore::NonLockingPolicy>
{
public:
@@ -194,7 +186,6 @@ public:
class MatrixManager : public Qt3DCore::QResourceManager<
QMatrix4x4,
Qt3DCore::QNodeId,
- 16,
Qt3DCore::NonLockingPolicy>
{
public:
@@ -204,7 +195,6 @@ public:
class ShaderManager : public Qt3DCore::QResourceManager<
Shader,
Qt3DCore::QNodeId,
- 16,
Qt3DCore::NonLockingPolicy>
{
public:
@@ -214,7 +204,6 @@ public:
class TextureManager : public Qt3DCore::QResourceManager<
Texture,
Qt3DCore::QNodeId,
- 16,
Qt3DCore::NonLockingPolicy>
{
public:
@@ -239,7 +228,6 @@ private:
class TransformManager : public Qt3DCore::QResourceManager<
Transform,
Qt3DCore::QNodeId,
- 16,
Qt3DCore::NonLockingPolicy>
{
public:
@@ -249,7 +237,6 @@ public:
class VAOManager : public Qt3DCore::QResourceManager<
OpenGLVertexArrayObject,
VAOIdentifier,
- 16,
Qt3DCore::NonLockingPolicy>
{
public:
@@ -259,7 +246,6 @@ public:
class RenderTargetManager : public Qt3DCore::QResourceManager<
RenderTarget,
Qt3DCore::QNodeId,
- 8,
Qt3DCore::NonLockingPolicy>
{
public:
@@ -269,7 +255,6 @@ public:
class RenderPassManager : public Qt3DCore::QResourceManager<
RenderPass,
Qt3DCore::QNodeId,
- 16,
Qt3DCore::NonLockingPolicy>
{
public:
@@ -280,7 +265,6 @@ public:
class ParameterManager : public Qt3DCore::QResourceManager<
Parameter,
Qt3DCore::QNodeId,
- 16,
Qt3DCore::NonLockingPolicy>
{
public:
@@ -290,7 +274,6 @@ public:
class ShaderDataManager : public Qt3DCore::QResourceManager<
ShaderData,
Qt3DCore::QNodeId,
- 16,
Qt3DCore::NonLockingPolicy>
{
public:
@@ -300,7 +283,6 @@ public:
class GLBufferManager : public Qt3DCore::QResourceManager<
GLBuffer,
Qt3DCore::QNodeId,
- 16,
Qt3DCore::NonLockingPolicy>
{
};
@@ -308,7 +290,6 @@ class GLBufferManager : public Qt3DCore::QResourceManager<
class TextureImageManager : public Qt3DCore::QResourceManager<
TextureImage,
Qt3DCore::QNodeId,
- 16,
Qt3DCore::NonLockingPolicy>
{
};
@@ -316,7 +297,6 @@ class TextureImageManager : public Qt3DCore::QResourceManager<
class AttributeManager : public Qt3DCore::QResourceManager<
Attribute,
Qt3DCore::QNodeId,
- 20,
Qt3DCore::NonLockingPolicy>
{
};
@@ -324,7 +304,6 @@ class AttributeManager : public Qt3DCore::QResourceManager<
class GeometryManager : public Qt3DCore::QResourceManager<
Geometry,
Qt3DCore::QNodeId,
- 16,
Qt3DCore::NonLockingPolicy>
{
};
@@ -332,7 +311,6 @@ class GeometryManager : public Qt3DCore::QResourceManager<
class ObjectPickerManager : public Qt3DCore::QResourceManager<
ObjectPicker,
Qt3DCore::QNodeId,
- 16,
Qt3DCore::NonLockingPolicy>
{
};
@@ -341,7 +319,6 @@ class ObjectPickerManager : public Qt3DCore::QResourceManager<
class BoundingVolumeDebugManager : public Qt3DCore::QResourceManager<
BoundingVolumeDebug,
Qt3DCore::QNodeId,
- 16,
Qt3DCore::ObjectLevelLockingPolicy>
{
};
@@ -350,7 +327,6 @@ class BoundingVolumeDebugManager : public Qt3DCore::QResourceManager<
class LightManager : public Qt3DCore::QResourceManager<
Light,
Qt3DCore::QNodeId,
- 16,
Qt3DCore::NonLockingPolicy>
{
public:
@@ -360,7 +336,6 @@ public:
class EnvironmentLightManager : public Qt3DCore::QResourceManager<
EnvironmentLight,
Qt3DCore::QNodeId,
- 16,
Qt3DCore::NonLockingPolicy>
{
public:
@@ -370,7 +345,6 @@ public:
class ComputeCommandManager : public Qt3DCore::QResourceManager<
ComputeCommand,
Qt3DCore::QNodeId,
- 16,
Qt3DCore::NonLockingPolicy>
{
public:
@@ -380,7 +354,6 @@ public:
class RenderStateManager : public Qt3DCore::QResourceManager<
RenderStateNode,
Qt3DCore::QNodeId,
- 16,
Qt3DCore::NonLockingPolicy>
{
};
diff --git a/src/render/backend/renderview.cpp b/src/render/backend/renderview.cpp
index a2eefd911..341a25e61 100644
--- a/src/render/backend/renderview.cpp
+++ b/src/render/backend/renderview.cpp
@@ -543,14 +543,14 @@ QVector<RenderCommand *> RenderView::buildDrawRenderCommands(const QVector<Entit
for (Entity *node : entities) {
GeometryRenderer *geometryRenderer = nullptr;
- HGeometryRenderer geometryRendererHandle = node->componentHandle<GeometryRenderer, 16>();
+ HGeometryRenderer geometryRendererHandle = node->componentHandle<GeometryRenderer>();
// There is a geometry renderer with geometry
if ((geometryRenderer = m_manager->geometryRendererManager()->data(geometryRendererHandle)) != nullptr
&& geometryRenderer->isEnabled()
&& !geometryRenderer->geometryId().isNull()) {
const Qt3DCore::QNodeId materialComponentId = node->componentUuid<Material>();
- const HMaterial materialHandle = node->componentHandle<Material, 16>();
+ const HMaterial materialHandle = node->componentHandle<Material>();
const QVector<RenderPassParameterData> renderPassData = m_parameters.value(materialComponentId);
HGeometry geometryHandle = m_manager->lookupHandle<Geometry, GeometryManager, HGeometry>(geometryRenderer->geometryId());
Geometry *geometry = m_manager->data<Geometry, GeometryManager>(geometryHandle);
diff --git a/src/render/framegraph/renderpassfilternode_p.h b/src/render/framegraph/renderpassfilternode_p.h
index ee9137b04..cd0d3a361 100644
--- a/src/render/framegraph/renderpassfilternode_p.h
+++ b/src/render/framegraph/renderpassfilternode_p.h
@@ -62,7 +62,7 @@ namespace Qt3DRender {
class QFilterKey;
class QRenderPassFilter;
-template <typename T, uint INDEXBITS>
+template <typename T>
class QHandle;
namespace Render {
diff --git a/src/render/framegraph/techniquefilternode_p.h b/src/render/framegraph/techniquefilternode_p.h
index 091dc1cf7..3fb8abb84 100644
--- a/src/render/framegraph/techniquefilternode_p.h
+++ b/src/render/framegraph/techniquefilternode_p.h
@@ -65,7 +65,7 @@ namespace Qt3DRender {
class QFilterKey;
class QTechniqueFilter;
-template <typename T, uint INDEXBITS>
+template <typename T>
class QHandle;
namespace Render {
diff --git a/src/render/geometry/buffermanager_p.h b/src/render/geometry/buffermanager_p.h
index ed3563876..f2b0715ec 100644
--- a/src/render/geometry/buffermanager_p.h
+++ b/src/render/geometry/buffermanager_p.h
@@ -63,7 +63,6 @@ namespace Render {
class Q_AUTOTEST_EXPORT BufferManager : public Qt3DCore::QResourceManager<
Buffer,
Qt3DCore::QNodeId,
- 16,
Qt3DCore::ObjectLevelLockingPolicy>
{
public:
diff --git a/src/render/geometry/geometryrenderermanager_p.h b/src/render/geometry/geometryrenderermanager_p.h
index e3b313569..becf1bcc1 100644
--- a/src/render/geometry/geometryrenderermanager_p.h
+++ b/src/render/geometry/geometryrenderermanager_p.h
@@ -63,7 +63,6 @@ namespace Render {
class Q_AUTOTEST_EXPORT GeometryRendererManager : public Qt3DCore::QResourceManager<
GeometryRenderer,
Qt3DCore::QNodeId,
- 16,
Qt3DCore::ObjectLevelLockingPolicy>
{
public:
diff --git a/src/render/io/scenemanager.cpp b/src/render/io/scenemanager.cpp
index 8e6af8c40..e42601e32 100644
--- a/src/render/io/scenemanager.cpp
+++ b/src/render/io/scenemanager.cpp
@@ -46,7 +46,6 @@ namespace Render {
SceneManager::SceneManager() : Qt3DCore::QResourceManager<Scene,
Qt3DCore::QNodeId,
- 8,
Qt3DCore::ObjectLevelLockingPolicy>()
{
}
diff --git a/src/render/io/scenemanager_p.h b/src/render/io/scenemanager_p.h
index 941b90a4d..14a599af8 100644
--- a/src/render/io/scenemanager_p.h
+++ b/src/render/io/scenemanager_p.h
@@ -68,7 +68,6 @@ namespace Render {
class Q_AUTOTEST_EXPORT SceneManager : public Qt3DCore::QResourceManager<
Scene,
Qt3DCore::QNodeId,
- 8,
Qt3DCore::ObjectLevelLockingPolicy>
{
public:
diff --git a/src/render/jobs/pickboundingvolumejob.cpp b/src/render/jobs/pickboundingvolumejob.cpp
index 19c9932f5..616ee0ca8 100644
--- a/src/render/jobs/pickboundingvolumejob.cpp
+++ b/src/render/jobs/pickboundingvolumejob.cpp
@@ -317,14 +317,14 @@ void PickBoundingVolumeJob::dispatchPickEvents(const QMouseEvent &event,
for (const QCollisionQueryResult::Hit &hit : qAsConst(sphereHits)) {
Entity *entity = m_manager->renderNodesManager()->lookupResource(hit.m_entityId);
- HObjectPicker objectPickerHandle = entity->componentHandle<ObjectPicker, 16>();
+ HObjectPicker objectPickerHandle = entity->componentHandle<ObjectPicker>();
// If the Entity which actually received the hit doesn't have
// an object picker component, we need to check the parent if it has one ...
while (objectPickerHandle.isNull() && entity != nullptr) {
entity = entity->parent();
if (entity != nullptr)
- objectPickerHandle = entity->componentHandle<ObjectPicker, 16>();
+ objectPickerHandle = entity->componentHandle<ObjectPicker>();
}
ObjectPicker *objectPicker = m_manager->objectPickerManager()->data(objectPickerHandle);
diff --git a/src/render/jobs/pickboundingvolumeutils.cpp b/src/render/jobs/pickboundingvolumeutils.cpp
index 70f0b7f95..5c778bf29 100644
--- a/src/render/jobs/pickboundingvolumeutils.cpp
+++ b/src/render/jobs/pickboundingvolumeutils.cpp
@@ -194,7 +194,7 @@ AbstractCollisionGathererFunctor::~AbstractCollisionGathererFunctor()
AbstractCollisionGathererFunctor::result_type AbstractCollisionGathererFunctor::operator ()(const Entity *entity) const
{
- HObjectPicker objectPickerHandle = entity->componentHandle<ObjectPicker, 16>();
+ HObjectPicker objectPickerHandle = entity->componentHandle<ObjectPicker>();
// If the Entity which actually received the hit doesn't have
// an object picker component, we need to check the parent if it has one ...
@@ -202,7 +202,7 @@ AbstractCollisionGathererFunctor::result_type AbstractCollisionGathererFunctor::
while (objectPickerHandle.isNull() && parentEntity != nullptr) {
parentEntity = parentEntity->parent();
if (parentEntity != nullptr)
- objectPickerHandle = parentEntity->componentHandle<ObjectPicker, 16>();
+ objectPickerHandle = parentEntity->componentHandle<ObjectPicker>();
}
ObjectPicker *objectPicker = m_manager->objectPickerManager()->data(objectPickerHandle);
@@ -299,7 +299,7 @@ bool HierarchicalEntityPicker::collectHits(Entity *root)
QRayCastingService rayCasting;
std::vector<std::pair<Entity *, bool>> worklist;
- worklist.push_back({root, !root->componentHandle<ObjectPicker, 16>().isNull()});
+ worklist.push_back({root, !root->componentHandle<ObjectPicker>().isNull()});
while (!worklist.empty()) {
auto current = worklist.back();
@@ -320,7 +320,7 @@ bool HierarchicalEntityPicker::collectHits(Entity *root)
// and pick children
for (auto child: current.first->children())
- worklist.push_back({child, current.second || !child->componentHandle<ObjectPicker, 16>().isNull()});
+ worklist.push_back({child, current.second || !child->componentHandle<ObjectPicker>().isNull()});
}
return !m_hits.empty();
diff --git a/src/render/materialsystem/techniquemanager_p.h b/src/render/materialsystem/techniquemanager_p.h
index 5b390f94b..8108d5f5b 100644
--- a/src/render/materialsystem/techniquemanager_p.h
+++ b/src/render/materialsystem/techniquemanager_p.h
@@ -63,7 +63,6 @@ namespace Render {
class Q_AUTOTEST_EXPORT TechniqueManager : public Qt3DCore::QResourceManager<
Technique,
Qt3DCore::QNodeId,
- 16,
Qt3DCore::NonLockingPolicy>
{
public:
diff --git a/tests/auto/core/qresourcemanager/tst_qresourcemanager.cpp b/tests/auto/core/qresourcemanager/tst_qresourcemanager.cpp
index b7bd7c28a..9a387a919 100644
--- a/tests/auto/core/qresourcemanager/tst_qresourcemanager.cpp
+++ b/tests/auto/core/qresourcemanager/tst_qresourcemanager.cpp
@@ -31,12 +31,12 @@
#include <Qt3DCore/private/qhandle_p.h>
#include <Qt3DCore/private/qresourcemanager_p.h>
-class tst_DynamicArrayPolicy : public QObject
+class tst_QResourceManager : public QObject
{
Q_OBJECT
public:
- tst_DynamicArrayPolicy() {}
- ~tst_DynamicArrayPolicy() {}
+ tst_QResourceManager() {}
+ ~tst_QResourceManager() {}
private slots:
void createResourcesManager();
@@ -48,7 +48,7 @@ private slots:
void releaseResource();
void heavyDutyMultiThreadedAccess();
void heavyDutyMultiThreadedAccessRelease();
- void maximumNumberOfResources();
+ void collectResources();
void activeHandles();
};
@@ -68,29 +68,21 @@ Q_DECLARE_RESOURCE_INFO(tst_ArrayResource, Q_REQUIRES_CLEANUP)
QT_END_NAMESPACE
typedef Qt3DCore::QHandle<tst_ArrayResource> tHandle;
-typedef Qt3DCore::QHandle<tst_ArrayResource, 4> tHandle4;
-typedef Qt3DCore::QHandle<tst_ArrayResource, 8> tHandle8;
-typedef Qt3DCore::QHandle<tst_ArrayResource, 16> tHandle16;
-void tst_DynamicArrayPolicy::createResourcesManager()
+void tst_QResourceManager::createResourcesManager()
{
- Qt3DCore::QResourceManager<tst_ArrayResource, int, 16> manager16;
- Qt3DCore::QResourceManager<tst_ArrayResource, int, 4> manager4;
- Qt3DCore::QResourceManager<tst_ArrayResource, int, 8> manager8;
- QVERIFY(manager16.maximumSize() == 65535);
- QVERIFY(manager8.maximumSize() == 255);
- QVERIFY(manager4.maximumSize() == 15);
+ Qt3DCore::QResourceManager<tst_ArrayResource, int> manager;
}
/*!
* Check that the handles returned when a registering resources
* have a correct index and counter.
*/
-void tst_DynamicArrayPolicy::acquireResources()
+void tst_QResourceManager::acquireResources()
{
- Qt3DCore::QResourceManager<tst_ArrayResource, uint, 4> manager;
+ Qt3DCore::QResourceManager<tst_ArrayResource, uint> manager;
- QList<tHandle4> handles;
+ QList<tHandle> handles;
for (int i = 0; i < 5; i++) {
handles << manager.acquire();
@@ -106,12 +98,12 @@ void tst_DynamicArrayPolicy::acquireResources()
/*!
* Test that values can be properly retrieved.
*/
-void tst_DynamicArrayPolicy::getResources()
+void tst_QResourceManager::getResources()
{
- Qt3DCore::QResourceManager<tst_ArrayResource, int, 8> manager;
+ Qt3DCore::QResourceManager<tst_ArrayResource, int> manager;
QList<tst_ArrayResource *> resources;
- QList<tHandle8> handles;
+ QList<tHandle> handles;
for (int i = 0; i < 5; i++) {
handles << manager.acquire();
@@ -127,7 +119,7 @@ void tst_DynamicArrayPolicy::getResources()
QVERIFY(manager.data(handles.at(i))->m_value == i);
// Check that an invalid resource returns NULL
- tHandle8 iHandle;
+ tHandle iHandle;
QVERIFY(manager.data(iHandle) == nullptr);
}
@@ -136,10 +128,10 @@ void tst_DynamicArrayPolicy::getResources()
* Test that when a resize of the data vectors in the manager occurs,
* everything behaves correctly.
*/
-void tst_DynamicArrayPolicy::registerResourcesResize()
+void tst_QResourceManager::registerResourcesResize()
{
- Qt3DCore::QResourceManager<tst_ArrayResource, uint, 16> manager;
- QList<tHandle16> handles;
+ Qt3DCore::QResourceManager<tst_ArrayResource, uint> manager;
+ QList<tHandle> handles;
for (uint i = 0; i < 2; i++) {
handles << manager.acquire();
@@ -162,7 +154,7 @@ void tst_DynamicArrayPolicy::registerResourcesResize()
/*!
* Checks for the removal of resources.
*/
-void tst_DynamicArrayPolicy::removeResource()
+void tst_QResourceManager::removeResource()
{
Qt3DCore::QResourceManager<tst_ArrayResource, int> manager;
@@ -185,12 +177,12 @@ void tst_DynamicArrayPolicy::removeResource()
QVERIFY(manager.data(nHandle) != nullptr);
}
-void tst_DynamicArrayPolicy::lookupResource()
+void tst_QResourceManager::lookupResource()
{
Qt3DCore::QResourceManager<tst_ArrayResource, uint> manager;
QList<tst_ArrayResource *> resources;
- QList<tHandle16> handles;
+ QList<tHandle> handles;
for (int i = 0; i < 5; i++) {
handles << manager.acquire();
@@ -198,7 +190,7 @@ void tst_DynamicArrayPolicy::lookupResource()
resources.at(i)->m_value = 4;
}
- tHandle16 t = manager.lookupHandle(2);
+ tHandle t = manager.lookupHandle(2);
QVERIFY(t.handle() == 0);
QVERIFY(manager.data(t) == nullptr);
tst_ArrayResource *resource = manager.getOrCreateResource(2);
@@ -210,7 +202,7 @@ void tst_DynamicArrayPolicy::lookupResource()
QVERIFY(manager.data(t) == resource);
}
-void tst_DynamicArrayPolicy::releaseResource()
+void tst_QResourceManager::releaseResource()
{
Qt3DCore::QResourceManager<tst_ArrayResource, uint> manager;
QList<tst_ArrayResource *> resources;
@@ -236,7 +228,6 @@ public:
typedef Qt3DCore::QResourceManager<tst_ArrayResource,
int,
- 16,
Qt3DCore::ObjectLevelLockingPolicy> Manager;
tst_Thread()
@@ -267,7 +258,7 @@ protected:
Manager *m_manager;
};
-void tst_DynamicArrayPolicy::heavyDutyMultiThreadedAccess()
+void tst_QResourceManager::heavyDutyMultiThreadedAccess()
{
tst_Thread::Manager *manager = new tst_Thread::Manager();
@@ -306,7 +297,6 @@ public:
typedef Qt3DCore::QResourceManager<tst_ArrayResource,
int,
- 16,
Qt3DCore::ObjectLevelLockingPolicy> Manager;
tst_Thread2(int releaseAbove = 7)
@@ -341,7 +331,7 @@ protected:
int m_releaseAbove;
};
-void tst_DynamicArrayPolicy::heavyDutyMultiThreadedAccessRelease()
+void tst_QResourceManager::heavyDutyMultiThreadedAccessRelease()
{
tst_Thread2::Manager *manager = new tst_Thread2::Manager();
@@ -377,21 +367,28 @@ void tst_DynamicArrayPolicy::heavyDutyMultiThreadedAccessRelease()
delete manager;
}
-void tst_DynamicArrayPolicy::maximumNumberOfResources()
+void tst_QResourceManager::collectResources()
{
Qt3DCore::QResourceManager<tst_ArrayResource, uint> manager;
QList<tst_ArrayResource *> resources;
- QList<tHandle16> handles;
+ QList<tHandle> handles;
- for (int i = 0; i < manager.maximumSize(); i++) {
+ for (int i = 0; i < 65536; i++) {
handles << manager.acquire();
resources << manager.data(handles.at(i));
resources.at(i)->m_value = 4;
}
+ for (auto h : handles) {
+ manager.release(h);
+ }
+ Q_ASSERT(manager.count() == 0);
+ handles.clear();
+ manager.acquire();
+ Q_ASSERT(manager.count() == 1);
}
-void tst_DynamicArrayPolicy::activeHandles()
+void tst_QResourceManager::activeHandles()
{
// GIVEN
Qt3DCore::QResourceManager<tst_ArrayResource, uint> manager;
@@ -428,6 +425,6 @@ void tst_DynamicArrayPolicy::activeHandles()
-QTEST_APPLESS_MAIN(tst_DynamicArrayPolicy)
+QTEST_APPLESS_MAIN(tst_QResourceManager)
#include "tst_qresourcemanager.moc"
diff --git a/tests/benchmarks/core/qresourcesmanager/qresourcesmanager/tst_bench_qresourcesmanager.cpp b/tests/benchmarks/core/qresourcesmanager/qresourcesmanager/tst_bench_qresourcesmanager.cpp
index 51eb2d6fc..3046fcb98 100644
--- a/tests/benchmarks/core/qresourcesmanager/qresourcesmanager/tst_bench_qresourcesmanager.cpp
+++ b/tests/benchmarks/core/qresourcesmanager/qresourcesmanager/tst_bench_qresourcesmanager.cpp
@@ -69,7 +69,7 @@ public:
template<typename Resource>
void benchmarkAllocateResources()
{
- Qt3DCore::QResourceManager<Resource, int, 16> manager;
+ Qt3DCore::QResourceManager<Resource, int> manager;
volatile Resource *c;
QBENCHMARK_ONCE {
@@ -83,7 +83,7 @@ void benchmarkAllocateResources()
template<typename Resource>
void benchmarkAccessResources()
{
- Qt3DCore::QResourceManager<Resource, int, 16> manager;
+ Qt3DCore::QResourceManager<Resource, int> manager;
const int max = (1 << 16) - 1;
QVector<Qt3DCore::QHandle<Resource> > handles(max);
for (int i = 0; i < max; i++)
@@ -99,7 +99,7 @@ void benchmarkAccessResources()
template<typename Resource>
void benchmarkRandomAccessResource() {
- Qt3DCore::QResourceManager<Resource, int, 16> manager;
+ Qt3DCore::QResourceManager<Resource, int> manager;
const int max = (1 << 16) - 1;
QVector<Qt3DCore::QHandle<Resource> > handles(max);
for (int i = 0; i < max; i++)
@@ -118,7 +118,7 @@ void benchmarkRandomAccessResource() {
template<typename Resource>
void benchmarkLookupResources()
{
- Qt3DCore::QResourceManager<Resource, int, 16> manager;
+ Qt3DCore::QResourceManager<Resource, int> manager;
const int max = (1 << 16) - 1;
for (int i = 0; i < max; i++)
manager.getOrCreateResource(i);
@@ -134,7 +134,7 @@ void benchmarkLookupResources()
template<typename Resource>
void benchmarkRandomLookupResources()
{
- Qt3DCore::QResourceManager<Resource, int, 16> manager;
+ Qt3DCore::QResourceManager<Resource, int> manager;
const int max = (1 << 16) - 1;
QVector<int> resourcesIndices(max);
for (int i = 0; i < max; i++) {
@@ -154,7 +154,7 @@ void benchmarkRandomLookupResources()
template<typename Resource>
void benchmarkReleaseResources()
{
- Qt3DCore::QResourceManager<Resource, int, 16> manager;
+ Qt3DCore::QResourceManager<Resource, int> manager;
const int max = (1 << 16) - 1;
QVector<Qt3DCore::QHandle<Resource> > handles(max);
for (int i = 0; i < max; i++)