@@ -28,8 +28,10 @@ class SubAllocatedDescriptorSet : public core::IReferenceCounted
28
28
{
29
29
public:
30
30
inline DeferredFreeFunctor (SubAllocatedDescriptorSet* composed, uint32_t binding, size_type count, const value_type* addresses)
31
- : m_addresses(addresses, addresses + count), m_binding(binding), m_composed(composed)
31
+ : m_addresses(std::move(core::make_refctd_dynamic_array<core::smart_refctd_dynamic_array<value_type>>(count))),
32
+ m_binding(binding), m_composed(composed)
32
33
{
34
+ memcpy (m_addresses->data (), addresses, count * sizeof (value_type));
33
35
}
34
36
35
37
// Just does the de-allocation
@@ -39,17 +41,17 @@ class SubAllocatedDescriptorSet : public core::IReferenceCounted
39
41
#ifdef _NBL_DEBUG
40
42
assert (m_composed);
41
43
#endif // _NBL_DEBUG
42
- m_composed->multi_deallocate (m_binding, m_addresses. size (), m_addresses. data ());
44
+ m_composed->multi_deallocate (m_binding, m_addresses-> size (), m_addresses-> data ());
43
45
}
44
46
45
47
// Takes count of allocations we want to free up as reference, true is returned if
46
48
// the amount of allocations freed was >= allocationsToFreeUp
47
49
// False is returned if there are more allocations to free up
48
50
inline bool operator ()(size_type& allocationsToFreeUp)
49
51
{
50
- auto prevCount = m_addresses. size ();
52
+ auto prevCount = m_addresses-> size ();
51
53
operator ()();
52
- auto totalFreed = m_addresses. size () - prevCount;
54
+ auto totalFreed = m_addresses-> size () - prevCount;
53
55
54
56
// This does the same logic as bool operator()(size_type&) on
55
57
// CAsyncSingleBufferSubAllocator
@@ -60,9 +62,9 @@ class SubAllocatedDescriptorSet : public core::IReferenceCounted
60
62
return freedEverything;
61
63
}
62
64
protected:
65
+ core::smart_refctd_dynamic_array<value_type> m_addresses;
63
66
SubAllocatedDescriptorSet* m_composed;
64
67
uint32_t m_binding;
65
- std::vector<value_type> m_addresses;
66
68
};
67
69
using EventHandler = MultiTimelineEventHandlerST<DeferredFreeFunctor>;
68
70
protected:
0 commit comments