@@ -129,7 +129,6 @@ impl Default for Allocation {
129
129
#[ derive( Debug ) ]
130
130
pub ( crate ) struct MemoryBlock {
131
131
pub ( crate ) device_memory : vk:: DeviceMemory ,
132
- #[ cfg( feature = "visualizer" ) ]
133
132
pub ( crate ) size : u64 ,
134
133
pub ( crate ) mapped_ptr : * mut std:: ffi:: c_void ,
135
134
pub ( crate ) sub_allocator : Box < dyn allocator:: SubAllocator > ,
@@ -192,7 +191,6 @@ impl MemoryBlock {
192
191
193
192
Ok ( Self {
194
193
device_memory,
195
- #[ cfg( feature = "visualizer" ) ]
196
194
size,
197
195
mapped_ptr,
198
196
sub_allocator,
@@ -456,25 +454,28 @@ pub struct Allocator {
456
454
impl fmt:: Debug for Allocator {
457
455
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
458
456
let mut allocation_report = vec ! [ ] ;
457
+ let mut total_reserved_size_in_bytes = 0 ;
459
458
460
459
for memory_type in & self . memory_types {
461
460
for block in memory_type. memory_blocks . iter ( ) . flatten ( ) {
461
+ total_reserved_size_in_bytes += block. size ;
462
462
allocation_report. extend ( block. sub_allocator . report_allocations ( ) )
463
463
}
464
464
}
465
465
466
- let total_size_in_bytes = allocation_report. iter ( ) . map ( |report| report. size ) . sum ( ) ;
466
+ let total_used_size_in_bytes = allocation_report. iter ( ) . map ( |report| report. size ) . sum ( ) ;
467
467
468
468
allocation_report. sort_by_key ( |alloc| std:: cmp:: Reverse ( alloc. size ) ) ;
469
469
470
470
writeln ! (
471
471
f,
472
- "================================================================"
472
+ "================================================================" ,
473
473
) ?;
474
474
writeln ! (
475
475
f,
476
- "ALLOCATION BREAKDOWN ({})" ,
477
- fmt_bytes( total_size_in_bytes)
476
+ "ALLOCATION BREAKDOWN ({} / {})" ,
477
+ fmt_bytes( total_used_size_in_bytes) ,
478
+ fmt_bytes( total_reserved_size_in_bytes) ,
478
479
) ?;
479
480
480
481
let max_num_allocations_to_print = f. precision ( ) . map_or ( usize:: MAX , |n| n) ;
0 commit comments