Panda3D
Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
GeomCacheManager Class Reference

This is used to keep track of, and limit the size of, the cache of munged vertices, which would otherwise be distributed through all of the GeomVertexData objects in the system. More...

#include "geomCacheManager.h"

Public Member Functions

void evict_old_entries ()
 Trims the cache size down to get_max_size() by evicting old cache entries as needed. More...
 
void evict_old_entries (int max_size, bool keep_current)
 Trims the cache size down to the specified size by evicting old cache entries as needed. More...
 
void flush ()
 Immediately empties all elements in the cache. More...
 
int get_max_size () const
 Returns the maximum number of entries in the cache for storing pre- processed data for rendering vertices. More...
 
int get_total_size () const
 Returns the number of entries currently in the cache. More...
 
void set_max_size (int max_size) const
 Specifies the maximum number of entries in the cache for storing pre- processed data for rendering vertices. More...
 

Static Public Member Functions

static void flush_level ()
 Flushes the PStatCollectors used during traversal. More...
 
static GeomCacheManagerget_global_ptr ()
 Returns the global cache manager pointer. More...
 

Static Public Attributes

static PStatCollector _geom_cache_active_pcollector
 
static PStatCollector _geom_cache_erase_pcollector
 
static PStatCollector _geom_cache_evict_pcollector
 
static PStatCollector _geom_cache_record_pcollector
 
static PStatCollector _geom_cache_size_pcollector
 

Friends

class GeomCacheEntry
 

Detailed Description

This is used to keep track of, and limit the size of, the cache of munged vertices, which would otherwise be distributed through all of the GeomVertexData objects in the system.

The actual data in the cache is not stored here, but rather it is distributed among the various GeomVertexData source objects. This allows the cache data to propagate through the multiprocess pipeline.

This structure actually caches any of a number of different types of pointers, and mixes them all up in the same LRU cache list. Some of them (such as GeomMunger) are reference-counted here in the cache; most are not.

Definition at line 37 of file geomCacheManager.h.

Member Function Documentation

◆ evict_old_entries() [1/2]

void GeomCacheManager::evict_old_entries ( )
inline

Trims the cache size down to get_max_size() by evicting old cache entries as needed.

It is assumed that you already hold the lock before calling this method.

Definition at line 53 of file geomCacheManager.I.

References get_max_size().

Referenced by flush().

◆ evict_old_entries() [2/2]

void GeomCacheManager::evict_old_entries ( int  max_size,
bool  keep_current 
)

Trims the cache size down to the specified size by evicting old cache entries as needed.

It is assumed that you already hold the lock before calling this method.

Definition at line 82 of file geomCacheManager.cxx.

References ClockObject::get_frame_count, and ClockObject::get_global_clock().

◆ flush()

void GeomCacheManager::flush ( void  )

Immediately empties all elements in the cache.

Definition at line 57 of file geomCacheManager.cxx.

References evict_old_entries().

◆ flush_level()

void GeomCacheManager::flush_level ( )
inlinestatic

Flushes the PStatCollectors used during traversal.

Definition at line 61 of file geomCacheManager.I.

◆ get_global_ptr()

GeomCacheManager * GeomCacheManager::get_global_ptr ( )
static

Returns the global cache manager pointer.

Definition at line 69 of file geomCacheManager.cxx.

Referenced by GeomCacheEntry::refresh().

◆ get_max_size()

int GeomCacheManager::get_max_size ( ) const
inline

Returns the maximum number of entries in the cache for storing pre- processed data for rendering vertices.

See set_max_size().

Definition at line 35 of file geomCacheManager.I.

Referenced by evict_old_entries().

◆ get_total_size()

int GeomCacheManager::get_total_size ( ) const
inline

Returns the number of entries currently in the cache.

Definition at line 43 of file geomCacheManager.I.

◆ set_max_size()

void GeomCacheManager::set_max_size ( int  max_size) const
inline

Specifies the maximum number of entries in the cache for storing pre- processed data for rendering vertices.

This limit is flexible, and may be temporarily exceeded if many different Geoms are pre-processed during the space of a single frame.

This is not a limit on the actual vertex data, which is what it is; it is also not a limit on the amount of memory used by the video driver or the system graphics interface, which Panda has no control over.

Definition at line 25 of file geomCacheManager.I.


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