#[repr(C)]pub struct ExternalTextureParams {
pub yuv_conversion_matrix: [f32; 16],
pub gamut_conversion_matrix: [f32; 12],
pub src_transfer_function: ExternalTextureTransferFunction,
pub dst_transfer_function: ExternalTextureTransferFunction,
pub sample_transform: [f32; 6],
pub load_transform: [f32; 6],
pub size: [u32; 2],
pub num_planes: u32,
pub _padding: [u8; 4],
}
Expand description
Parameters provided to shaders via a uniform buffer of the type
NagaExternalTextureParams
, describing an ExternalTexture
resource
binding.
Fields§
§yuv_conversion_matrix: [f32; 16]
4x4 column-major matrix with which to convert sampled YCbCr values to RGBA.
This is ignored when num_planes
is 1.
gamut_conversion_matrix: [f32; 12]
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.
Includes a padding element after each column.
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)..size
must be an axis-aligned rectangle that falls within the bounds of
(0,0)..size
.
size: [u32; 2]
Size of the external texture.
This is the value that should be returned by size queries in shader
code; it does not necessarily match the dimensions of the underlying
texture(s). As a special case, if this is [0, 0]
, the actual size of
plane 0 should be used instead.
This must be consistent with sample_transform
: it 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.
num_planes: u32
Number of planes. 1 indicates a single RGBA plane. 2 indicates a Y plane and an interleaved CbCr plane. 3 indicates separate Y, Cb, and Cr planes.
_padding: [u8; 4]
Implementations§
Source§impl ExternalTextureParams
impl ExternalTextureParams
pub fn from_desc<L>(desc: &ExternalTextureDescriptor<L>) -> Self
Trait Implementations§
Source§impl Clone for ExternalTextureParams
impl Clone for ExternalTextureParams
Source§fn clone(&self) -> ExternalTextureParams
fn clone(&self) -> ExternalTextureParams
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreimpl Copy for ExternalTextureParams
impl Pod for ExternalTextureParams
Auto Trait Implementations§
impl Freeze for ExternalTextureParams
impl RefUnwindSafe for ExternalTextureParams
impl Send for ExternalTextureParams
impl Sync for ExternalTextureParams
impl Unpin for ExternalTextureParams
impl UnwindSafe for ExternalTextureParams
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
§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
§type Bits = T
type Bits = T
Self
must have the same layout as the specified Bits
except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern
.§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self
.