Skip to content

Commit 6dc8448

Browse files
Merge pull request #480 from pollend/bugfix/resolve-memory-alignment-crash-linux
bugfix: address memory assertions for command pool
2 parents c6d0dde + ce6dfc8 commit 6dc8448

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

include/nbl/core/memory/memory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ namespace impl
4949
if (alignment < MIN_ALIGN) alignment = MIN_ALIGN;
5050
if (size == 0) return nullptr;
5151
void* p;
52-
if (::posix_memalign(&p, alignment>alignof(std::max_align_t) ? alignof(std::max_align_t):alignment, size) != 0) p = nullptr;
52+
if (::posix_memalign(&p, alignment, size) != 0) p = nullptr;
5353
return p;
5454
}
5555
}

include/nbl/video/IGPUCommandPool.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,10 @@ class IGPUCommandPool : public core::IReferenceCounted, public IBackendObject
344344
}
345345

346346
CCommandSegment* m_head = nullptr;
347-
core::CMemoryPool<core::PoolAddressAllocator<uint32_t>, core::default_aligned_allocator, false, uint32_t> m_pool;
347+
348+
template <typename T>
349+
using pool_alignment = core::aligned_allocator<T,COMMAND_SEGMENT_ALIGNMENT>;
350+
core::CMemoryPool<core::PoolAddressAllocator<uint32_t>, pool_alignment, false, uint32_t> m_pool;
348351
};
349352

350353
friend class IGPUCommandBuffer;

0 commit comments

Comments
 (0)