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
62
62
location : MemoryLocation :: CpuToGpu ,
63
63
linear : true , // Buffers are always linear
64
64
allocation_scheme : AllocationScheme :: GpuAllocatorManaged ,
65
+ allow_capacity_increase : true ,
65
66
}). unwrap ();
66
67
67
68
// Bind memory to the buffer
Original file line number Diff line number Diff line change @@ -110,6 +110,7 @@ fn main() {
110
110
linear : true ,
111
111
allocation_scheme : AllocationScheme :: GpuAllocatorManaged ,
112
112
name : "Test allocation (Gpu Only)" ,
113
+ allow_capacity_increase : true ,
113
114
} )
114
115
. unwrap ( ) ;
115
116
@@ -143,6 +144,7 @@ fn main() {
143
144
linear : true ,
144
145
allocation_scheme : AllocationScheme :: GpuAllocatorManaged ,
145
146
name : "Test allocation (Cpu to Gpu)" ,
147
+ allow_capacity_increase : true ,
146
148
} )
147
149
. unwrap ( ) ;
148
150
@@ -176,6 +178,7 @@ fn main() {
176
178
linear : true ,
177
179
allocation_scheme : AllocationScheme :: GpuAllocatorManaged ,
178
180
name : "Test allocation (Gpu to Cpu)" ,
181
+ allow_capacity_increase : true ,
179
182
} )
180
183
. unwrap ( ) ;
181
184
Original file line number Diff line number Diff line change 66
66
//! location: MemoryLocation::CpuToGpu,
67
67
//! linear: true, // Buffers are always linear
68
68
//! allocation_scheme: AllocationScheme::GpuAllocatorManaged,
69
+ //! allow_capacity_increase: true,
69
70
//! }).unwrap();
70
71
//!
71
72
//! // Bind memory to the buffer
Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ pub struct AllocationCreateDesc<'a> {
37
37
pub linear : bool ,
38
38
/// Determines how this allocation should be managed.
39
39
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 ,
40
42
}
41
43
42
44
/// Wrapper type to only mark a raw pointer [`Send`] + [`Sync`] without having to
@@ -579,6 +581,10 @@ impl MemoryType {
579
581
}
580
582
}
581
583
584
+ if !desc. allow_capacity_increase {
585
+ return Err ( AllocationError :: OutOfMemory ) ;
586
+ }
587
+
582
588
let new_memory_block = MemoryBlock :: new (
583
589
device,
584
590
memblock_size,
You can’t perform that action at this time.
0 commit comments