17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-25 02:14:49 +01:00

perf(debug): memory of the process and of its parts in the debug panel: resident, peak and private memory, card memory (GL_NVX_gpu_memory_info), the copies kept by the textures, geometry banks, models, scenery shapes and lines, sleepers and sound buffers

This commit is contained in:
2026-10-23 22:02:03 +02:00
parent 1a42009dc2
commit 2dc70a50bc
14 changed files with 346 additions and 1 deletions

View File

@@ -420,6 +420,32 @@ geometry_bank::userdata( gfx::geometry_handle const &Geometry ) const {
// geometry bank manager, holds collection of geometry banks
// performs a resource sweep
// what the chunks keep in the process, added to the counts
void
geometry_bank::count_memory( memory_count &Vertices, memory_count &Indices, memory_count &Userdata ) const {
for( auto const &chunk : m_chunks ) {
++Vertices.count;
Vertices.bytes += memory_of( chunk.vertices );
Indices.bytes += memory_of( chunk.indices );
Userdata.bytes += memory_of( chunk.userdata );
}
Indices.count = Userdata.count = Vertices.count;
}
// what the banks keep in the process, for the debug panel
auto
geometrybank_manager::memory() const -> memory_data {
memory_data result;
for( auto const &bank : m_geometrybanks ) {
if( bank.first == nullptr ) { continue; }
++result.banks;
bank.first->count_memory( result.vertices, result.indices, result.userdata );
}
return result;
}
void
geometrybank_manager::update() {