|
8 | 8 | #include "nbl/video/alloc/IBufferAllocator.h"
|
9 | 9 |
|
10 | 10 | #include <type_traits>
|
| 11 | +#include <map> |
11 | 12 |
|
12 | 13 | namespace nbl::video
|
13 | 14 | {
|
@@ -65,18 +66,26 @@ class SubAllocatedDescriptorSet : public core::IReferenceCounted
|
65 | 66 | };
|
66 | 67 | protected:
|
67 | 68 | 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; |
72 | 73 |
|
73 | 74 | SubAllocDescriptorSetRange(
|
74 | 75 | std::unique_ptr<AddressAllocator>&& inAddressAllocator,
|
75 | 76 | std::unique_ptr<ReservedAllocator>&& inReservedAllocator,
|
76 | 77 | size_t inReservedSize) :
|
77 | 78 | eventHandler({}), addressAllocator(std::move(inAddressAllocator)),
|
78 | 79 | reservedAllocator(std::move(inReservedAllocator)), reservedSize(inReservedSize) {}
|
| 80 | + SubAllocDescriptorSetRange() {} |
79 | 81 |
|
| 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 | + } |
80 | 89 | };
|
81 | 90 | std::map<uint32_t, SubAllocDescriptorSetRange> m_allocatableRanges = {};
|
82 | 91 | core::smart_refctd_ptr<video::IGPUDescriptorSet> m_descriptorSet;
|
@@ -119,7 +128,8 @@ class SubAllocatedDescriptorSet : public core::IReferenceCounted
|
119 | 128 | static_cast<size_type>(0), 0u, MaxDescriptorSetAllocationAlignment, static_cast<size_type>(count),
|
120 | 129 | MinDescriptorSetAllocationSize
|
121 | 130 | ));
|
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); |
123 | 133 | }
|
124 | 134 | }
|
125 | 135 | }
|
|
0 commit comments