diff options
author | 2024-03-30 23:49:26 +0100 | |
---|---|---|
committer | 2024-03-30 23:49:26 +0100 | |
commit | c7a4fad4a24dec8536f450d447a9852846f2d711 (patch) | |
tree | bcdf3d450dcaaf445a237d9dfac646dee78e838e /graphics/src | |
parent | 5071e3d231699f67347a11b829cc8c9e50e54370 (diff) | |
parent | 4c74bebc708f960f77d53526e7da4187f56967c9 (diff) | |
download | iced-c7a4fad4a24dec8536f450d447a9852846f2d711.tar.gz iced-c7a4fad4a24dec8536f450d447a9852846f2d711.tar.bz2 iced-c7a4fad4a24dec8536f450d447a9852846f2d711.zip |
Merge pull request #2357 from iced-rs/wgpu/use-staging-belt
Use a `StagingBelt` in `iced_wgpu` for regular buffer uploads
Diffstat (limited to '')
-rw-r--r-- | graphics/src/text/cache.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/graphics/src/text/cache.rs b/graphics/src/text/cache.rs index 7fb33567..b6473f85 100644 --- a/graphics/src/text/cache.rs +++ b/graphics/src/text/cache.rs @@ -2,9 +2,9 @@ use crate::core::{Font, Size}; use crate::text; -use rustc_hash::{FxHashMap, FxHashSet}; +use rustc_hash::{FxHashMap, FxHashSet, FxHasher}; use std::collections::hash_map; -use std::hash::{BuildHasher, Hash, Hasher}; +use std::hash::{Hash, Hasher}; /// A store of recently used sections of text. #[allow(missing_debug_implementations)] @@ -13,11 +13,8 @@ pub struct Cache { entries: FxHashMap<KeyHash, Entry>, aliases: FxHashMap<KeyHash, KeyHash>, recently_used: FxHashSet<KeyHash>, - hasher: HashBuilder, } -type HashBuilder = xxhash_rust::xxh3::Xxh3Builder; - impl Cache { /// Creates a new empty [`Cache`]. pub fn new() -> Self { @@ -35,7 +32,7 @@ impl Cache { font_system: &mut cosmic_text::FontSystem, key: Key<'_>, ) -> (KeyHash, &mut Entry) { - let hash = key.hash(self.hasher.build_hasher()); + let hash = key.hash(FxHasher::default()); if let Some(hash) = self.aliases.get(&hash) { let _ = self.recently_used.insert(*hash); @@ -77,7 +74,7 @@ impl Cache { ] { if key.bounds != bounds { let _ = self.aliases.insert( - Key { bounds, ..key }.hash(self.hasher.build_hasher()), + Key { bounds, ..key }.hash(FxHasher::default()), hash, ); } |