Panda3D
preparedGraphicsObjects.I
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file preparedGraphicsObjects.I
10  * @author drose
11  * @date 2004-02-23
12  */
13 
14 /**
15  * Returns the name of the PreparedGraphicsObjects structure. This is an
16  * arbitrary name that serves mainly to uniquify the context for PStats
17  * reporting.
18  */
19 INLINE const std::string &PreparedGraphicsObjects::
20 get_name() const {
21  return _name;
22 }
23 
24 /**
25  * Returns the artificial cap on graphics memory that will be imposed on this
26  * GSG. See set_graphics_memory_limit().
27  */
28 INLINE size_t PreparedGraphicsObjects::
30  return _graphics_memory_lru.get_max_size();
31 }
32 
33 /**
34  * Releases all prepared objects of all kinds at once.
35  */
36 INLINE void PreparedGraphicsObjects::
44 
45  _texture_residency.set_levels();
46  _vbuffer_residency.set_levels();
47  _ibuffer_residency.set_levels();
48  _sbuffer_residency.set_levels();
49 }
50 
51 /**
52  * Returns the number of objects of any kind that have been enqueued to be
53  * prepared on this GSG.
54  */
56 get_num_queued() const {
57  return (get_num_queued_textures() +
64 }
65 
66 /**
67  * Returns the number of objects of any kind that have already been prepared
68  * on this GSG.
69  */
72  return (get_num_prepared_textures() +
79 }
80 
81 /**
82  *
83  */
84 INLINE bool PreparedGraphicsObjects::BufferCacheKey::
85 operator < (const PreparedGraphicsObjects::BufferCacheKey &other) const {
86  if (_data_size_bytes != other._data_size_bytes) {
87  return _data_size_bytes < other._data_size_bytes;
88  }
89  return (int)_usage_hint < (int)other._usage_hint;
90 }
91 
92 /**
93  *
94  */
95 INLINE bool PreparedGraphicsObjects::BufferCacheKey::
96 operator == (const PreparedGraphicsObjects::BufferCacheKey &other) const {
97  return (_data_size_bytes == other._data_size_bytes &&
98  _usage_hint == other._usage_hint);
99 }
100 
101 /**
102  *
103  */
104 INLINE bool PreparedGraphicsObjects::BufferCacheKey::
105 operator != (const PreparedGraphicsObjects::BufferCacheKey &other) const {
106  return !operator == (other);
107 }
int release_all_shaders()
Releases all shaders at once.
int get_num_queued_vertex_buffers() const
Returns the number of vertex buffers that have been enqueued to be prepared on this GSG.
size_t get_graphics_memory_limit() const
Returns the artificial cap on graphics memory that will be imposed on this GSG.
const std::string & get_name() const
Returns the name of the PreparedGraphicsObjects structure.
int get_num_queued_geoms() const
Returns the number of geoms that have been enqueued to be prepared on this GSG.
int release_all_vertex_buffers()
Releases all datas at once.
int get_num_prepared_textures() const
Returns the number of textures that have already been prepared on this GSG.
int get_num_prepared_vertex_buffers() const
Returns the number of vertex buffers that have already been prepared on this GSG.
void set_levels()
Resets the pstats levels to their appropriate values, possibly in the middle of a frame.
int get_num_queued_shader_buffers() const
Returns the number of index buffers that have been enqueued to be prepared on this GSG.
int get_num_queued_textures() const
Returns the number of textures that have been enqueued to be prepared on this GSG.
int get_num_prepared_index_buffers() const
Returns the number of index buffers that have already been prepared on this GSG.
int get_num_queued_index_buffers() const
Returns the number of index buffers that have been enqueued to be prepared on this GSG.
int get_num_prepared_shader_buffers() const
Returns the number of index buffers that have already been prepared on this GSG.
size_t get_max_size() const
Returns the max size of all objects that are allowed to be active on the LRU.
Definition: adaptiveLru.I:28
int get_num_queued_samplers() const
Returns the number of samplers that have been enqueued to be prepared on this GSG.
int get_num_queued_shaders() const
Returns the number of shaders that have been enqueued to be prepared on this GSG.
int release_all_textures()
Releases all textures at once.
int release_all_geoms()
Releases all geoms at once.
int get_num_prepared_shaders() const
Returns the number of shaders that have already been prepared on this GSG.
int get_num_queued() const
Returns the number of objects of any kind that have been enqueued to be prepared on this GSG.
int get_num_prepared() const
Returns the number of objects of any kind that have already been prepared on this GSG.
int get_num_prepared_geoms() const
Returns the number of geoms that have already been prepared on this GSG.
int release_all_samplers()
Releases all samplers at once.
int get_num_prepared_samplers() const
Returns the number of samplers that have already been prepared on this GSG.
int release_all_index_buffers()
Releases all datas at once.
void release_all()
Releases all prepared objects of all kinds at once.