Struct nannou_wgpu::TextureBuilder [−][src]
pub struct TextureBuilder { /* fields omitted */ }
Expand description
A type aimed at simplifying the construction of a Texture.
The builder assumes a set of defaults describing a 128x128, non-multisampled, single-layer, non-linear sRGBA-8 texture. A suite of builder methods may be used to specify the exact properties desired.
Implementations
The minimum required texture usage when loading from an image.
Produce a texture descriptor from an image.
Specifically, this supports any image type implementing image::GenericImageView
whose
Pixel
type implements Pixel
.
By default, the produced builder will have the wgpu::TextureUsages
returned by
wgpu::TextureBuilder::default_image_texture_usage()
. This is a general-purpose usage that
should allow for copying to and from the texture, sampling the texture and rendering to the
texture. Specifying only the texture usage required may result in better performance. It
may be necessary to manually specify the the usage if STORAGE
is required.
The default texture usage for the case where a user has loaded a texture from an image.
Specify the width and height of the texture.
Note: On calls to size
, depth
and extent
the Builder
will attempt to infer the
wgpu::TextureDimension
of its inner wgpu::TextureDescriptor
by examining its size
field. Use TextureBuilder::dimension()
to override this behavior.
Specify the depth of the texture.
Note: On calls to size
, depth
and extent
the Builder
will attempt to infer the
wgpu::TextureDimension
of its inner wgpu::TextureDescriptor
by examining its size
field. Use TextureBuilder::dimension()
to override this behavior.
Specify the width, height and depth of the texture.
Note: On calls to size
, depth
and extent
the Builder
will attempt to infer the
wgpu::TextureDimension
of its inner wgpu::TextureDescriptor
by examining its size
field. Use TextureBuilder::dimension()
to override this behavior.
Specify the dimension of the texture, overriding inferred dimension.
Mainly useful for creating 2d texture arrays – override dimension with
wgpu::TextureDimension::D2
on a texture with extent.depth > 1
in order to create a
texture array (/ cubemap / cubemap array) instead of a 3d texture.
Specify the number of mip levels of the texture.
Specify the number of samples per pixel in the case that the texture is multisampled.
Specify the texture format.
Describes to the implementation how the texture is to be used.
It is important that the set of usage bits reflects the
Build the texture resulting from the specified parameters with the given device.
Consumes the builder and returns the resulting wgpu::TextureDescriptor
.
Trait Implementations
Performs the conversion.