ExternalTextureDescriptor

Struct ExternalTextureDescriptor 

#[repr(C)]
pub struct ExternalTextureDescriptor<L> { pub label: L, pub width: u32, pub height: u32, pub format: ExternalTextureFormat, pub yuv_conversion_matrix: [f32; 16], pub gamut_conversion_matrix: [f32; 9], pub src_transfer_function: ExternalTextureTransferFunction, pub dst_transfer_function: ExternalTextureTransferFunction, pub sample_transform: [f32; 6], pub load_transform: [f32; 6], }
Available on crate feature unstable-wgpu-27 only.
Expand description

Describes an ExternalTexture.

Note that width and height are the values that should be returned by size queries in shader code; they do not necessarily match the dimensions of the underlying plane texture(s). As a special case, if (width, height) is (0, 0), the actual size of the first underlying plane should be used instead.

The size given by width and height must be consistent with sample_transform: they should be the size in texels of the rectangle covered by the square (0,0)..(1,1) after sample_transform has been applied to it.

Corresponds to WebGPU GPUExternalTextureDescriptor.

Fields§

§label: L

Debug label of the external texture. This will show up in graphics debuggers for easy identification.

§width: u32

Width of the external texture.

§height: u32

Height of the external texture.

§format: ExternalTextureFormat

Format of the external texture.

§yuv_conversion_matrix: [f32; 16]

4x4 column-major matrix with which to convert sampled YCbCr values to RGBA. This is ignored when format is ExternalTextureFormat::Rgba.

§gamut_conversion_matrix: [f32; 9]

3x3 column-major matrix to transform linear RGB values in the source color space to linear RGB values in the destination color space. In combination with Self::src_transfer_function and Self::dst_transfer_function this can be used to ensure that ImageSample and ImageLoad operations return values in the desired destination color space rather than the source color space of the underlying planes.

§src_transfer_function: ExternalTextureTransferFunction

Transfer function for the source color space. The inverse of this will be applied to decode non-linear RGB to linear RGB in the source color space.

§dst_transfer_function: ExternalTextureTransferFunction

Transfer function for the destination color space. This will be applied to encode linear RGB to non-linear RGB in the destination color space.

§sample_transform: [f32; 6]

Transform to apply to ImageSample coordinates.

This is a 3x2 column-major matrix representing an affine transform from normalized texture coordinates to the normalized coordinates that should be sampled from the external texture’s underlying plane(s).

This transform may scale, translate, flip, and rotate in 90-degree increments, but the result of transforming the rectangle (0,0)..(1,1) must be an axis-aligned rectangle that falls within the bounds of (0,0)..(1,1).

§load_transform: [f32; 6]

Transform to apply to ImageLoad coordinates.

This is a 3x2 column-major matrix representing an affine transform from non-normalized texel coordinates to the non-normalized coordinates of the texel that should be loaded from the external texture’s underlying plane 0. For planes 1 and 2, if present, plane 0’s coordinates are scaled according to the textures’ relative sizes.

This transform may scale, translate, flip, and rotate in 90-degree increments, but the result of transforming the rectangle (0,0)..(width, height) must be an axis-aligned rectangle that falls within the bounds of (0,0)..(width, height).

Implementations§

§

impl<L> ExternalTextureDescriptor<L>

pub fn map_label<K>( &self, fun: impl FnOnce(&L) -> K, ) -> ExternalTextureDescriptor<K>

Takes a closure and maps the label of the external texture descriptor into another.

pub fn num_planes(&self) -> usize

The number of underlying planes used by the external texture.

Trait Implementations§

§

impl<L> Clone for ExternalTextureDescriptor<L>
where L: Clone,

§

fn clone(&self) -> ExternalTextureDescriptor<L>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<L> Debug for ExternalTextureDescriptor<L>
where L: Debug,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<L> PartialEq for ExternalTextureDescriptor<L>
where L: PartialEq,

§

fn eq(&self, other: &ExternalTextureDescriptor<L>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<L> StructuralPartialEq for ExternalTextureDescriptor<L>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T

§

impl<T> WasmNotSendSync for T

§

impl<T> WasmNotSync for T
where T: Sync,

§

impl<T> WasmNotSync for T
where T: Sync,