14 #ifndef PREPAREDGRAPHICSOBJECTS_H 15 #define PREPAREDGRAPHICSOBJECTS_H 64 INLINE
const std::string &get_name()
const;
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;
71 INLINE
void release_all();
72 INLINE
int get_num_queued()
const;
73 INLINE
int get_num_prepared()
const;
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;
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;
89 bool is_sampler_queued(
const SamplerState &sampler)
const;
91 bool is_sampler_prepared(
const SamplerState &sampler)
const;
94 int release_all_samplers();
95 int get_num_queued_samplers()
const;
96 int get_num_prepared_samplers()
const;
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;
106 int release_all_geoms();
107 int get_num_queued_geoms()
const;
108 int get_num_prepared_geoms()
const;
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;
117 int release_all_shaders();
118 int get_num_queued_shaders()
const;
119 int get_num_prepared_shaders()
const;
128 int release_all_vertex_buffers();
129 int get_num_queued_vertex_buffers()
const;
130 int get_num_prepared_vertex_buffers()
const;
137 bool is_index_buffer_queued(
const GeomPrimitive *data)
const;
139 bool is_index_buffer_prepared(
const GeomPrimitive *data)
const;
141 int release_all_index_buffers();
142 int get_num_queued_index_buffers()
const;
143 int get_num_prepared_index_buffers()
const;
150 bool is_shader_buffer_queued(
const ShaderBuffer *data)
const;
152 bool is_shader_buffer_prepared(
const ShaderBuffer *data)
const;
154 int release_all_shader_buffers();
155 int get_num_queued_shader_buffers()
const;
156 int get_num_prepared_shader_buffers()
const;
175 void notify_removed();
176 virtual bool cancel()
final;
179 MAKE_PROPERTY(
object, get_object);
189 static void init_type() {
190 AsyncFuture::init_type();
192 AsyncFuture::get_class_type());
195 return get_class_type();
197 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
215 void end_frame(
Thread *current_thread);
218 static std::string init_name();
221 typedef phash_set<TextureContext *, pointer_hash> Textures;
223 typedef phash_set<GeomContext *, pointer_hash> Geoms;
224 typedef phash_set< PT(
Geom) > EnqueuedGeoms;
225 typedef phash_set<ShaderContext *, pointer_hash> Shaders;
227 typedef phash_set<BufferContext *, pointer_hash> Buffers;
230 typedef phash_set< PT(
ShaderBuffer) > EnqueuedShaderBuffers;
238 class BufferCacheKey {
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;
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);
258 GeomEnums::UsageHint usage_hint,
259 BufferCache &buffer_cache,
260 BufferCacheLRU &buffer_cache_lru,
261 size_t &buffer_cache_size);
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;
281 BufferCache _vertex_buffer_cache;
282 BufferCacheLRU _vertex_buffer_cache_lru;
283 size_t _vertex_buffer_cache_size;
285 BufferCache _index_buffer_cache;
286 BufferCacheLRU _index_buffer_cache_lru;
287 size_t _index_buffer_cache_size;
301 bool _support_released_buffer_cache;
304 static int _name_index;
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
An implementation of a very simple LRU algorithm.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a special class object that holds all the information returned by a particular GSG to indicat...
This class represents a thread-safe handle to a promised future result of an asynchronous operation,...
This is a generic buffer object that lives in graphics memory.
This is a special class object that holds all the information returned by a particular GSG to indicat...
This is a base class for those kinds of SavedContexts that occupy an easily-measured (and substantial...
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is an abstract base class for a family of classes that represent the fundamental geometry primit...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a special class object that holds all the information returned by a particular GSG to indicat...
This class is used to keep track of the current state of all the BufferContexts for a particular grap...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A table of objects that are saved within the graphics context for reference by handle later.
The ShaderContext is meant to contain the compiled version of a shader string.
TypedObject * get_result() const
Returns this future's result.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is our own Panda specialization on the default STL vector.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a handle to an enqueued object, from which the result can be obtained upon completion.
void set_result(std::nullptr_t)
Sets this future's result.
A container for geometry primitives.
A base class for things which need to inherit from both TypedWritable and from ReferenceCount.
A basic LRU-type algorithm, except that it is adaptive and attempts to avoid evicting pages that have...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Represents a set of settings that indicate how a texture is sampled.
This is a special class object that holds a handle to the sampler state object given by the graphics ...
A base class for all things that want to be reference-counted.
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
A thread; that is, a lightweight process.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a special class object that holds all the information returned by a particular GSG to indicat...
Encapsulates all the communication with a particular instance of a given rendering backend.
TypeHandle is the identifier used to differentiate C++ class types.
virtual bool cancel()
Cancels the future.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the base class for all GSG-specific context objects, such as TextureContext and GeomContext.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the data for one array of a GeomVertexData structure.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.