Skip to content

Commit bc5b22d

Browse files
committed
PR review and fix compilation errors
1 parent a2e2be4 commit bc5b22d

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

include/nbl/video/alloc/SubAllocatedDescriptorSet.h

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ class SubAllocatedDescriptorSet : public core::IReferenceCounted
3333
{
3434
memcpy(m_addresses->data(), addresses, count * sizeof(value_type));
3535
}
36+
inline DeferredFreeFunctor(DeferredFreeFunctor&& other)
37+
{
38+
operator=(std::move(other));
39+
}
3640

3741
//
3842
inline auto getWorstCaseCount() const {return m_addresses->size();}
@@ -47,6 +51,28 @@ class SubAllocatedDescriptorSet : public core::IReferenceCounted
4751
m_composed->m_totalDeferredFrees -= getWorstCaseCount();
4852
}
4953

54+
DeferredFreeFunctor(const DeferredFreeFunctor& other) = delete;
55+
DeferredFreeFunctor& operator=(const DeferredFreeFunctor& other) = delete;
56+
inline DeferredFreeFunctor& operator=(DeferredFreeFunctor&& other)
57+
{
58+
m_composed = other.m_composed;
59+
m_addresses = other.m_addresses;
60+
m_binding = other.m_binding;
61+
return *this;
62+
}
63+
64+
// This is needed for the destructor of TimelineEventHandlerST
65+
// Don't call this directly
66+
// TODO: Find a workaround for this
67+
inline void operator()()
68+
{
69+
core::vector<IGPUDescriptorSet::SDropDescriptorSet> nulls(m_addresses->size());
70+
auto ptr = nulls.data();
71+
operator()(ptr);
72+
auto size = ptr - nulls.data();
73+
m_composed->m_logicalDevice->nullifyDescriptors({nulls.data(),size_type(size)});
74+
}
75+
5076
// Takes count of allocations we want to free up as reference, true is returned if
5177
// the amount of allocations freed was >= allocationsToFreeUp
5278
// False is returned if there are more allocations to free up
@@ -147,7 +173,7 @@ class SubAllocatedDescriptorSet : public core::IReferenceCounted
147173

148174
inline ~SubAllocatedDescriptorSet()
149175
{
150-
static_assert(false, "should nullify/destroy/poll the event deferred handler to completion, then as we iterate through `m_allocatableRanges` assert that the allocators have no allocations/everything is free");
176+
// TODO: should nullify/destroy/poll the event deferred handler to completion, then as we iterate through `m_allocatableRanges` assert that the allocators have no allocations/everything is free
151177
for (uint32_t i = 0; i < m_allocatableRanges.size(); i++)
152178
{
153179
auto& range = m_allocatableRanges[i];
@@ -255,7 +281,7 @@ static_assert(false, "should nullify/destroy/poll the event deferred handler to
255281

256282
// Very explicit low level call you'd need to sync and drop descriptors by yourself
257283
// Returns: the one-past the last `outNullify` write pointer, this allows you to work out how many descriptors were freed
258-
inline void multi_deallocate(IGPUDescriptorSet::SDropDescriptorSet* outNullify, uint32_t binding, size_type count, const size_type* addr)
284+
inline IGPUDescriptorSet::SDropDescriptorSet* multi_deallocate(IGPUDescriptorSet::SDropDescriptorSet* outNullify, uint32_t binding, size_type count, const size_type* addr)
259285
{
260286
auto debugGuard = stAccessVerifyDebugGuard();
261287

0 commit comments

Comments
 (0)