pub struct TextureCache { /* private fields */ }Expand description
Manages a collection of GPU textures (CPU-side stubs for Phase 2).
Implementations§
Source§impl TextureCache
impl TextureCache
Sourcepub fn insert(&mut self, desc: TextureDescriptor, data: Option<Vec<u8>>) -> u32
pub fn insert(&mut self, desc: TextureDescriptor, data: Option<Vec<u8>>) -> u32
Insert a new texture, returning its unique id.
Sourcepub fn get(&self, id: u32) -> Option<&TextureEntry>
pub fn get(&self, id: u32) -> Option<&TextureEntry>
Retrieve a reference to a texture by id.
Sourcepub fn remove(&mut self, id: u32) -> bool
pub fn remove(&mut self, id: u32) -> bool
Remove a texture by id. Returns true if it was present.
Sourcepub fn loaded_count(&self) -> usize
pub fn loaded_count(&self) -> usize
Number of entries where loaded == true.
Sourcepub fn mark_loaded(&mut self, id: u32, data: Vec<u8>) -> bool
pub fn mark_loaded(&mut self, id: u32, data: Vec<u8>) -> bool
Supply pixel data for a previously-inserted placeholder texture.
Returns false if the id is not found.
Sourcepub fn evict_all(&mut self)
pub fn evict_all(&mut self)
Evict pixel data from all entries (streaming eviction), keeping descriptors.
Sourcepub fn total_memory_bytes(&self) -> usize
pub fn total_memory_bytes(&self) -> usize
Sum of memory used by all loaded textures.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TextureCache
impl RefUnwindSafe for TextureCache
impl Send for TextureCache
impl Sync for TextureCache
impl Unpin for TextureCache
impl UnsafeUnpin for TextureCache
impl UnwindSafe for TextureCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more