summaryrefslogtreecommitdiffstats
path: root/Common/interface
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-09-16 18:49:54 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-09-16 18:49:54 +0000
commit609a63ef71c504981e38d115dafc9cbf52dfa640 (patch)
treebfe75873dca09ead4b2a7939ff3b7703ab378088 /Common/interface
parentFixed one more gcc warning (diff)
downloadDiligentCore-609a63ef71c504981e38d115dafc9cbf52dfa640.tar.gz
DiligentCore-609a63ef71c504981e38d115dafc9cbf52dfa640.zip
Reworked dynamic memory allocation in D3D12 backend to not rely on ring buffer (fixed https://github.com/DiligentGraphics/DiligentCore/issues/23)
Diffstat (limited to 'Common/interface')
-rw-r--r--Common/interface/STDAllocator.h17
1 files changed, 10 insertions, 7 deletions
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 <typename T, typename AllocatorType>
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<T*>( 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);