File tree Expand file tree Collapse file tree
dedicated_block_allocator Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -68,11 +68,11 @@ fn create_d3d12_device(
6868 )
6969 } ;
7070 match hr {
71- winapi :: shared :: winerror:: S_OK => {
71+ winerror:: S_OK => {
7272 info ! ( "Using D3D12 feature level: {}." , feature_level_name) ;
7373 Some ( device)
7474 }
75- winapi :: shared :: winerror:: E_NOINTERFACE => {
75+ winerror:: E_NOINTERFACE => {
7676 error ! ( "ID3D12Device interface not supported." ) ;
7777 None
7878 }
@@ -106,11 +106,7 @@ fn main() {
106106 )
107107 } ;
108108
109- assert_eq ! (
110- hr,
111- winapi:: shared:: winerror:: S_OK ,
112- "Failed to create DXGI factory" ,
113- ) ;
109+ assert_eq ! ( hr, winerror:: S_OK , "Failed to create DXGI factory" , ) ;
114110 dxgi_factory
115111 } ;
116112
Original file line number Diff line number Diff line change @@ -122,10 +122,6 @@ impl SubAllocator for DedicatedBlockAllocator {
122122 } ]
123123 }
124124
125- fn size ( & self ) -> u64 {
126- self . size
127- }
128-
129125 fn allocated ( & self ) -> u64 {
130126 self . allocated
131127 }
Original file line number Diff line number Diff line change @@ -405,10 +405,6 @@ impl SubAllocator for FreeListAllocator {
405405 . collect :: < Vec < _ > > ( )
406406 }
407407
408- fn size ( & self ) -> u64 {
409- self . size
410- }
411-
412408 fn allocated ( & self ) -> u64 {
413409 self . allocated
414410 }
Original file line number Diff line number Diff line change @@ -73,16 +73,8 @@ pub(crate) trait SubAllocator: SubAllocatorBase + std::fmt::Debug + Sync + Send
7373 #[ must_use]
7474 fn supports_general_allocations ( & self ) -> bool ;
7575 #[ must_use]
76- fn size ( & self ) -> u64 ;
77- #[ must_use]
7876 fn allocated ( & self ) -> u64 ;
7977
80- /// Helper function: reports how much memory is available in this suballocator
81- #[ must_use]
82- fn available_memory ( & self ) -> u64 {
83- self . size ( ) - self . allocated ( )
84- }
85-
8678 /// Helper function: reports if the suballocator is empty (meaning, having no allocations).
8779 #[ must_use]
8880 fn is_empty ( & self ) -> bool {
Original file line number Diff line number Diff line change @@ -271,12 +271,16 @@ pub struct AllocatorCreateDesc {
271271}
272272
273273pub enum ResourceType < ' a > {
274- /// Allocation equivalent to Dx12's CommittedResource.
274+ /// Create a D3D12 [`CommittedResource`].
275+ ///
276+ /// [`CommittedResource`]: https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device-createcommittedresource
275277 Committed {
276278 heap_properties : & ' a D3D12_HEAP_PROPERTIES ,
277279 heap_flags : D3D12_HEAP_FLAGS ,
278280 } ,
279- /// Allocation equivalent to Dx12's PlacedResource.
281+ /// Create a D3D12 [`PlacedResource`].
282+ ///
283+ /// [`PlacedResource`]: https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device-createplacedresource
280284 Placed ,
281285}
282286
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ impl AllocatorVisualizer {
9292 let mut total_allocated = 0 ;
9393
9494 for block in mem_type. memory_blocks . iter ( ) . flatten ( ) {
95- total_block_size += block. sub_allocator . size ( ) ;
95+ total_block_size += block. size ;
9696 total_allocated += block. sub_allocator . allocated ( ) ;
9797 }
9898
@@ -134,10 +134,7 @@ impl AllocatorVisualizer {
134134 let Some ( block) = block else { continue } ;
135135
136136 ui. collapsing ( format ! ( "Block: {}" , block_idx) , |ui| {
137- ui. label ( format ! (
138- "size: {} KiB" ,
139- block. sub_allocator. size( ) / 1024
140- ) ) ;
137+ ui. label ( format ! ( "size: {} KiB" , block. size / 1024 ) ) ;
141138 ui. label ( format ! (
142139 "allocated: {} KiB" ,
143140 block. sub_allocator. allocated( ) / 1024
@@ -205,7 +202,7 @@ impl AllocatorVisualizer {
205202 "Memory type {}, Memory block {}, Block size: {} KiB" ,
206203 window. memory_type_index,
207204 window. block_index,
208- memblock. sub_allocator . size( ) / 1024
205+ memblock. size / 1024
209206 ) ) ;
210207
211208 window
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ unsafe impl Sync for SendSyncPtr {}
5858pub struct AllocatorCreateDesc {
5959 pub instance : ash:: Instance ,
6060 pub device : ash:: Device ,
61- pub physical_device : ash :: vk:: PhysicalDevice ,
61+ pub physical_device : vk:: PhysicalDevice ,
6262 pub debug_settings : AllocatorDebugSettings ,
6363 pub buffer_device_address : bool ,
6464 pub allocation_sizes : AllocationSizes ,
@@ -737,7 +737,7 @@ impl fmt::Debug for Allocator {
737737
738738impl Allocator {
739739 pub fn new ( desc : & AllocatorCreateDesc ) -> Result < Self > {
740- if desc. physical_device == ash :: vk:: PhysicalDevice :: null ( ) {
740+ if desc. physical_device == vk:: PhysicalDevice :: null ( ) {
741741 return Err ( AllocationError :: InvalidAllocatorCreateDesc (
742742 "AllocatorCreateDesc field `physical_device` is null." . into ( ) ,
743743 ) ) ;
You can’t perform that action at this time.
0 commit comments