pub struct Texture<T = Texture, V = TextureView> { /* private fields */ }Expand description
A GPU texture: the underlying texture/view pair, the TextureDesc it
was created from, and a SceneTextureId minted once at construction
and shared across Clone.
Generic over the wrapped texture (T, default wgpu::Texture) and view
(V, default wgpu::TextureView) types rather than hardcoded to them, so
Self::as_scene_texture’s id-uniqueness and clone-stability contract
stays host-testable with plain stand-in values — no GPU device needed to
mint a real wgpu::Texture/wgpu::TextureView pair just to exercise the
id logic. The real engine always instantiates the default Texture
(Texture<wgpu::Texture, wgpu::TextureView>).
Implementations§
Source§impl<T, V> Texture<T, V>
impl<T, V> Texture<T, V>
Sourcepub fn new(texture: T, view: V, desc: TextureDesc) -> Self
pub fn new(texture: T, view: V, desc: TextureDesc) -> Self
Wraps an already-created texture/view pair with the TextureDesc
it was built from, minting a fresh SceneTextureId.
Device/texture/view creation itself is a caller concern (this crate’s device-init work is tracked separately) — this constructor only assembles the handle and mints its scene id.
Sourcepub fn size(&self) -> (u32, u32)
pub fn size(&self) -> (u32, u32)
(width, height) in texels, from the originating TextureDesc.
Sourcepub fn format(&self) -> TextureFormat
pub fn format(&self) -> TextureFormat
The texture’s pixel format, from the originating TextureDesc.
Sourcepub fn desc(&self) -> &TextureDesc
pub fn desc(&self) -> &TextureDesc
The originating TextureDesc.
Sourcepub fn as_scene_texture(&self) -> SceneTextureId
pub fn as_scene_texture(&self) -> SceneTextureId
The process-unique SceneTextureId minted for this texture at
construction, stable across Clone.