pub trait TextureAllocator {
type Texture;
type View;
// Required method
fn allocate_texture(
&self,
desc: &TextureDesc,
) -> (Self::Texture, Self::View);
}Expand description
Creates the texture/view pair a TexturePool hands out.
Exists so the pool takes an allocation capability instead of a
wgpu::Device: a host test implements it with a counter and plain
stand-in values, which is what makes “how many textures did 400 resizes
actually allocate?” answerable with no GPU. wgpu::Device is the only
production implementation.
Required Associated Types§
Sourcetype View
type View
A full-extent view of Self::Texture — wgpu::TextureView in
production.
Required Methods§
Sourcefn allocate_texture(&self, desc: &TextureDesc) -> (Self::Texture, Self::View)
fn allocate_texture(&self, desc: &TextureDesc) -> (Self::Texture, Self::View)
Creates a texture matching desc plus a full-extent view of it.
Named allocate_texture rather than create_texture so it never
shadows wgpu::Device’s inherent method of that name.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".