graphics_memory_limit_changed

This commit is contained in:
David Rose 2009-02-10 20:40:37 +00:00
parent d36782fbd0
commit a21091c9dc
3 changed files with 28 additions and 21 deletions

View File

@ -25,26 +25,6 @@ get_name() const {
return _name;
}
////////////////////////////////////////////////////////////////////
// Function: PreparedGraphicsObjects::set_graphics_memory_limit
// Access: Public
// Description: Sets an artificial cap on graphics memory that
// will be imposed on this GSG.
//
// This limits the total amount of graphics memory,
// including texture memory and vertex buffer memory,
// that will be consumed by the GSG, regardless of
// whether the hardware claims to provide more graphics
// memory than this. It is useful to put a ceiling on
// graphics memory consumed, since some drivers seem to
// allow the application to consume more memory than the
// hardware can realistically support.
////////////////////////////////////////////////////////////////////
INLINE void PreparedGraphicsObjects::
set_graphics_memory_limit(size_t limit) {
_graphics_memory_lru.set_max_size(limit);
}
////////////////////////////////////////////////////////////////////
// Function: PreparedGraphicsObjects::get_graphics_memory_limit
// Access: Public

View File

@ -25,6 +25,7 @@
#include "geomContext.h"
#include "shaderContext.h"
#include "config_gobj.h"
#include "throw_event.h"
int PreparedGraphicsObjects::_name_index = 0;
@ -101,6 +102,32 @@ PreparedGraphicsObjects::
_released_index_buffers.clear();
}
////////////////////////////////////////////////////////////////////
// Function: PreparedGraphicsObjects::set_graphics_memory_limit
// Access: Public
// Description: Sets an artificial cap on graphics memory that
// will be imposed on this GSG.
//
// This limits the total amount of graphics memory,
// including texture memory and vertex buffer memory,
// that will be consumed by the GSG, regardless of
// whether the hardware claims to provide more graphics
// memory than this. It is useful to put a ceiling on
// graphics memory consumed, since some drivers seem to
// allow the application to consume more memory than the
// hardware can realistically support.
////////////////////////////////////////////////////////////////////
void PreparedGraphicsObjects::
set_graphics_memory_limit(size_t limit) {
if (limit != _graphics_memory_lru.get_max_size()) {
_graphics_memory_lru.set_max_size(limit);
// We throw an event here so global objects (particularly the
// TexMemWatcher) can automatically respond to this change.
throw_event("graphics_memory_limit_changed");
}
}
////////////////////////////////////////////////////////////////////
// Function: PreparedGraphicsObjects::show_graphics_memory_lru
// Access: Public

View File

@ -63,7 +63,7 @@ public:
PUBLISHED:
INLINE const string &get_name() const;
INLINE void set_graphics_memory_limit(size_t limit);
void set_graphics_memory_limit(size_t limit);
INLINE size_t get_graphics_memory_limit() const;
void show_graphics_memory_lru(ostream &out) const;
void show_residency_trackers(ostream &out) const;