mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 17:35:34 -04:00
Texture::get_data_size_bytes() etc.
This commit is contained in:
parent
7d103e9d18
commit
aca2606187
@ -1128,6 +1128,66 @@ was_image_modified(PreparedGraphicsObjects *prepared_objects) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: Texture::get_data_size_bytes
|
||||
// Access: Public
|
||||
// Description: Returns the number of bytes which the texture is
|
||||
// reported to consume within graphics memory, for the
|
||||
// indicated GSG. This may return a nonzero value even
|
||||
// if the texture is not currently resident; you should
|
||||
// also check get_resident() if you want to know how
|
||||
// much space the texture is actually consuming right
|
||||
// now.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
size_t Texture::
|
||||
get_data_size_bytes(PreparedGraphicsObjects *prepared_objects) const {
|
||||
MutexHolder holder(_lock);
|
||||
Contexts::const_iterator ci;
|
||||
ci = _contexts.find(prepared_objects);
|
||||
if (ci != _contexts.end()) {
|
||||
TextureContext *tc = (*ci).second;
|
||||
return tc->get_data_size_bytes();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: Texture::get_active
|
||||
// Access: Public
|
||||
// Description: Returns true if this Texture was rendered in the most
|
||||
// recent frame within the indicated GSG.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool Texture::
|
||||
get_active(PreparedGraphicsObjects *prepared_objects) const {
|
||||
MutexHolder holder(_lock);
|
||||
Contexts::const_iterator ci;
|
||||
ci = _contexts.find(prepared_objects);
|
||||
if (ci != _contexts.end()) {
|
||||
TextureContext *tc = (*ci).second;
|
||||
return tc->get_active();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: Texture::get_resident
|
||||
// Access: Public
|
||||
// Description: Returns true if this Texture is reported to be
|
||||
// resident within graphics memory for the indicated
|
||||
// GSG.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool Texture::
|
||||
get_resident(PreparedGraphicsObjects *prepared_objects) const {
|
||||
MutexHolder holder(_lock);
|
||||
Contexts::const_iterator ci;
|
||||
ci = _contexts.find(prepared_objects);
|
||||
if (ci != _contexts.end()) {
|
||||
TextureContext *tc = (*ci).second;
|
||||
return tc->get_resident();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: Texture::release
|
||||
// Access: Published
|
||||
|
@ -355,6 +355,10 @@ PUBLISHED:
|
||||
void prepare(PreparedGraphicsObjects *prepared_objects);
|
||||
bool is_prepared(PreparedGraphicsObjects *prepared_objects) const;
|
||||
bool was_image_modified(PreparedGraphicsObjects *prepared_objects) const;
|
||||
size_t get_data_size_bytes(PreparedGraphicsObjects *prepared_objects) const;
|
||||
bool get_active(PreparedGraphicsObjects *prepared_objects) const;
|
||||
bool get_resident(PreparedGraphicsObjects *prepared_objects) const;
|
||||
|
||||
bool release(PreparedGraphicsObjects *prepared_objects);
|
||||
int release_all();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user