Panda3D
 All Classes Functions Variables Enumerations
geomCacheManager.I
1 // Filename: geomCacheManager.I
2 // Created by: drose (11Mar05)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: GeomCacheManager::set_max_size
18 // Access: Published
19 // Description: Specifies the maximum number of entries in the cache
20 // for storing pre-processed data for rendering
21 // vertices. This limit is flexible, and may be
22 // temporarily exceeded if many different Geoms are
23 // pre-processed during the space of a single frame.
24 //
25 // This is not a limit on the actual vertex data, which
26 // is what it is; it is also not a limit on the amount
27 // of memory used by the video driver or the system
28 // graphics interface, which Panda has no control over.
29 ////////////////////////////////////////////////////////////////////
30 INLINE void GeomCacheManager::
31 set_max_size(int max_size) const {
32  // We directly change the config variable.
33  geom_cache_size = max_size;
34 }
35 
36 ////////////////////////////////////////////////////////////////////
37 // Function: GeomCacheManager::get_max_size
38 // Access: Published
39 // Description: Returns the maximum number of entries in the cache
40 // for storing pre-processed data for rendering
41 // vertices. See set_max_size().
42 ////////////////////////////////////////////////////////////////////
43 INLINE int GeomCacheManager::
44 get_max_size() const {
45  return geom_cache_size;
46 }
47 
48 ////////////////////////////////////////////////////////////////////
49 // Function: GeomCacheManager::get_total_size
50 // Access: Published
51 // Description: Returns the number of entries currently in the cache.
52 ////////////////////////////////////////////////////////////////////
53 INLINE int GeomCacheManager::
54 get_total_size() const {
55  return _total_size;
56 }
57 
58 ////////////////////////////////////////////////////////////////////
59 // Function: GeomCacheManager::evict_old_entries
60 // Access: Public
61 // Description: Trims the cache size down to get_max_size() by
62 // evicting old cache entries as needed. It is assumed
63 // that you already hold the lock before calling this
64 // method.
65 ////////////////////////////////////////////////////////////////////
66 INLINE void GeomCacheManager::
69 }
70 
71 ////////////////////////////////////////////////////////////////////
72 // Function: GeomCacheManager::flush_level
73 // Access: Public, Static
74 // Description: Flushes the PStatCollectors used during traversal.
75 ////////////////////////////////////////////////////////////////////
76 INLINE void GeomCacheManager::
78  _geom_cache_size_pcollector.flush_level();
79  _geom_cache_active_pcollector.flush_level();
80  _geom_cache_record_pcollector.flush_level();
81  _geom_cache_erase_pcollector.flush_level();
82  _geom_cache_evict_pcollector.flush_level();
83 }
void set_max_size(int max_size) const
Specifies the maximum number of entries in the cache for storing pre-processed data for rendering ver...
int get_total_size() const
Returns the number of entries currently in the cache.
static void flush_level()
Flushes the PStatCollectors used during traversal.
void evict_old_entries()
Trims the cache size down to get_max_size() by evicting old cache entries as needed.
int get_max_size() const
Returns the maximum number of entries in the cache for storing pre-processed data for rendering verti...