Skip to content

Commit 548ee63

Browse files
author
devsh
committed
correct horrible allocator bugs
1 parent f09fb93 commit 548ee63

File tree

5 files changed

+9
-4
lines changed

5 files changed

+9
-4
lines changed

include/nbl/core/alloc/AddressAllocatorBase.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ namespace core
117117
return true;
118118
}
119119

120-
inline void* getAddressOffset() const noexcept {return addressOffset;}
120+
inline _size_type getAddressOffset() const noexcept {return addressOffset;}
121121

122122
inline const void* getReservedSpacePtr() const noexcept {return reservedSpace;}
123123

include/nbl/core/alloc/GeneralpurposeAddressAllocator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ class GeneralpurposeAddressAllocator : public AddressAllocatorBase<Generalpurpos
516516

517517
#ifdef _NBL_DEBUG
518518
// allocation must not be outside the buffer
519-
assert(found.first.startOffset +bytes<=AllocStrategy::bufferSize);
519+
assert(found.first.startOffset+bytes<=AllocStrategy::bufferSize);
520520
// sanity check
521521
assert(AllocStrategy::freeSize+bytes<=AllocStrategy::bufferSize);
522522
#endif // _NBL_DEBUG

include/nbl/core/alloc/LinearAddressAllocator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class LinearAddressAllocator : public AddressAllocatorBase<LinearAddressAllocato
127127
}
128128
protected:
129129
size_type bufferSize;
130-
size_type cursor;
130+
size_type cursor;
131131
};
132132

133133

include/nbl/video/alloc/CAsyncSingleBufferSubAllocator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ class CAsyncSingleBufferSubAllocator
201201
std::unique_lock<std::recursive_mutex> tLock(stAccessVerfier,std::try_to_lock_t());
202202
assert(tLock.owns_lock());
203203
#endif // _NBL_DEBUG
204-
multi_deallocate(count,addr,bytes,{});
204+
m_composed.multi_deallocate(count,addr,bytes);
205205
}
206206
// TODO: improve signature of this function in the future
207207
template<typename T=core::IReferenceCounted>

include/nbl/video/alloc/StreamingTransientDataBuffer.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ class StreamingTransientDataBuffer
7070
//
7171
inline size_type max_size() noexcept {return m_composed.max_size();}
7272

73+
// anyone gonna use it?
74+
inline const auto& getAddressAllocator() const noexcept {return m_composed.getAddressAllocator();}
75+
7376
// perfect forward to `Composed` method
7477
template<typename... Args>
7578
inline value_type multi_allocate(Args&&... args) noexcept
@@ -187,6 +190,8 @@ class StreamingTransientDataBufferMT : public core::IReferenceCounted
187190
return retval;
188191
}
189192

193+
//! you should really `this->get_lock()` if you need the guarantee that the state doesn't change
194+
inline const auto& getAddressAllocator() const noexcept {return m_composed.getAddressAllocator();}
190195

191196
template<typename... Args>
192197
inline size_type multi_allocate(Args&&... args) noexcept

0 commit comments

Comments
 (0)