Skip to content

Commit 4fd4b8f

Browse files
committed
Fix example
1 parent d716848 commit 4fd4b8f

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

include/nbl/video/alloc/SubAllocatedDescriptorSet.h

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "nbl/video/alloc/IBufferAllocator.h"
99

1010
#include <type_traits>
11+
#include <map>
1112

1213
namespace nbl::video
1314
{
@@ -65,18 +66,26 @@ class SubAllocatedDescriptorSet : public core::IReferenceCounted
6566
};
6667
protected:
6768
struct SubAllocDescriptorSetRange {
68-
MultiTimelineEventHandlerST<DeferredFreeFunctor> eventHandler;
69-
std::unique_ptr<AddressAllocator> addressAllocator;
70-
std::unique_ptr<ReservedAllocator> reservedAllocator;
71-
size_t reservedSize;
69+
MultiTimelineEventHandlerST<DeferredFreeFunctor> eventHandler = MultiTimelineEventHandlerST<DeferredFreeFunctor>({});
70+
std::unique_ptr<AddressAllocator> addressAllocator = nullptr;
71+
std::unique_ptr<ReservedAllocator> reservedAllocator = nullptr;
72+
size_t reservedSize = 0;
7273

7374
SubAllocDescriptorSetRange(
7475
std::unique_ptr<AddressAllocator>&& inAddressAllocator,
7576
std::unique_ptr<ReservedAllocator>&& inReservedAllocator,
7677
size_t inReservedSize) :
7778
eventHandler({}), addressAllocator(std::move(inAddressAllocator)),
7879
reservedAllocator(std::move(inReservedAllocator)), reservedSize(inReservedSize) {}
80+
SubAllocDescriptorSetRange() {}
7981

82+
SubAllocDescriptorSetRange& operator=(SubAllocDescriptorSetRange&& other)
83+
{
84+
addressAllocator = std::move(other.addressAllocator);
85+
reservedAllocator = std::move(other.reservedAllocator);
86+
reservedSize = other.reservedSize;
87+
return *this;
88+
}
8089
};
8190
std::map<uint32_t, SubAllocDescriptorSetRange> m_allocatableRanges = {};
8291
core::smart_refctd_ptr<video::IGPUDescriptorSet> m_descriptorSet;
@@ -119,7 +128,8 @@ class SubAllocatedDescriptorSet : public core::IReferenceCounted
119128
static_cast<size_type>(0), 0u, MaxDescriptorSetAllocationAlignment, static_cast<size_type>(count),
120129
MinDescriptorSetAllocationSize
121130
));
122-
m_allocatableRanges.emplace(binding.data, SubAllocDescriptorSetRange(std::move(addressAllocator), std::move(reservedAllocator), reservedSize));
131+
132+
m_allocatableRanges[binding.data] = SubAllocDescriptorSetRange(std::move(addressAllocator), std::move(reservedAllocator), reservedSize);
123133
}
124134
}
125135
}

0 commit comments

Comments
 (0)