Nebula
Loading...
Searching...
No Matches
Memory::RingAllocator< SYNCPOINTS > Class Template Reference

#include <ringallocator.h>

Detailed Description

template<uint SYNCPOINTS>
class Memory::RingAllocator< SYNCPOINTS >

Allocates memory up-front, and then allows other systems to grab regions.

Synchronizes used regions between frames (thread safe) in order to recycle previously occupied memory.

Classes

struct  Interval
 

Public Member Functions

 RingAllocator (const SizeT size)
 constructor
 
 ~RingAllocator ()
 destructor
 
void Start ()
 start allocation phase, checks sync points and unlocks regions if they have been signaled
 
bool Allocate (const SizeT size, RingAlloc &alloc)
 allocate memory
 
Threading::EventEnd ()
 end allocation phase, insert sync points
 

Private Types

enum  SyncState { Signaled , Waiting , Reset }
 

Private Attributes

byte * buffer
 
uint size
 
Threading::Event ev [SYNCPOINTS]
 
Util::FixedArray< IntervallockedIntervals
 
Util::FixedArray< Threading::Eventevents
 
Util::FixedArray< SyncStatestates
 
Interval currentInterval
 
Interval freeInterval
 
uint currentAllocation
 
uint nextEvent
 

Member Enumeration Documentation

◆ SyncState

template<uint SYNCPOINTS>
enum Memory::RingAllocator::SyncState
private
Enumerator
Signaled 
Waiting 
Reset 

Constructor & Destructor Documentation

◆ RingAllocator()

template<uint SYNCPOINTS>
Memory::RingAllocator< SYNCPOINTS >::RingAllocator ( const SizeT size)
inline

constructor

◆ ~RingAllocator()

template<uint SYNCPOINTS>
Memory::RingAllocator< SYNCPOINTS >::~RingAllocator ( )
inline

destructor

Member Function Documentation

◆ Allocate()

template<uint SYNCPOINTS>
bool Memory::RingAllocator< SYNCPOINTS >::Allocate ( const SizeT size,
RingAlloc & alloc )
inline

allocate memory

◆ End()

template<uint SYNCPOINTS>
Threading::Event * Memory::RingAllocator< SYNCPOINTS >::End ( )
inline

end allocation phase, insert sync points

◆ Start()

template<uint SYNCPOINTS>
void Memory::RingAllocator< SYNCPOINTS >::Start ( )
inline

start allocation phase, checks sync points and unlocks regions if they have been signaled

Member Data Documentation

◆ buffer

template<uint SYNCPOINTS>
byte* Memory::RingAllocator< SYNCPOINTS >::buffer
private

◆ currentAllocation

template<uint SYNCPOINTS>
uint Memory::RingAllocator< SYNCPOINTS >::currentAllocation
private

◆ currentInterval

template<uint SYNCPOINTS>
Interval Memory::RingAllocator< SYNCPOINTS >::currentInterval
private

◆ ev

template<uint SYNCPOINTS>
Threading::Event Memory::RingAllocator< SYNCPOINTS >::ev[SYNCPOINTS]
private

◆ events

template<uint SYNCPOINTS>
Util::FixedArray<Threading::Event> Memory::RingAllocator< SYNCPOINTS >::events
private

◆ freeInterval

template<uint SYNCPOINTS>
Interval Memory::RingAllocator< SYNCPOINTS >::freeInterval
private

◆ lockedIntervals

template<uint SYNCPOINTS>
Util::FixedArray<Interval> Memory::RingAllocator< SYNCPOINTS >::lockedIntervals
private

◆ nextEvent

template<uint SYNCPOINTS>
uint Memory::RingAllocator< SYNCPOINTS >::nextEvent
private

◆ size

template<uint SYNCPOINTS>
uint Memory::RingAllocator< SYNCPOINTS >::size
private

◆ states

template<uint SYNCPOINTS>
Util::FixedArray<SyncState> Memory::RingAllocator< SYNCPOINTS >::states
private

The documentation for this class was generated from the following file: