#[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],
}
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§
Source§impl<L> ExternalTextureDescriptor<L>
impl<L> ExternalTextureDescriptor<L>
Sourcepub fn map_label<K>(
&self,
fun: impl FnOnce(&L) -> K,
) -> ExternalTextureDescriptor<K>
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.
Sourcepub fn num_planes(&self) -> usize
pub fn num_planes(&self) -> usize
The number of underlying planes used by the external texture.
Trait Implementations§
Source§impl<L: Clone> Clone for ExternalTextureDescriptor<L>
impl<L: Clone> Clone for ExternalTextureDescriptor<L>
Source§fn clone(&self) -> ExternalTextureDescriptor<L>
fn clone(&self) -> ExternalTextureDescriptor<L>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<L: Debug> Debug for ExternalTextureDescriptor<L>
impl<L: Debug> Debug for ExternalTextureDescriptor<L>
Source§impl<'de, L> Deserialize<'de> for ExternalTextureDescriptor<L>where
L: Deserialize<'de>,
impl<'de, L> Deserialize<'de> for ExternalTextureDescriptor<L>where
L: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<L: PartialEq> PartialEq for ExternalTextureDescriptor<L>
impl<L: PartialEq> PartialEq for ExternalTextureDescriptor<L>
Source§fn eq(&self, other: &ExternalTextureDescriptor<L>) -> bool
fn eq(&self, other: &ExternalTextureDescriptor<L>) -> bool
self
and other
values to be equal, and is used by ==
.