Panda3D
 All Classes Functions Variables Enumerations
geomCacheManager.I
00001 // Filename: geomCacheManager.I
00002 // Created by:  drose (11Mar05)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 
00016 ////////////////////////////////////////////////////////////////////
00017 //     Function: GeomCacheManager::set_max_size
00018 //       Access: Published
00019 //  Description: Specifies the maximum number of entries in the cache
00020 //               for storing pre-processed data for rendering
00021 //               vertices.  This limit is flexible, and may be
00022 //               temporarily exceeded if many different Geoms are
00023 //               pre-processed during the space of a single frame.
00024 //
00025 //               This is not a limit on the actual vertex data, which
00026 //               is what it is; it is also not a limit on the amount
00027 //               of memory used by the video driver or the system
00028 //               graphics interface, which Panda has no control over.
00029 ////////////////////////////////////////////////////////////////////
00030 INLINE void GeomCacheManager::
00031 set_max_size(int max_size) const {
00032   // We directly change the config variable.
00033   geom_cache_size = max_size;
00034 }
00035 
00036 ////////////////////////////////////////////////////////////////////
00037 //     Function: GeomCacheManager::get_max_size
00038 //       Access: Published
00039 //  Description: Returns the maximum number of entries in the cache
00040 //               for storing pre-processed data for rendering
00041 //               vertices.  See set_max_size().
00042 ////////////////////////////////////////////////////////////////////
00043 INLINE int GeomCacheManager::
00044 get_max_size() const {
00045   return geom_cache_size;
00046 }
00047 
00048 ////////////////////////////////////////////////////////////////////
00049 //     Function: GeomCacheManager::get_total_size
00050 //       Access: Published
00051 //  Description: Returns the number of entries currently in the cache.
00052 ////////////////////////////////////////////////////////////////////
00053 INLINE int GeomCacheManager::
00054 get_total_size() const {
00055   return _total_size;
00056 }
00057 
00058 ////////////////////////////////////////////////////////////////////
00059 //     Function: GeomCacheManager::evict_old_entries
00060 //       Access: Public
00061 //  Description: Trims the cache size down to get_max_size() by
00062 //               evicting old cache entries as needed.  It is assumed
00063 //               that you already hold the lock before calling this
00064 //               method.
00065 ////////////////////////////////////////////////////////////////////
00066 INLINE void GeomCacheManager::
00067 evict_old_entries() {
00068   evict_old_entries(get_max_size(), true);
00069 }
00070 
00071 ////////////////////////////////////////////////////////////////////
00072 //     Function: GeomCacheManager::flush_level
00073 //       Access: Public, Static
00074 //  Description: Flushes the PStatCollectors used during traversal.
00075 ////////////////////////////////////////////////////////////////////
00076 INLINE void GeomCacheManager::
00077 flush_level() {
00078   _geom_cache_size_pcollector.flush_level();
00079   _geom_cache_active_pcollector.flush_level();
00080   _geom_cache_record_pcollector.flush_level();
00081   _geom_cache_erase_pcollector.flush_level();
00082   _geom_cache_evict_pcollector.flush_level();
00083 }
 All Classes Functions Variables Enumerations