Panda3D

Loading...
Searching...
No Matches
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 */
19INLINE 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 */
28INLINE size_t PreparedGraphicsObjects::
29 get_graphics_memory_limit() const {
30 return _graphics_memory_lru.get_max_size();
31}
32
33/**
34 * Releases all prepared objects of all kinds at once.
35 */
36INLINE void PreparedGraphicsObjects::
37 release_all() {
38 release_all_textures();
39 release_all_samplers();
40 release_all_geoms();
41 release_all_shaders();
42 release_all_vertex_buffers();
43 release_all_index_buffers();
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 */
55INLINE int PreparedGraphicsObjects::
56 get_num_queued() const {
57 return (get_num_queued_textures() +
58 get_num_queued_samplers() +
59 get_num_queued_geoms() +
60 get_num_queued_shaders() +
61 get_num_queued_vertex_buffers() +
62 get_num_queued_index_buffers() +
63 get_num_queued_shader_buffers());
64}
65
66/**
67 * Returns the number of objects of any kind that have already been prepared
68 * on this GSG.
69 */
70INLINE int PreparedGraphicsObjects::
71 get_num_prepared() const {
72 return (get_num_prepared_textures() +
73 get_num_prepared_samplers() +
74 get_num_prepared_geoms() +
75 get_num_prepared_shaders() +
76 get_num_prepared_vertex_buffers() +
77 get_num_prepared_index_buffers() +
78 get_num_prepared_shader_buffers());
79}
80
81/**
82 *
83 */
84INLINE bool PreparedGraphicsObjects::BufferCacheKey::
85operator < (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 */
95INLINE bool PreparedGraphicsObjects::BufferCacheKey::
96operator == (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 */
104INLINE bool PreparedGraphicsObjects::BufferCacheKey::
105operator != (const PreparedGraphicsObjects::BufferCacheKey &other) const {
106 return !operator == (other);
107}
PreparedGraphicsObjects::get_num_queued_geoms
int get_num_queued_geoms() const
Returns the number of geoms that have been enqueued to be prepared on this GSG.
Definition preparedGraphicsObjects.cxx:652
PreparedGraphicsObjects::release_all_geoms
int release_all_geoms()
Releases all geoms at once.
Definition preparedGraphicsObjects.cxx:625
PreparedGraphicsObjects::release_all_textures
int release_all_textures()
Releases all textures at once.
Definition preparedGraphicsObjects.cxx:300
PreparedGraphicsObjects::get_num_prepared_shaders
int get_num_prepared_shaders() const
Returns the number of shaders that have already been prepared on this GSG.
Definition preparedGraphicsObjects.cxx:846
PreparedGraphicsObjects::get_num_queued_index_buffers
int get_num_queued_index_buffers() const
Returns the number of index buffers that have been enqueued to be prepared on this GSG.
Definition preparedGraphicsObjects.cxx:1220
PreparedGraphicsObjects::get_num_prepared_shader_buffers
int get_num_prepared_shader_buffers() const
Returns the number of index buffers that have already been prepared on this GSG.
Definition preparedGraphicsObjects.cxx:1399
PreparedGraphicsObjects::get_num_prepared_vertex_buffers
int get_num_prepared_vertex_buffers() const
Returns the number of vertex buffers that have already been prepared on this GSG.
Definition preparedGraphicsObjects.cxx:1031
PreparedGraphicsObjects::get_num_prepared_textures
int get_num_prepared_textures() const
Returns the number of textures that have already been prepared on this GSG.
Definition preparedGraphicsObjects.cxx:346
PreparedGraphicsObjects::get_num_queued_vertex_buffers
int get_num_queued_vertex_buffers() const
Returns the number of vertex buffers that have been enqueued to be prepared on this GSG.
Definition preparedGraphicsObjects.cxx:1022
PreparedGraphicsObjects::get_num_queued_samplers
int get_num_queued_samplers() const
Returns the number of samplers that have been enqueued to be prepared on this GSG.
Definition preparedGraphicsObjects.cxx:495
PreparedGraphicsObjects::get_num_queued_shaders
int get_num_queued_shaders() const
Returns the number of shaders that have been enqueued to be prepared on this GSG.
Definition preparedGraphicsObjects.cxx:838
PreparedGraphicsObjects::get_num_prepared
int get_num_prepared() const
Returns the number of objects of any kind that have already been prepared on this GSG.
Definition preparedGraphicsObjects.I:71
PreparedGraphicsObjects::get_name
const std::string & get_name() const
Returns the name of the PreparedGraphicsObjects structure.
Definition preparedGraphicsObjects.I:20
PreparedGraphicsObjects::release_all_shaders
int release_all_shaders()
Releases all shaders at once.
Definition preparedGraphicsObjects.cxx:800
PreparedGraphicsObjects::get_num_queued_textures
int get_num_queued_textures() const
Returns the number of textures that have been enqueued to be prepared on this GSG.
Definition preparedGraphicsObjects.cxx:338
PreparedGraphicsObjects::release_all_index_buffers
int release_all_index_buffers()
Releases all datas at once.
Definition preparedGraphicsObjects.cxx:1176
PreparedGraphicsObjects::release_all
void release_all()
Releases all prepared objects of all kinds at once.
Definition preparedGraphicsObjects.I:37
PreparedGraphicsObjects::get_num_prepared_geoms
int get_num_prepared_geoms() const
Returns the number of geoms that have already been prepared on this GSG.
Definition preparedGraphicsObjects.cxx:660
PreparedGraphicsObjects::release_all_samplers
int release_all_samplers()
Releases all samplers at once.
Definition preparedGraphicsObjects.cxx:472
PreparedGraphicsObjects::get_num_queued
int get_num_queued() const
Returns the number of objects of any kind that have been enqueued to be prepared on this GSG.
Definition preparedGraphicsObjects.I:56
PreparedGraphicsObjects::get_graphics_memory_limit
size_t get_graphics_memory_limit() const
Returns the artificial cap on graphics memory that will be imposed on this GSG.
Definition preparedGraphicsObjects.I:29
PreparedGraphicsObjects::get_num_prepared_samplers
int get_num_prepared_samplers() const
Returns the number of samplers that have already been prepared on this GSG.
Definition preparedGraphicsObjects.cxx:503
PreparedGraphicsObjects::get_num_queued_shader_buffers
int get_num_queued_shader_buffers() const
Returns the number of index buffers that have been enqueued to be prepared on this GSG.
Definition preparedGraphicsObjects.cxx:1390
PreparedGraphicsObjects::release_all_vertex_buffers
int release_all_vertex_buffers()
Releases all datas at once.
Definition preparedGraphicsObjects.cxx:978
PreparedGraphicsObjects::get_num_prepared_index_buffers
int get_num_prepared_index_buffers() const
Returns the number of index buffers that have already been prepared on this GSG.
Definition preparedGraphicsObjects.cxx:1229