mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-21 23:11:01 +01:00
Merge #1117
1117: Free associated staging buffers r=cwfitzgerald a=kvark **Connections** Reported on the Matrix. Having a loop that creates mapped buffers and drops them results in OOM. **Description** We are now checking for the map state when destroying buffers. **Testing** Ran through an ad-hoc example. Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
This commit is contained in:
commit
b67c2b0299
1 file changed
+10
@@ -499,6 +499,16 @@ impl<B: GfxBackend> LifetimeTracker<B> {
|
||||
|
||||
if let Some(res) = hub.buffers.unregister_locked(id.0, &mut *guard) {
|
||||
let submit_index = res.life_guard.submission_index.load(Ordering::Acquire);
|
||||
if let resource::BufferMapState::Init {
|
||||
stage_buffer,
|
||||
stage_memory,
|
||||
..
|
||||
} = res.map_state
|
||||
{
|
||||
self.free_resources
|
||||
.buffers
|
||||
.push((stage_buffer, stage_memory));
|
||||
}
|
||||
self.active
|
||||
.iter_mut()
|
||||
.find(|a| a.index == submit_index)
|
||||
|
||||
Reference in new issue
Block a user