pub struct PooledTexture<T = Texture, V = TextureView> { /* private fields */ }Expand description
A texture checked out of a TexturePool, the key it returns under, and
the frame clock it ages against.
Held by value while in use — the pool retains only free entries — so a
caller that forgets to TexturePool::release it simply drops it, at
worst losing the reuse rather than leaking a slot.
Implementations§
Source§impl<T, V> PooledTexture<T, V>
impl<T, V> PooledTexture<T, V>
Sourcepub fn texture(&self) -> &Texture<T, V>
pub fn texture(&self) -> &Texture<T, V>
The pooled texture itself, carrying the TextureDesc it was
created from (the quantized extent) and its
crate::texture::SceneTextureId.
Sourcepub fn size(&self) -> (u32, u32)
pub fn size(&self) -> (u32, u32)
The quantized (width, height) this texture was allocated at — at
least Self::requested_size in both axes.
Sourcepub fn requested_size(&self) -> (u32, u32)
pub fn requested_size(&self) -> (u32, u32)
The (width, height) the current holder asked for, which is what it
should render into: the allocation is quantized up, so the rest of
the texture is slack the caller must not treat as part of its image.
Sourcepub fn last_used_frame(&self) -> u64
pub fn last_used_frame(&self) -> u64
The frame this entry was last acquired for — the clock
TexturePool::age measures disuse against.
Source§impl PooledTexture<Texture, TextureView>
impl PooledTexture<Texture, TextureView>
Sourcepub fn color_attachment(&self, clear: Color) -> ColorAttachment<'_>
pub fn color_attachment(&self, clear: Color) -> ColorAttachment<'_>
A color attachment targeting this texture, clearing to clear and
discarding at pass end.
The ops are not a parameter on purpose. A recycled texture holds
whatever its previous holder left there, so loading it would sample
another pass’s image; and StoreOp::Discard is required outright once
effective_usage has added
wgpu::TextureUsages::TRANSIENT_ATTACHMENT. A caller that needs its
own contents back across passes wants a texture it owns, not a pooled
intermediate.