Skip to main content

MewTexture

Trait MewTexture 

Source
pub trait MewTexture {
    // Required methods
    fn new(buffer: Texture) -> Self;
    fn binding_type() -> BindingType;
    fn buffer_desc(
        inner_size: (u32, u32, u32),
        format: TextureFormat,
    ) -> TextureDescriptor<'static>;
    fn as_binding<'a>(&'a self) -> BindingResource<'a>;
    fn as_colour_attachment<'a>(
        &'a self,
        clear: Option<Color>,
        depth_slice: Option<u32>,
    ) -> RenderPassColorAttachment<'a>;
    fn as_depth_attachment<'a>(&'a self) -> RenderPassDepthStencilAttachment<'a>;
    fn memory_estimate(&self) -> u64;
    fn texel_layout(&self) -> TexelCopyBufferLayout;
}
Expand description

Trait for internal use to work with texture bindings.

Required Methods§

Source

fn new(buffer: Texture) -> Self

Build this texture type from a wgpu::Texture.

Source

fn binding_type() -> BindingType

Get a wgpu::BindingType to use for this type of texture.

Source

fn buffer_desc( inner_size: (u32, u32, u32), format: TextureFormat, ) -> TextureDescriptor<'static>

Get a wgpu::TextureDescriptor to build this type of texture with the given size & wgpu::TextureFormat.

Source

fn as_binding<'a>(&'a self) -> BindingResource<'a>

Get this texture’s wgpu::BindingResource to bind it in a bind group.

Source

fn as_colour_attachment<'a>( &'a self, clear: Option<Color>, depth_slice: Option<u32>, ) -> RenderPassColorAttachment<'a>

Get a wgpu::RenderPassColorAttachment to attach this texture to a render pass, to draw to it using a specified clear colour on a 2D depth slice (set to None if it’s a regular 2D texture).

Source

fn as_depth_attachment<'a>(&'a self) -> RenderPassDepthStencilAttachment<'a>

Get a wgpu::RenderPassDepthStencilAttachment to attach this texture to a render pass, to use as a depth stencil.

Source

fn memory_estimate(&self) -> u64

Get the estimated size of this texture. Default implementation just uses wgpu::TextureFormat::theoretical_memory_footprint.

Source

fn texel_layout(&self) -> TexelCopyBufferLayout

Get the wgpu::TexelCopyBufferLayout for this texture. Required by the queue to write any data to the texture.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§