Panda3D
 All Classes Functions Variables Enumerations
preparedGraphicsObjects.I
1 // Filename: preparedGraphicsObjects.I
2 // Created by: drose (23Feb04)
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: PreparedGraphicsObjects::get_name
18 // Access: Public
19 // Description: Returns the name of the PreparedGraphicsObjects
20 // structure. This is an arbitrary name that serves
21 // mainly to uniquify the context for PStats reporting.
22 ////////////////////////////////////////////////////////////////////
23 INLINE const string &PreparedGraphicsObjects::
24 get_name() const {
25  return _name;
26 }
27 
28 ////////////////////////////////////////////////////////////////////
29 // Function: PreparedGraphicsObjects::get_graphics_memory_limit
30 // Access: Public
31 // Description: Returns the artificial cap on graphics memory that
32 // will be imposed on this GSG. See
33 // set_graphics_memory_limit().
34 ////////////////////////////////////////////////////////////////////
35 INLINE size_t PreparedGraphicsObjects::
37  return _graphics_memory_lru.get_max_size();
38 }
39 
40 ////////////////////////////////////////////////////////////////////
41 // Function: PreparedGraphicsObjects::release_all
42 // Access: Public
43 // Description: Releases all prepared objects of all kinds at once.
44 ////////////////////////////////////////////////////////////////////
45 INLINE void PreparedGraphicsObjects::
53 
54  _texture_residency.set_levels();
55  _vbuffer_residency.set_levels();
56  _ibuffer_residency.set_levels();
57 }
58 
59 ////////////////////////////////////////////////////////////////////
60 // Function: PreparedGraphicsObjects::get_num_queued
61 // Access: Public
62 // Description: Returns the number of objects of any kind that have
63 // been enqueued to be prepared on this GSG.
64 ////////////////////////////////////////////////////////////////////
66 get_num_queued() const {
67  return (get_num_queued_textures() +
73 }
74 
75 ////////////////////////////////////////////////////////////////////
76 // Function: PreparedGraphicsObjects::get_num_prepared
77 // Access: Public
78 // Description: Returns the number of objects of any kind that have
79 // already been prepared on this GSG.
80 ////////////////////////////////////////////////////////////////////
83  return (get_num_prepared_textures() +
89 }
90 
91 ////////////////////////////////////////////////////////////////////
92 // Function: PreparedGraphicsObjects::BufferCacheKey::operator <
93 // Access: Public
94 // Description:
95 ////////////////////////////////////////////////////////////////////
96 INLINE bool PreparedGraphicsObjects::BufferCacheKey::
97 operator < (const PreparedGraphicsObjects::BufferCacheKey &other) const {
98  if (_data_size_bytes != other._data_size_bytes) {
99  return _data_size_bytes < other._data_size_bytes;
100  }
101  return (int)_usage_hint < (int)other._usage_hint;
102 }
103 
104 ////////////////////////////////////////////////////////////////////
105 // Function: PreparedGraphicsObjects::BufferCacheKey::operator ==
106 // Access: Public
107 // Description:
108 ////////////////////////////////////////////////////////////////////
109 INLINE bool PreparedGraphicsObjects::BufferCacheKey::
110 operator == (const PreparedGraphicsObjects::BufferCacheKey &other) const {
111  return (_data_size_bytes == other._data_size_bytes &&
112  _usage_hint == other._usage_hint);
113 }
114 
115 ////////////////////////////////////////////////////////////////////
116 // Function: PreparedGraphicsObjects::BufferCacheKey::operator !=
117 // Access: Public
118 // Description:
119 ////////////////////////////////////////////////////////////////////
120 INLINE bool PreparedGraphicsObjects::BufferCacheKey::
121 operator != (const PreparedGraphicsObjects::BufferCacheKey &other) const {
122  return !operator == (other);
123 }
int release_all_shaders()
Releases all shaders at once.
int get_num_queued_samplers() const
Returns the number of samplers that have been enqueued to be prepared on this GSG.
int get_num_prepared_shaders() const
Returns the number of shaders that have already been 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_queued() const
Returns the number of objects of any kind 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.
int release_all_vertex_buffers()
Releases all datas at once.
void set_levels()
Resets the pstats levels to their appropriate values, possibly in the middle of a frame...
int get_num_prepared() const
Returns the number of objects of any kind that have already been prepared on this GSG...
const string & get_name() const
Returns the name of the PreparedGraphicsObjects structure.
int get_num_prepared_samplers() const
Returns the number of samplers that have already been prepared on this GSG.
int get_num_queued_geoms() const
Returns the number of geoms 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 get_num_prepared_vertex_buffers() const
Returns the number of vertex buffers that have already been prepared on this GSG. ...
int release_all_geoms()
Releases all geoms 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_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_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_queued_vertex_buffers() const
Returns the number of vertex buffers that have been enqueued to be 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:35
int release_all_index_buffers()
Releases all datas at once.
void release_all()
Releases all prepared objects of all kinds at once.