@@ -17,7 +17,7 @@ class SubAllocatedDescriptorSet : public core::IReferenceCounted
17
17
public:
18
18
// address allocator gives offsets
19
19
// reserved allocator allocates memory to keep the address allocator state inside
20
- using AddressAllocator = core::GeneralpurposeAddressAllocator <uint32_t >;
20
+ using AddressAllocator = core::PoolAddressAllocator <uint32_t >;
21
21
using ReservedAllocator = core::allocator<uint8_t >;
22
22
using size_type = typename AddressAllocator::size_type;
23
23
using value_type = typename AddressAllocator::size_type;
@@ -102,16 +102,27 @@ class SubAllocatedDescriptorSet : public core::IReferenceCounted
102
102
// main methods
103
103
104
104
// ! Warning `outAddresses` needs to be primed with `invalid_value` values, otherwise no allocation happens for elements not equal to `invalid_value`
105
- template <typename ... Args>
106
- inline void multi_allocate (uint32_t binding, uint32_t count, value_type* outAddresses, const size_type* sizes, const Args&... args)
105
+ inline void multi_allocate (uint32_t binding, uint32_t count, value_type* outAddresses)
107
106
{
108
- core::address_allocator_traits<AddressAllocator>::multi_alloc_addr (getBindingAllocator (binding), count, outAddresses, sizes, 1 , args...);
107
+ auto & allocator = getBindingAllocator (binding);
108
+ for (uint32_t i=0 ; i<count; i++)
109
+ {
110
+ if (outAddresses[i]!=AddressAllocator::invalid_address)
111
+ continue ;
112
+
113
+ outAddresses[i] = allocator.alloc_addr (1 ,1 );
114
+ }
109
115
}
110
- inline void multi_deallocate (uint32_t binding, uint32_t count, const size_type* addr, const size_type* sizes )
116
+ inline void multi_deallocate (uint32_t binding, uint32_t count, const size_type* addr)
111
117
{
112
- auto & range = m_allocatableRanges[binding];
113
- assert (range.reservedSize ); // Check if this binding has an allocator
114
- core::address_allocator_traits<AddressAllocator>::multi_free_addr (getBindingAllocator (binding), count, addr, sizes);
118
+ auto & allocator = getBindingAllocator (binding);
119
+ for (uint32_t i=0 ; i<count; i++)
120
+ {
121
+ if (addr[i]==AddressAllocator::invalid_address)
122
+ continue ;
123
+
124
+ allocator.free_addr (addr[i],1 );
125
+ }
115
126
}
116
127
};
117
128
0 commit comments