Skip to main content

TextureExt

Trait TextureExt 

Source
pub trait TextureExt {
    // Required method
    fn create_view(&self, descriptor: &TextureViewDescriptor<'_>) -> TextureView;
}
Expand description

Creating texture views whose format the graph can track.

wgpu’s own [wgpu::Texture::create_view] returns a bare [wgpu::TextureView], which reports its texture’s format rather than the one it was created with, so a view that reinterprets its texture — an sRGB view over a non-sRGB swap-chain image — cannot be told apart from a default one afterwards. This trait’s create_view reads the format out of the descriptor and pairs it with the view.

It is deliberately not named differently from wgpu’s own method: wgpu’s inherent method shadows it, so a call has to name the trait — TextureExt::create_view(&texture, &descriptor) — which makes the choice between the two visible at the call site.

Required Methods§

Source

fn create_view(&self, descriptor: &TextureViewDescriptor<'_>) -> TextureView

Create a view of this texture, recording the format it views it as.

The format is the descriptor’s own when it states one, and the texture’s otherwise — exactly what wgpu resolves the two to.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl TextureExt for Texture

Source§

fn create_view(&self, descriptor: &TextureViewDescriptor<'_>) -> TextureView

Implementors§