File tree Expand file tree Collapse file tree 4 files changed +11
-0
lines changed Expand file tree Collapse file tree 4 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ let allocation = allocator
6262 location : MemoryLocation :: CpuToGpu ,
6363 linear : true , // Buffers are always linear
6464 allocation_scheme : AllocationScheme :: GpuAllocatorManaged ,
65+ allow_capacity_increase : true ,
6566 }). unwrap ();
6667
6768// Bind memory to the buffer
Original file line number Diff line number Diff line change @@ -110,6 +110,7 @@ fn main() {
110110 linear : true ,
111111 allocation_scheme : AllocationScheme :: GpuAllocatorManaged ,
112112 name : "Test allocation (Gpu Only)" ,
113+ allow_capacity_increase : true ,
113114 } )
114115 . unwrap ( ) ;
115116
@@ -143,6 +144,7 @@ fn main() {
143144 linear : true ,
144145 allocation_scheme : AllocationScheme :: GpuAllocatorManaged ,
145146 name : "Test allocation (Cpu to Gpu)" ,
147+ allow_capacity_increase : true ,
146148 } )
147149 . unwrap ( ) ;
148150
@@ -176,6 +178,7 @@ fn main() {
176178 linear : true ,
177179 allocation_scheme : AllocationScheme :: GpuAllocatorManaged ,
178180 name : "Test allocation (Gpu to Cpu)" ,
181+ allow_capacity_increase : true ,
179182 } )
180183 . unwrap ( ) ;
181184
Original file line number Diff line number Diff line change 6666//! location: MemoryLocation::CpuToGpu,
6767//! linear: true, // Buffers are always linear
6868//! allocation_scheme: AllocationScheme::GpuAllocatorManaged,
69+ //! allow_capacity_increase: true,
6970//! }).unwrap();
7071//!
7172//! // Bind memory to the buffer
Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ pub struct AllocationCreateDesc<'a> {
3737 pub linear : bool ,
3838 /// Determines how this allocation should be managed.
3939 pub allocation_scheme : AllocationScheme ,
40+ /// Allow the allocator to request additional memory from the device to fulfill this request.
41+ pub allow_capacity_increase : bool ,
4042}
4143
4244/// Wrapper type to only mark a raw pointer [`Send`] + [`Sync`] without having to
@@ -579,6 +581,10 @@ impl MemoryType {
579581 }
580582 }
581583
584+ if !desc. allow_capacity_increase {
585+ return Err ( AllocationError :: OutOfMemory ) ;
586+ }
587+
582588 let new_memory_block = MemoryBlock :: new (
583589 device,
584590 memblock_size,
You can’t perform that action at this time.
0 commit comments