Source code
Revision control
Copy as Markdown
Other Tools
/// A member of the `ExternalTextureParams` struct.
///
/// The numeric values of this enum are used to generate struct access operations in the
/// SPIR-V backend.
///
/// This definition must match `wgpu_core::device::resource::ExternalTextureParams`
/// and the special type definition generated by
/// [`crate::Module::generate_external_texture_types`].
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[cfg_attr(test, derive(strum::EnumCount))]
#[repr(u32)]
pub(crate) enum ExternalTextureParameter {
YuvConversionMatrix = 0,
GamutConversionMatrix,
SrcTf,
DstTf,
SampleTransform,
LoadTransform,
Size,
NumPlanes,
}
impl ExternalTextureParameter {
pub const COUNT: usize = 8;
pub const fn name(&self) -> &'static str {
use ExternalTextureParameter as P;
match *self {
P::YuvConversionMatrix => "yuv_conversion_matrix",
P::GamutConversionMatrix => "gamut_conversion_matrix",
P::SrcTf => "src_tf",
P::DstTf => "dst_tf",
P::SampleTransform => "sample_transform",
P::LoadTransform => "load_transform",
P::Size => "size",
P::NumPlanes => "num_planes",
}
}
}
#[cfg(test)]
mod tests {
#[test]
fn parameter_count() {
use super::ExternalTextureParameter as P;
assert_eq!(P::COUNT, <P as strum::EnumCount>::COUNT);
}
}