From 609a63ef71c504981e38d115dafc9cbf52dfa640 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Sun, 16 Sep 2018 11:49:54 -0700 Subject: Reworked dynamic memory allocation in D3D12 backend to not rely on ring buffer (fixed https://github.com/DiligentGraphics/DiligentCore/issues/23) --- Common/interface/STDAllocator.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'Common/interface') diff --git a/Common/interface/STDAllocator.h b/Common/interface/STDAllocator.h index 6c11fa3d..cf2290be 100644 --- a/Common/interface/STDAllocator.h +++ b/Common/interface/STDAllocator.h @@ -37,13 +37,13 @@ namespace Diligent template struct STDAllocator { - typedef T value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; + using value_type = T; + using pointer = value_type*; + using const_pointer = const value_type*; + using reference = value_type&; + using const_reference = const value_type&; + using size_type = std::size_t; + using difference_type = std::ptrdiff_t; STDAllocator(AllocatorType& Allocator, const Char* Description, const Char* FileName, const Int32 LineNumber)noexcept : m_Allocator (Allocator) @@ -105,6 +105,9 @@ struct STDAllocator return reinterpret_cast( m_Allocator.Allocate(count * sizeof(T), m_dvpDescription, m_dvpFileName, m_dvpLineNumber ) ); } + pointer address(reference r) { return &r; } + const_pointer address(const_reference r) { return &r; } + void deallocate(T* p, std::size_t count) { m_Allocator.Free(p); -- cgit v1.2.3