Use SmallVec::truncate in state_cacher (#770)

This commit is contained in:
tomaka 2017-08-25 11:48:58 +02:00 committed by GitHub
parent 1640220ebf
commit f13454dc6e
2 changed files with 3 additions and 15 deletions

View File

@ -13,7 +13,7 @@ build = "build.rs"
crossbeam = "0.2.10"
fnv = "1.0.5"
shared_library = "0.1.5"
smallvec = "0.3.1"
smallvec = "0.4.3"
lazy_static = "0.2.2"
vk-sys = { version = "0.3.1", path = "../vk-sys" }
half = "1"

View File

@ -272,15 +272,8 @@ impl<'s> StateCacherDescriptorSets<'s> {
#[inline]
pub fn compare(self) -> Option<u32> {
*self.poisonned = false;
// Removing from the cache any set that wasn't added with `add`.
if self.offset < self.state.len() {
// TODO: SmallVec doesn't provide any method for this
for _ in self.offset .. self.state.len() {
self.state.remove(self.offset);
}
}
self.state.truncate(self.offset);
self.found_diff
}
}
@ -346,12 +339,7 @@ impl<'s> StateCacherVertexBuffers<'s> {
*self.poisonned = false;
// Removing from the cache any set that wasn't added with `add`.
if self.offset < self.state.len() {
// TODO: SmallVec doesn't provide any method for this
for _ in self.offset .. self.state.len() {
self.state.remove(self.offset);
}
}
self.state.truncate(self.offset);
self.first_diff.map(|first| {
debug_assert!(first <= self.last_diff);