Torque2D Reference
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
FrameAllocator Class Reference

#include <frameAllocator.h>

Static Public Member Functions

static void init (const U32 frameSize)
 
static void destroy ()
 
static void * alloc (const U32 allocSize)
 
static void setWaterMark (const U32)
 
static U32 getWaterMark ()
 
static U32 getHighWaterMark ()
 

Detailed Description

Temporary memory pool for per-frame allocations.

In the course of rendering a frame, it is often necessary to allocate many small chunks of memory, then free them all in a batch. For instance, say we're allocating storage for some vertex calculations:

// Get FrameAllocator memory...
U32 waterMark = FrameAllocator::getWaterMark();
F32 * ptr = (F32*)FrameAllocator::alloc(sizeof(F32)*2*targetMesh->vertsPerFrame);
... calculations ...
// Free frameAllocator memory
FrameAllocator::setWaterMark(waterMark);
static U32 getWaterMark()
Definition frameAllocator.h:141
static void * alloc(const U32 allocSize)
Definition frameAllocator.h:95

Member Function Documentation

◆ alloc()

void * alloc ( const U32  allocSize)
inlinestatic

◆ destroy()

void destroy ( )
inlinestatic

◆ getHighWaterMark()

U32 getHighWaterMark ( )
inlinestatic

◆ getWaterMark()

U32 getWaterMark ( )
inlinestatic

◆ init()

void init ( const U32  frameSize)
inlinestatic

◆ setWaterMark()

void setWaterMark ( const U32  waterMark)
inlinestatic

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