pub struct TextureStore { /* private fields */ }Expand description
Registry of textures addressable by TextureId.
Ids are stable for the lifetime of the store and are never reused, so a handle held by a mesh cannot accidentally resolve to a different image after an eviction.
Implementations§
Source§impl TextureStore
impl TextureStore
pub fn new() -> Self
Sourcepub fn insert(
&mut self,
data: TextureData,
sampler: SamplerDesc,
) -> Option<TextureId>
pub fn insert( &mut self, data: TextureData, sampler: SamplerDesc, ) -> Option<TextureId>
Inserts a texture and returns its handle.
Returns None when the pixel buffer does not match the description.
Sourcepub fn insert_rgba8(
&mut self,
width: u32,
height: u32,
pixels: impl Into<Arc<[u8]>>,
) -> Option<TextureId>
pub fn insert_rgba8( &mut self, width: u32, height: u32, pixels: impl Into<Arc<[u8]>>, ) -> Option<TextureId>
Inserts a texture with the default sampler.
pub fn get(&self, id: TextureId) -> Option<&Texture>
pub fn remove(&mut self, id: TextureId) -> Option<Texture>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn generation(&self) -> u64
pub fn generation(&self) -> u64
Number of mutations since creation. GPU upload caches compare this to decide whether a bind group must be rebuilt.
Trait Implementations§
Source§impl Clone for TextureStore
impl Clone for TextureStore
Source§impl Debug for TextureStore
impl Debug for TextureStore
Source§impl Default for TextureStore
impl Default for TextureStore
Source§impl PartialEq for TextureStore
impl PartialEq for TextureStore
impl StructuralPartialEq for TextureStore
Auto Trait Implementations§
impl Forget for TextureStore
impl Freeze for TextureStore
impl Move for TextureStore
impl RefUnwindSafe for TextureStore
impl Send for TextureStore
impl Sync for TextureStore
impl Unpin for TextureStore
impl UnsafeUnpin for TextureStore
impl UnwindSafe for TextureStore
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