User Tools

Site Tools


Tracking Resource Usage

The SpeedTree SDK provides a straightforward mechanism for querying the space used by several internal resources.


Using the System

The SDK function CCore::GetSdkResourceUsage() can be called at any time. It will populate and return the following SResourceSummary structure:

struct SResourceSummary
{
    SResourceStats  m_sHeap; 
    SResourceStats  m_asGfxResources[GFX_RESOURCE_COUNT]; // indexed with EGfxResourceType
};

Where SResourceStats is defined as:

struct SResourceStats
{
    size_t  m_siCurrentUsage;    // bytes
    size_t  m_siPeakUsage;       // bytes
    size_t  m_siCurrentQuantity;
    size_t  m_siPeakQuantity;
};

SResourceSummary::m_asGfxResources is indexed with the enumeration EGfxResourceType, also defined in Core.h:

enum EGfxResourceType
{
    GFX_RESOURCE_VERTEX_BUFFER,
    GFX_RESOURCE_INDEX_BUFFER,
    GFX_RESOURCE_VERTEX_SHADER,
    GFX_RESOURCE_PIXEL_SHADER,
    GFX_RESOURCE_TEXTURE,
    GFX_RESOURCE_OTHER,
    GFX_RESOURCE_COUNT
};