Implemented automatic deallocation of texture space for dropped allocations
This commit is contained in:
parent
8f9f44b9e8
commit
4617da2818
3 changed files with 88 additions and 85 deletions
|
|
@ -91,17 +91,9 @@ impl Cache {
|
|||
memory
|
||||
}
|
||||
|
||||
pub fn trim(&mut self, texture_array: &mut TextureArray) {
|
||||
pub fn trim(&mut self) {
|
||||
let hits = &self.hits;
|
||||
|
||||
for (id, mem) in &self.map {
|
||||
if let Memory::Device(allocation) = mem {
|
||||
if !hits.contains(&id) {
|
||||
texture_array.deallocate(allocation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.map.retain(|k, _| hits.contains(k));
|
||||
self.hits.clear();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue