Panda3D

Loading...
Searching...
No Matches
preparedGraphicsObjects.h
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.h
10 * @author drose
11 * @date 2004-02-19
12 */
13
14#ifndef PREPAREDGRAPHICSOBJECTS_H
15#define PREPAREDGRAPHICSOBJECTS_H
16
17#include "pandabase.h"
18#include "referenceCount.h"
19#include "texture.h"
20#include "samplerState.h"
21#include "geom.h"
22#include "geomVertexArrayData.h"
23#include "geomPrimitive.h"
24#include "shader.h"
25#include "shaderBuffer.h"
26#include "pointerTo.h"
27#include "pStatCollector.h"
28#include "pset.h"
29#include "reMutex.h"
30#include "bufferResidencyTracker.h"
31#include "adaptiveLru.h"
32#include "asyncFuture.h"
33
34 class TextureContext;
35 class SamplerContext;
36 class GeomContext;
37 class ShaderContext;
38 class VertexBufferContext;
39 class IndexBufferContext;
40 class BufferContext;
41 class GraphicsStateGuardianBase;
42 class SavedContext;
43
44/**
45 * A table of objects that are saved within the graphics context for reference
46 * by handle later. Generally, this represents things like OpenGL texture
47 * objects or display lists (or their equivalent on other platforms).
48 *
49 * This object simply records the pointers to the context objects created by
50 * the individual GSG's; these context objects will contain enough information
51 * to reference or release the actual object stored within the graphics
52 * context.
53 *
54 * These tables may potentially be shared between related graphics contexts,
55 * hence their storage here in a separate object rather than as a part of the
56 * GraphicsStateGuardian.
57 */
58 class EXPCL_PANDA_GOBJ PreparedGraphicsObjects : public ReferenceCount {
59 public:
60 PreparedGraphicsObjects();
61 ~PreparedGraphicsObjects();
62
63PUBLISHED:
64 INLINE const std::string &get_name() const;
65
66 void set_graphics_memory_limit(size_t limit);
67 INLINE size_t get_graphics_memory_limit() const;
68 void show_graphics_memory_lru(std::ostream &out) const;
69 void show_residency_trackers(std::ostream &out) const;
70
71 INLINE void release_all();
72 INLINE int get_num_queued() const;
73 INLINE int get_num_prepared() const;
74
75 void enqueue_texture(Texture *tex);
76 bool is_texture_queued(const Texture *tex) const;
77 bool dequeue_texture(Texture *tex);
78 bool is_texture_prepared(const Texture *tex) const;
79 void release_texture(TextureContext *tc);
80 void release_texture(Texture *tex);
81 int release_all_textures();
82 int get_num_queued_textures() const;
83 int get_num_prepared_textures() const;
84
85 TextureContext *prepare_texture_now(Texture *tex, int view,
86 GraphicsStateGuardianBase *gsg);
87
88 void enqueue_sampler(const SamplerState &sampler);
89 bool is_sampler_queued(const SamplerState &sampler) const;
90 bool dequeue_sampler(const SamplerState &sampler);
91 bool is_sampler_prepared(const SamplerState &sampler) const;
92 void release_sampler(SamplerContext *sc);
93 void release_sampler(const SamplerState &sampler);
94 int release_all_samplers();
95 int get_num_queued_samplers() const;
96 int get_num_prepared_samplers() const;
97
98 SamplerContext *prepare_sampler_now(const SamplerState &sampler,
99 GraphicsStateGuardianBase *gsg);
100
101 void enqueue_geom(Geom *geom);
102 bool is_geom_queued(const Geom *geom) const;
103 bool dequeue_geom(Geom *geom);
104 bool is_geom_prepared(const Geom *geom) const;
105 void release_geom(GeomContext *gc);
106 int release_all_geoms();
107 int get_num_queued_geoms() const;
108 int get_num_prepared_geoms() const;
109
110 GeomContext *prepare_geom_now(Geom *geom, GraphicsStateGuardianBase *gsg);
111
112 void enqueue_shader(Shader *shader);
113 bool is_shader_queued(const Shader *shader) const;
114 bool dequeue_shader(Shader *shader);
115 bool is_shader_prepared(const Shader *shader) const;
116 void release_shader(ShaderContext *sc);
117 int release_all_shaders();
118 int get_num_queued_shaders() const;
119 int get_num_prepared_shaders() const;
120
121 ShaderContext *prepare_shader_now(Shader *shader, GraphicsStateGuardianBase *gsg);
122
123 void enqueue_vertex_buffer(GeomVertexArrayData *data);
124 bool is_vertex_buffer_queued(const GeomVertexArrayData *data) const;
125 bool dequeue_vertex_buffer(GeomVertexArrayData *data);
126 bool is_vertex_buffer_prepared(const GeomVertexArrayData *data) const;
127 void release_vertex_buffer(VertexBufferContext *vbc);
128 int release_all_vertex_buffers();
129 int get_num_queued_vertex_buffers() const;
130 int get_num_prepared_vertex_buffers() const;
131
132 VertexBufferContext *
133 prepare_vertex_buffer_now(GeomVertexArrayData *data,
134 GraphicsStateGuardianBase *gsg);
135
136 void enqueue_index_buffer(GeomPrimitive *data);
137 bool is_index_buffer_queued(const GeomPrimitive *data) const;
138 bool dequeue_index_buffer(GeomPrimitive *data);
139 bool is_index_buffer_prepared(const GeomPrimitive *data) const;
140 void release_index_buffer(IndexBufferContext *ibc);
141 int release_all_index_buffers();
142 int get_num_queued_index_buffers() const;
143 int get_num_prepared_index_buffers() const;
144
145 IndexBufferContext *
146 prepare_index_buffer_now(GeomPrimitive *data,
147 GraphicsStateGuardianBase *gsg);
148
149 void enqueue_shader_buffer(ShaderBuffer *data);
150 bool is_shader_buffer_queued(const ShaderBuffer *data) const;
151 bool dequeue_shader_buffer(ShaderBuffer *data);
152 bool is_shader_buffer_prepared(const ShaderBuffer *data) const;
153 void release_shader_buffer(BufferContext *bc);
154 int release_all_shader_buffers();
155 int get_num_queued_shader_buffers() const;
156 int get_num_prepared_shader_buffers() const;
157
158 BufferContext *
159 prepare_shader_buffer_now(ShaderBuffer *data,
160 GraphicsStateGuardianBase *gsg);
161
162 public:
163 /**
164 * This is a handle to an enqueued object, from which the result can be
165 * obtained upon completion.
166 */
167 class EXPCL_PANDA_GOBJ EnqueuedObject final : public AsyncFuture {
168 public:
169 EnqueuedObject(PreparedGraphicsObjects *pgo, TypedWritableReferenceCount *object);
170
171 TypedWritableReferenceCount *get_object() { return _object.p(); }
172 SavedContext *get_result() { return (SavedContext *)AsyncFuture::get_result(); }
173 void set_result(SavedContext *result);
174
175 void notify_removed();
176 virtual bool cancel() final;
177
178 PUBLISHED:
179 MAKE_PROPERTY(object, get_object);
180
181 private:
182 PreparedGraphicsObjects *_pgo;
183 PT(TypedWritableReferenceCount) const _object;
184
185 public:
186 static TypeHandle get_class_type() {
187 return _type_handle;
188 }
189 static void init_type() {
190 AsyncFuture::init_type();
191 register_type(_type_handle, "EnqueuedObject",
192 AsyncFuture::get_class_type());
193 }
194 virtual TypeHandle get_type() const {
195 return get_class_type();
196 }
197 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
198
199 private:
200 static TypeHandle _type_handle;
201 };
202
203 // These are variations of enqueue_xxx that also return a future. They are
204 // used to implement texture->prepare(), etc. They are only marked public
205 // so we don't have to define a whole bunch of friend classes.
206 PT(EnqueuedObject) enqueue_texture_future(Texture *tex);
207 //PT(EnqueuedObject) enqueue_geom_future(Geom *geom);
208 PT(EnqueuedObject) enqueue_shader_future(Shader *shader);
209 //PT(EnqueuedObject) enqueue_vertex_buffer_future(GeomVertexArrayData *data);
210 //PT(EnqueuedObject) enqueue_index_buffer_future(GeomPrimitive *data);
211 //PT(EnqueuedObject) enqueue_shader_buffer_future(ShaderBuffer *data);
212
213 void begin_frame(GraphicsStateGuardianBase *gsg,
214 Thread *current_thread);
215 void end_frame(Thread *current_thread);
216
217 private:
218 static std::string init_name();
219
220 private:
221 typedef phash_set<TextureContext *, pointer_hash> Textures;
222 typedef phash_map< PT(Texture), PT(EnqueuedObject) > EnqueuedTextures;
223 typedef phash_set<GeomContext *, pointer_hash> Geoms;
224 typedef phash_set< PT(Geom) > EnqueuedGeoms;
225 typedef phash_set<ShaderContext *, pointer_hash> Shaders;
226 typedef phash_map< PT(Shader), PT(EnqueuedObject) > EnqueuedShaders;
227 typedef phash_set<BufferContext *, pointer_hash> Buffers;
228 typedef phash_set< PT(GeomVertexArrayData) > EnqueuedVertexBuffers;
229 typedef phash_set< PT(GeomPrimitive) > EnqueuedIndexBuffers;
230 typedef phash_set< PT(ShaderBuffer) > EnqueuedShaderBuffers;
231
232 // Sampler states are stored a little bit differently, as they are mapped by
233 // value and can't store the list of prepared samplers.
234 typedef pmap<SamplerState, SamplerContext *> PreparedSamplers;
235 typedef pset<SamplerContext *, pointer_hash> ReleasedSamplers;
236 typedef pset<SamplerState> EnqueuedSamplers;
237
238 class BufferCacheKey {
239 public:
240 INLINE bool operator < (const BufferCacheKey &other) const;
241 INLINE bool operator == (const BufferCacheKey &other) const;
242 INLINE bool operator != (const BufferCacheKey &other) const;
243 size_t _data_size_bytes;
244 GeomEnums::UsageHint _usage_hint;
245 };
246 typedef pvector<BufferContext *> BufferList;
247 typedef pmap<BufferCacheKey, BufferList> BufferCache;
248 typedef plist<BufferCacheKey> BufferCacheLRU;
249
250 void cache_unprepared_buffer(BufferContext *buffer, size_t data_size_bytes,
251 GeomEnums::UsageHint usage_hint,
252 BufferCache &buffer_cache,
253 BufferCacheLRU &buffer_cache_lru,
254 size_t &buffer_cache_size,
255 int released_buffer_cache_size,
256 Buffers &released_buffers);
257 BufferContext *get_cached_buffer(size_t data_size_bytes,
258 GeomEnums::UsageHint usage_hint,
259 BufferCache &buffer_cache,
260 BufferCacheLRU &buffer_cache_lru,
261 size_t &buffer_cache_size);
262
263 ReMutex _lock;
264 std::string _name;
265 Textures _prepared_textures, _released_textures;
266 EnqueuedTextures _enqueued_textures;
267 PreparedSamplers _prepared_samplers;
268 ReleasedSamplers _released_samplers;
269 EnqueuedSamplers _enqueued_samplers;
270 Geoms _prepared_geoms, _released_geoms;
271 EnqueuedGeoms _enqueued_geoms;
272 Shaders _prepared_shaders, _released_shaders;
273 EnqueuedShaders _enqueued_shaders;
274 Buffers _prepared_vertex_buffers, _released_vertex_buffers;
275 EnqueuedVertexBuffers _enqueued_vertex_buffers;
276 Buffers _prepared_index_buffers, _released_index_buffers;
277 EnqueuedIndexBuffers _enqueued_index_buffers;
278 Buffers _prepared_shader_buffers, _released_shader_buffers;
279 EnqueuedShaderBuffers _enqueued_shader_buffers;
280
281 BufferCache _vertex_buffer_cache;
282 BufferCacheLRU _vertex_buffer_cache_lru;
283 size_t _vertex_buffer_cache_size;
284
285 BufferCache _index_buffer_cache;
286 BufferCacheLRU _index_buffer_cache_lru;
287 size_t _index_buffer_cache_size;
288
289 public:
290 BufferResidencyTracker _texture_residency;
291 BufferResidencyTracker _vbuffer_residency;
292 BufferResidencyTracker _ibuffer_residency;
293 BufferResidencyTracker _sbuffer_residency;
294
295 AdaptiveLru _graphics_memory_lru;
296 SimpleLru _sampler_object_lru;
297
298 public:
299 // This is only public as a temporary hack. Don't mess with it unless you
300 // know what you're doing.
301 bool _support_released_buffer_cache;
302
303 private:
304 static int _name_index;
305
306 friend class GraphicsStateGuardian;
307};
308
309#include "preparedGraphicsObjects.I"
310
311#endif
adaptiveLru.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
asyncFuture.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bufferResidencyTracker.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
AdaptiveLru
A basic LRU-type algorithm, except that it is adaptive and attempts to avoid evicting pages that have...
Definition adaptiveLru.h:45
AsyncFuture::AsyncFuture
AsyncFuture()
Initializes the future in the pending state.
Definition asyncFuture.I:18
AsyncFuture::get_result
TypedObject * get_result() const
Returns this future's result.
Definition asyncFuture.I:65
BufferContext
This is a base class for those kinds of SavedContexts that occupy an easily-measured (and substantial...
Definition bufferContext.h:38
BufferResidencyTracker
This class is used to keep track of the current state of all the BufferContexts for a particular grap...
Definition bufferResidencyTracker.h:32
GeomContext
This is a special class object that holds all the information returned by a particular GSG to indicat...
Definition geomContext.h:34
GeomPrimitive
This is an abstract base class for a family of classes that represent the fundamental geometry primit...
Definition geomPrimitive.h:56
GeomVertexArrayData
This is the data for one array of a GeomVertexData structure.
Definition geomVertexArrayData.h:58
Geom
A container for geometry primitives.
Definition geom.h:54
GraphicsStateGuardianBase
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
Definition graphicsStateGuardianBase.h:110
GraphicsStateGuardian
Encapsulates all the communication with a particular instance of a given rendering backend.
Definition graphicsStateGuardian.h:65
IndexBufferContext
This is a special class object that holds all the information returned by a particular GSG to indicat...
Definition indexBufferContext.h:33
PreparedGraphicsObjects::EnqueuedObject
This is a handle to an enqueued object, from which the result can be obtained upon completion.
Definition preparedGraphicsObjects.h:167
PreparedGraphicsObjects::EnqueuedObject::set_result
void set_result(SavedContext *result)
Indicates that the preparation request is done.
Definition preparedGraphicsObjects.cxx:1449
PreparedGraphicsObjects::EnqueuedObject::cancel
virtual bool cancel() final
Cancels the pending preparation request.
Definition preparedGraphicsObjects.cxx:1470
PreparedGraphicsObjects::EnqueuedObject::EnqueuedObject
EnqueuedObject(PreparedGraphicsObjects *pgo, TypedWritableReferenceCount *object)
Creates a new future for the given object.
Definition preparedGraphicsObjects.cxx:1440
PreparedGraphicsObjects::EnqueuedObject::notify_removed
void notify_removed()
Called by PreparedGraphicsObjects to indicate that the preparation request has been cancelled.
Definition preparedGraphicsObjects.cxx:1460
PreparedGraphicsObjects::enqueue_vertex_buffer
void enqueue_vertex_buffer(GeomVertexArrayData *data)
Indicates that a buffer would like to be put on the list to be prepared when the GSG is next ready to...
Definition preparedGraphicsObjects.cxx:888
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_sampler
void release_sampler(SamplerContext *sc)
Indicates that a sampler context, created by a previous call to prepare_sampler(),...
Definition preparedGraphicsObjects.cxx:444
PreparedGraphicsObjects::dequeue_vertex_buffer
bool dequeue_vertex_buffer(GeomVertexArrayData *data)
Removes a buffer from the queued list of data arrays to be prepared.
Definition preparedGraphicsObjects.cxx:916
PreparedGraphicsObjects::is_texture_queued
bool is_texture_queued(const Texture *tex) const
Returns true if the texture has been queued on this GSG, false otherwise.
Definition preparedGraphicsObjects.cxx:221
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::prepare_texture_now
TextureContext * prepare_texture_now(Texture *tex, int view, GraphicsStateGuardianBase *gsg)
Immediately creates a new TextureContext for the indicated texture and returns it.
Definition preparedGraphicsObjects.cxx:367
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::release_geom
void release_geom(GeomContext *gc)
Indicates that a geom context, created by a previous call to prepare_geom(), is no longer needed.
Definition preparedGraphicsObjects.cxx:604
PreparedGraphicsObjects::is_index_buffer_prepared
bool is_index_buffer_prepared(const GeomPrimitive *data) const
Returns true if the index buffer has been prepared on this GSG, false otherwise.
Definition preparedGraphicsObjects.cxx:1130
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::enqueue_sampler
void enqueue_sampler(const SamplerState &sampler)
Indicates that a sampler would like to be put on the list to be prepared when the GSG is next ready t...
Definition preparedGraphicsObjects.cxx:388
PreparedGraphicsObjects::enqueue_texture
void enqueue_texture(Texture *tex)
Indicates that a texture would like to be put on the list to be prepared when the GSG is next ready t...
Definition preparedGraphicsObjects.cxx:193
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::show_residency_trackers
void show_residency_trackers(std::ostream &out) const
Writes to the indicated ostream a report of how the various textures and vertex buffers are allocated...
Definition preparedGraphicsObjects.cxx:174
PreparedGraphicsObjects::is_shader_queued
bool is_shader_queued(const Shader *shader) const
Returns true if the shader has been queued on this GSG, false otherwise.
Definition preparedGraphicsObjects.cxx:730
PreparedGraphicsObjects::prepare_sampler_now
SamplerContext * prepare_sampler_now(const SamplerState &sampler, GraphicsStateGuardianBase *gsg)
Immediately creates a new SamplerContext for the indicated sampler and returns it.
Definition preparedGraphicsObjects.cxx:524
PreparedGraphicsObjects::is_geom_prepared
bool is_geom_prepared(const Geom *geom) const
Returns true if the vertex buffer has been prepared on this GSG, false otherwise.
Definition preparedGraphicsObjects.cxx:590
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::is_shader_buffer_queued
bool is_shader_buffer_queued(const ShaderBuffer *data) const
Returns true if the index buffer has been queued on this GSG, false otherwise.
Definition preparedGraphicsObjects.cxx:1294
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::dequeue_shader
bool dequeue_shader(Shader *shader)
Removes a shader from the queued list of shaders to be prepared.
Definition preparedGraphicsObjects.cxx:747
PreparedGraphicsObjects::is_texture_prepared
bool is_texture_prepared(const Texture *tex) const
Returns true if the texture has been prepared on this GSG, false otherwise.
Definition preparedGraphicsObjects.cxx:256
PreparedGraphicsObjects::release_shader_buffer
void release_shader_buffer(BufferContext *bc)
Indicates that a data context, created by a previous call to prepare_shader_buffer(),...
Definition preparedGraphicsObjects.cxx:1341
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::is_sampler_prepared
bool is_sampler_prepared(const SamplerState &sampler) const
Returns true if the sampler has been prepared on this GSG, false otherwise.
Definition preparedGraphicsObjects.cxx:430
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::is_sampler_queued
bool is_sampler_queued(const SamplerState &sampler) const
Returns true if the sampler has been queued on this GSG, false otherwise.
Definition preparedGraphicsObjects.cxx:398
PreparedGraphicsObjects::dequeue_sampler
bool dequeue_sampler(const SamplerState &sampler)
Removes a sampler from the queued list of samplers to be prepared.
Definition preparedGraphicsObjects.cxx:415
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::is_geom_queued
bool is_geom_queued(const Geom *geom) const
Returns true if the geom has been queued on this GSG, false otherwise.
Definition preparedGraphicsObjects.cxx:557
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_shader
void release_shader(ShaderContext *sc)
Indicates that a shader context, created by a previous call to prepare_shader(), is no longer needed.
Definition preparedGraphicsObjects.cxx:779
PreparedGraphicsObjects::release_all_shader_buffers
int release_all_shader_buffers()
Releases all datas at once.
Definition preparedGraphicsObjects.cxx:1363
PreparedGraphicsObjects::is_index_buffer_queued
bool is_index_buffer_queued(const GeomPrimitive *data) const
Returns true if the index buffer has been queued on this GSG, false otherwise.
Definition preparedGraphicsObjects.cxx:1097
PreparedGraphicsObjects::enqueue_texture_future
PointerTo< EnqueuedObject > enqueue_texture_future(Texture *tex)
Like enqueue_texture, but returns an AsyncFuture that can be used to query the status of the texture'...
Definition preparedGraphicsObjects.cxx:204
PreparedGraphicsObjects::is_shader_buffer_prepared
bool is_shader_buffer_prepared(const ShaderBuffer *data) const
Returns true if the index buffer has been prepared on this GSG, false otherwise.
Definition preparedGraphicsObjects.cxx:1327
PreparedGraphicsObjects::set_graphics_memory_limit
void set_graphics_memory_limit(size_t limit)
Sets an artificial cap on graphics memory that will be imposed on this GSG.
Definition preparedGraphicsObjects.cxx:150
PreparedGraphicsObjects::dequeue_texture
bool dequeue_texture(Texture *tex)
Removes a texture from the queued list of textures to be prepared.
Definition preparedGraphicsObjects.cxx:238
PreparedGraphicsObjects::prepare_geom_now
GeomContext * prepare_geom_now(Geom *geom, GraphicsStateGuardianBase *gsg)
Immediately creates a new GeomContext for the indicated geom and returns it.
Definition preparedGraphicsObjects.cxx:681
PreparedGraphicsObjects::end_frame
void end_frame(Thread *current_thread)
This is called by the GraphicsStateGuardian to indicate that it has finished processing of the frame.
Definition preparedGraphicsObjects.cxx:1674
PreparedGraphicsObjects::release_all_samplers
int release_all_samplers()
Releases all samplers at once.
Definition preparedGraphicsObjects.cxx:472
PreparedGraphicsObjects::show_graphics_memory_lru
void show_graphics_memory_lru(std::ostream &out) const
Writes to the indicated ostream a report of how the various textures and vertex buffers are allocated...
Definition preparedGraphicsObjects.cxx:165
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::dequeue_shader_buffer
bool dequeue_shader_buffer(ShaderBuffer *data)
Removes a buffer from the queued list of data arrays to be prepared.
Definition preparedGraphicsObjects.cxx:1311
PreparedGraphicsObjects::dequeue_geom
bool dequeue_geom(Geom *geom)
Removes a geom from the queued list of geoms to be prepared.
Definition preparedGraphicsObjects.cxx:574
PreparedGraphicsObjects::release_index_buffer
void release_index_buffer(IndexBufferContext *ibc)
Indicates that a data context, created by a previous call to prepare_index_buffer(),...
Definition preparedGraphicsObjects.cxx:1144
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::is_shader_prepared
bool is_shader_prepared(const Shader *shader) const
Returns true if the shader has been prepared on this GSG, false otherwise.
Definition preparedGraphicsObjects.cxx:765
PreparedGraphicsObjects::is_vertex_buffer_prepared
bool is_vertex_buffer_prepared(const GeomVertexArrayData *data) const
Returns true if the vertex buffer has been prepared on this GSG, false otherwise.
Definition preparedGraphicsObjects.cxx:932
PreparedGraphicsObjects::begin_frame
void begin_frame(GraphicsStateGuardianBase *gsg, Thread *current_thread)
This is called by the GraphicsStateGuardian to indicate that it is about to begin processing of the f...
Definition preparedGraphicsObjects.cxx:1512
PreparedGraphicsObjects::enqueue_index_buffer
void enqueue_index_buffer(GeomPrimitive *data)
Indicates that a buffer would like to be put on the list to be prepared when the GSG is next ready to...
Definition preparedGraphicsObjects.cxx:1086
PreparedGraphicsObjects::prepare_shader_buffer_now
BufferContext * prepare_shader_buffer_now(ShaderBuffer *data, GraphicsStateGuardianBase *gsg)
Immediately creates a new BufferContext for the indicated data and returns it.
Definition preparedGraphicsObjects.cxx:1420
PreparedGraphicsObjects::release_vertex_buffer
void release_vertex_buffer(VertexBufferContext *vbc)
Indicates that a data context, created by a previous call to prepare_vertex_buffer(),...
Definition preparedGraphicsObjects.cxx:946
PreparedGraphicsObjects::enqueue_shader
void enqueue_shader(Shader *shader)
Indicates that a shader would like to be put on the list to be prepared when the GSG is next ready to...
Definition preparedGraphicsObjects.cxx:702
PreparedGraphicsObjects::enqueue_geom
void enqueue_geom(Geom *geom)
Indicates that a geom would like to be put on the list to be prepared when the GSG is next ready to d...
Definition preparedGraphicsObjects.cxx:547
PreparedGraphicsObjects::is_vertex_buffer_queued
bool is_vertex_buffer_queued(const GeomVertexArrayData *data) const
Returns true if the vertex buffer has been queued on this GSG, false otherwise.
Definition preparedGraphicsObjects.cxx:899
PreparedGraphicsObjects::release_texture
void release_texture(TextureContext *tc)
Indicates that a texture context, created by a previous call to prepare_texture(),...
Definition preparedGraphicsObjects.cxx:270
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::enqueue_shader_future
PointerTo< EnqueuedObject > enqueue_shader_future(Shader *shader)
Like enqueue_shader, but returns an AsyncFuture that can be used to query the status of the shader's ...
Definition preparedGraphicsObjects.cxx:713
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
PreparedGraphicsObjects::prepare_index_buffer_now
IndexBufferContext * prepare_index_buffer_now(GeomPrimitive *data, GraphicsStateGuardianBase *gsg)
Immediately creates a new IndexBufferContext for the indicated data and returns it.
Definition preparedGraphicsObjects.cxx:1250
PreparedGraphicsObjects::prepare_shader_now
ShaderContext * prepare_shader_now(Shader *shader, GraphicsStateGuardianBase *gsg)
Immediately creates a new ShaderContext for the indicated shader and returns it.
Definition preparedGraphicsObjects.cxx:867
PreparedGraphicsObjects::enqueue_shader_buffer
void enqueue_shader_buffer(ShaderBuffer *data)
Indicates that a buffer would like to be put on the list to be prepared when the GSG is next ready to...
Definition preparedGraphicsObjects.cxx:1283
PreparedGraphicsObjects::prepare_vertex_buffer_now
VertexBufferContext * prepare_vertex_buffer_now(GeomVertexArrayData *data, GraphicsStateGuardianBase *gsg)
Immediately creates a new VertexBufferContext for the indicated data and returns it.
Definition preparedGraphicsObjects.cxx:1053
PreparedGraphicsObjects::dequeue_index_buffer
bool dequeue_index_buffer(GeomPrimitive *data)
Removes a buffer from the queued list of data arrays to be prepared.
Definition preparedGraphicsObjects.cxx:1114
ReMutex
A reentrant mutex.
Definition reMutex.h:34
SamplerContext
This is a special class object that holds a handle to the sampler state object given by the graphics ...
Definition samplerContext.h:34
SamplerState
Represents a set of settings that indicate how a texture is sampled.
Definition samplerState.h:36
SavedContext
This is the base class for all GSG-specific context objects, such as TextureContext and GeomContext.
Definition savedContext.h:26
ShaderBuffer
This is a generic buffer object that lives in graphics memory.
Definition shaderBuffer.h:33
ShaderContext
The ShaderContext is meant to contain the compiled version of a shader string.
Definition shaderContext.h:31
Shader
Definition shader.h:49
SimpleLru
An implementation of a very simple LRU algorithm.
Definition simpleLru.h:28
TextureContext
This is a special class object that holds all the information returned by a particular GSG to indicat...
Definition textureContext.h:33
Texture
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
Definition texture.h:72
Thread
A thread; that is, a lightweight process.
Definition thread.h:46
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
TypedWritableReferenceCount
A base class for things which need to inherit from both TypedWritable and from ReferenceCount.
Definition typedWritableReferenceCount.h:31
VertexBufferContext
This is a special class object that holds all the information returned by a particular GSG to indicat...
Definition vertexBufferContext.h:33
plist
This is our own Panda specialization on the default STL list.
Definition plist.h:35
geomPrimitive.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
geomVertexArrayData.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
geom.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pStatCollector.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pointerTo.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
preparedGraphicsObjects.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pset.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
reMutex.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
referenceCount.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition register_type.I:22
samplerState.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
shaderBuffer.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
shader.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
texture.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.