pub struct Texture2DDescriptor { /* private fields */ }Expand description
A 2D texture descriptor for create_texture_2d.
Defaults produce a 1x1 RGBA8 texture with TEXTURE_BINDING | COPY_DST | COPY_SRC usage, which is the right baseline for a sampled color
texture that is uploaded to via queue.writeTexture. Override fields
after constructing to set mip_level_count, sample_count, or
different usage flags.
Implementations§
Source§impl Texture2DDescriptor
Default-construction helper for Texture2DDescriptor.
impl Texture2DDescriptor
Default-construction helper for Texture2DDescriptor.
Sourcepub fn default_for(width: u32, height: u32, format: &'static str) -> Self
pub fn default_for(width: u32, height: u32, format: &'static str) -> Self
Returns a descriptor with the most common defaults applied.
This is the same as calling the generated new constructor and
then explicitly setting the defaults; we provide it so callers
can do Texture2DDescriptor::default_for(w, h, format) instead of
having to remember which fields to set.
§Arguments
width- The texture width in pixels.height- The texture height in pixels.format- The WGSL texture format.
§Returns
- A new descriptor with
mip_level_count = 1,sample_count = 1, and usage"TEXTURE_BINDING | COPY_DST | COPY_SRC".
Source§impl Texture2DDescriptor
impl Texture2DDescriptor
pub fn get_width(&self) -> u32
pub fn get_height(&self) -> u32
pub fn get_format(&self) -> &'static str
pub fn get_mip_level_count(&self) -> u32
pub fn get_sample_count(&self) -> u32
pub fn get_usage(&self) -> &'static str
Trait Implementations§
Source§impl Clone for Texture2DDescriptor
impl Clone for Texture2DDescriptor
Source§fn clone(&self) -> Texture2DDescriptor
fn clone(&self) -> Texture2DDescriptor
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Texture2DDescriptor
impl RefUnwindSafe for Texture2DDescriptor
impl Send for Texture2DDescriptor
impl Sync for Texture2DDescriptor
impl Unpin for Texture2DDescriptor
impl UnsafeUnpin for Texture2DDescriptor
impl UnwindSafe for Texture2DDescriptor
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