mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
report "active" vertex data
This commit is contained in:
parent
77a7c6ab71
commit
a50ae3fcbf
@ -78,6 +78,7 @@ PStatCollector GraphicsEngine::_delete_pcollector("App:Delete");
|
||||
|
||||
|
||||
PStatCollector GraphicsEngine::_sw_sprites_pcollector("SW Sprites");
|
||||
PStatCollector GraphicsEngine::_vertex_data_active_pcollector("Vertex Data:Active");
|
||||
PStatCollector GraphicsEngine::_vertex_data_resident_pcollector("Vertex Data:Resident");
|
||||
PStatCollector GraphicsEngine::_vertex_data_compressed_pcollector("Vertex Data:Compressed");
|
||||
PStatCollector GraphicsEngine::_vertex_data_disk_pcollector("Vertex Data:Disk");
|
||||
@ -679,8 +680,6 @@ render_frame() {
|
||||
deletor->flush();
|
||||
}
|
||||
|
||||
GeomVertexArrayData::lru_epoch();
|
||||
|
||||
GeomCacheManager::flush_level();
|
||||
CullTraverser::flush_level();
|
||||
RenderState::flush_level();
|
||||
@ -723,9 +722,6 @@ render_frame() {
|
||||
}
|
||||
|
||||
_sw_sprites_pcollector.clear_level();
|
||||
_vertex_data_resident_pcollector.set_level(GeomVertexArrayData::get_global_lru(GeomVertexArrayData::RC_resident)->get_total_size());
|
||||
_vertex_data_compressed_pcollector.set_level(GeomVertexArrayData::get_global_lru(GeomVertexArrayData::RC_compressed)->get_total_size());
|
||||
_vertex_data_disk_pcollector.set_level(GeomVertexArrayData::get_global_lru(GeomVertexArrayData::RC_disk)->get_total_size());
|
||||
|
||||
_cnode_volume_pcollector.clear_level();
|
||||
_gnode_volume_pcollector.clear_level();
|
||||
@ -746,8 +742,20 @@ render_frame() {
|
||||
_volume_geom_pcollector.clear_level();
|
||||
_test_geom_pcollector.clear_level();
|
||||
|
||||
if (PStatClient::is_connected()) {
|
||||
size_t resident = GeomVertexArrayData::get_global_lru(GeomVertexArrayData::RC_resident)->get_total_size();
|
||||
size_t active = GeomVertexArrayData::get_global_lru(GeomVertexArrayData::RC_resident)->count_active_size();
|
||||
_vertex_data_active_pcollector.set_level(active);
|
||||
_vertex_data_resident_pcollector.set_level(resident - active);
|
||||
_vertex_data_compressed_pcollector.set_level(GeomVertexArrayData::get_global_lru(GeomVertexArrayData::RC_compressed)->get_total_size());
|
||||
_vertex_data_disk_pcollector.set_level(GeomVertexArrayData::get_global_lru(GeomVertexArrayData::RC_disk)->get_total_size());
|
||||
|
||||
}
|
||||
|
||||
#endif // DO_PSTATS
|
||||
|
||||
GeomVertexArrayData::lru_epoch();
|
||||
|
||||
// Now signal all of our threads to begin their next frame.
|
||||
Threads::const_iterator ti;
|
||||
for (ti = _threads.begin(); ti != _threads.end(); ++ti) {
|
||||
|
@ -360,6 +360,7 @@ private:
|
||||
static PStatCollector _delete_pcollector;
|
||||
|
||||
static PStatCollector _sw_sprites_pcollector;
|
||||
static PStatCollector _vertex_data_active_pcollector;
|
||||
static PStatCollector _vertex_data_resident_pcollector;
|
||||
static PStatCollector _vertex_data_compressed_pcollector;
|
||||
static PStatCollector _vertex_data_disk_pcollector;
|
||||
|
@ -369,11 +369,11 @@ release_all() {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void GeomVertexArrayData::
|
||||
lru_epoch() {
|
||||
_ram_lru.consider_evict();
|
||||
_compressed_lru.consider_evict();
|
||||
_ram_lru.begin_epoch();
|
||||
_compressed_lru.begin_epoch();
|
||||
|
||||
// No automatic eviction from the Disk LRU.
|
||||
//_disk_lru.consider_evict();
|
||||
//_disk_lru.begin_epoch();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
@ -17,17 +17,6 @@
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: SimpleLru::Constructor
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
SimpleLru::
|
||||
SimpleLru(size_t max_size) : LinkedListNode(true) {
|
||||
_total_size = 0;
|
||||
_max_size = max_size;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: SimpleLru::get_total_size
|
||||
// Access: Published
|
||||
@ -76,6 +65,20 @@ consider_evict() {
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: SimpleLru::begin_epoch
|
||||
// Access: Published
|
||||
// Description: Marks the end of the previous epoch and the beginning
|
||||
// of the next one. This will evict any objects that
|
||||
// are pending eviction, and also update any internal
|
||||
// bookkeeping.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void SimpleLru::
|
||||
begin_epoch() {
|
||||
consider_evict();
|
||||
_active_marker->enqueue_lru(this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: SimpleLruPage::Constructor
|
||||
// Access: Protected
|
||||
|
@ -19,6 +19,18 @@
|
||||
#include "simpleLru.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: SimpleLru::Constructor
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
SimpleLru::
|
||||
SimpleLru(size_t max_size) : LinkedListNode(true) {
|
||||
_total_size = 0;
|
||||
_max_size = max_size;
|
||||
_active_marker = new SimpleLruPage(0);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: SimpleLru::Destructor
|
||||
// Access: Published, Virtual
|
||||
@ -26,6 +38,8 @@
|
||||
////////////////////////////////////////////////////////////////////
|
||||
SimpleLru::
|
||||
~SimpleLru() {
|
||||
delete _active_marker;
|
||||
|
||||
#ifndef NDEBUG
|
||||
// We're shutting down. Force-remove everything remaining, but
|
||||
// don't explicitly evict it (that would force vertex buffers to
|
||||
@ -38,6 +52,25 @@ SimpleLru::
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: SimpleLru::count_active_size
|
||||
// Access: Published
|
||||
// Description: Returns the total size of the pages that were
|
||||
// enqueued since the last call to begin_epoch().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
size_t SimpleLru::
|
||||
count_active_size() const {
|
||||
size_t total = 0;
|
||||
|
||||
LinkedListNode *node = _prev;
|
||||
while (node != _active_marker && node != this) {
|
||||
total += ((SimpleLruPage *)node)->get_lru_size();
|
||||
node = ((SimpleLruPage *)node)->_prev;
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: SimpleLru::do_evict
|
||||
// Access: Private
|
||||
|
@ -30,20 +30,23 @@ class SimpleLruPage;
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA SimpleLru : public LinkedListNode {
|
||||
PUBLISHED:
|
||||
INLINE SimpleLru(size_t max_size);
|
||||
SimpleLru(size_t max_size);
|
||||
~SimpleLru();
|
||||
|
||||
INLINE size_t get_total_size() const;
|
||||
INLINE size_t get_max_size() const;
|
||||
INLINE void set_max_size(size_t max_size);
|
||||
size_t count_active_size() const;
|
||||
|
||||
INLINE void consider_evict();
|
||||
INLINE void begin_epoch();
|
||||
|
||||
private:
|
||||
void do_evict();
|
||||
|
||||
size_t _total_size;
|
||||
size_t _max_size;
|
||||
SimpleLruPage *_active_marker;
|
||||
|
||||
friend class SimpleLruPage;
|
||||
};
|
||||
|
@ -203,6 +203,7 @@ static LevelCollectorProperties level_properties[] = {
|
||||
{ 1, "Vertex Data:Disk", { 0.6, 0.9, 0.1 } },
|
||||
{ 1, "Vertex Data:Compressed", { 0.5, 0.1, 0.4 } },
|
||||
{ 1, "Vertex Data:Resident", { 0.9, 0.1, 0.7 } },
|
||||
{ 1, "Vertex Data:Active", { 0.5, 0.7, 0.9 } },
|
||||
{ 1, "TransformStates", { 1.0, 0.5, 0.5 }, "", 5000 },
|
||||
{ 1, "TransformStates:On nodes", { 0.2, 0.8, 1.0 } },
|
||||
{ 1, "TransformStates:Cached", { 1.0, 0.0, 0.2 } },
|
||||
|
@ -88,6 +88,23 @@ insert_before(LinkedListNode *node) {
|
||||
node->_prev = this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: LinkedListNode::insert_after
|
||||
// Access: Protected
|
||||
// Description: Adds a LinkedListNode record after the indicated
|
||||
// node in the doubly-linked list.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void LinkedListNode::
|
||||
insert_after(LinkedListNode *node) {
|
||||
nassertv(node->_prev != NULL && node->_prev->_next == node && node->_next->_prev == node);
|
||||
nassertv(_prev == (LinkedListNode *)NULL &&
|
||||
_next == (LinkedListNode *)NULL);
|
||||
_next = node->_next;
|
||||
_prev = node;
|
||||
_next->_prev = this;
|
||||
node->_next = this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: LinkedListNode::take_list_from
|
||||
// Access: Protected
|
||||
|
@ -40,6 +40,7 @@ protected:
|
||||
|
||||
INLINE void remove_from_list();
|
||||
INLINE void insert_before(LinkedListNode *node);
|
||||
INLINE void insert_after(LinkedListNode *node);
|
||||
|
||||
INLINE void take_list_from(LinkedListNode *other_root);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user