Skip to content

Commit 59c65ae

Browse files
committed
Include exporting of allocate descriptor writes instead of using them
1 parent 894a47c commit 59c65ae

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

include/nbl/video/alloc/SubAllocatedDescriptorSet.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ class SubAllocatedDescriptorSet : public core::IReferenceCounted
2828
{
2929
public:
3030
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)
3233
{
34+
memcpy(m_addresses->data(), addresses, count * sizeof(value_type));
3335
}
3436

3537
// Just does the de-allocation
@@ -39,17 +41,17 @@ class SubAllocatedDescriptorSet : public core::IReferenceCounted
3941
#ifdef _NBL_DEBUG
4042
assert(m_composed);
4143
#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());
4345
}
4446

4547
// Takes count of allocations we want to free up as reference, true is returned if
4648
// the amount of allocations freed was >= allocationsToFreeUp
4749
// False is returned if there are more allocations to free up
4850
inline bool operator()(size_type& allocationsToFreeUp)
4951
{
50-
auto prevCount = m_addresses.size();
52+
auto prevCount = m_addresses->size();
5153
operator()();
52-
auto totalFreed = m_addresses.size() - prevCount;
54+
auto totalFreed = m_addresses->size() - prevCount;
5355

5456
// This does the same logic as bool operator()(size_type&) on
5557
// CAsyncSingleBufferSubAllocator
@@ -60,9 +62,9 @@ class SubAllocatedDescriptorSet : public core::IReferenceCounted
6062
return freedEverything;
6163
}
6264
protected:
65+
core::smart_refctd_dynamic_array<value_type> m_addresses;
6366
SubAllocatedDescriptorSet* m_composed;
6467
uint32_t m_binding;
65-
std::vector<value_type> m_addresses;
6668
};
6769
using EventHandler = MultiTimelineEventHandlerST<DeferredFreeFunctor>;
6870
protected:

0 commit comments

Comments
 (0)