diff --git a/.monorepo/lints.toml b/.monorepo/lints.toml index 4a4ca4cb9e..86dbdb7350 100644 --- a/.monorepo/lints.toml +++ b/.monorepo/lints.toml @@ -106,7 +106,7 @@ warn = [ "clippy::suspicious_operation_groupings", "clippy::trailing_empty_array", "clippy::trivial_regex", - "clippy::use_self", + # "clippy::use_self", // disabling for Rust 1.61, see https://github.com/rust-lang/rust-clippy/issues/6902 "clippy::useless_let_if_seq", "clippy::useless_transmute", # Clippy restriction lints, usually not considered bad, but useful in specific cases diff --git a/Cargo.lock b/Cargo.lock index 947a12c92b..809547db00 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3898,7 +3898,6 @@ dependencies = [ "lgn-tasks", "lgn-tracing", "ntest", - "retain_mut", "tokio", ] @@ -7313,12 +7312,6 @@ dependencies = [ "winreg", ] -[[package]] -name = "retain_mut" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4389f1d5789befaf6029ebd9f7dac4af7f7e3d61b69d4f30e2ac02b57e7712b0" - [[package]] name = "rfc6979" version = "0.1.0" diff --git a/README.md b/README.md index fcd1eddc43..18b82f00fc 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ CI - Test CI - Release Coverage - MSRV

+ MSRV

diff --git a/crates/lgn-api-codegen/src/api.rs b/crates/lgn-api-codegen/src/api.rs index 790338a0b7..50de7ae7f1 100644 --- a/crates/lgn-api-codegen/src/api.rs +++ b/crates/lgn-api-codegen/src/api.rs @@ -195,14 +195,14 @@ pub enum Method { impl std::fmt::Display for Method { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.write_str(match self { - Method::Get => "GET", - Method::Post => "POST", - Method::Delete => "DELETE", - Method::Put => "PUT", - Method::Patch => "PATCH", - Method::Head => "HEAD", - Method::Options => "OPTIONS", - Method::Trace => "TRACE", + Self::Get => "GET", + Self::Post => "POST", + Self::Delete => "DELETE", + Self::Put => "PUT", + Self::Patch => "PATCH", + Self::Head => "HEAD", + Self::Options => "OPTIONS", + Self::Trace => "TRACE", }) } } diff --git a/crates/lgn-async/Cargo.toml b/crates/lgn-async/Cargo.toml index 67ccbe570f..460c2bc2fe 100644 --- a/crates/lgn-async/Cargo.toml +++ b/crates/lgn-async/Cargo.toml @@ -14,7 +14,6 @@ lgn-app = { path = "../lgn-app", version = "0.1.0" } lgn-tracing = { path = "../lgn-tracing", version = "0.1.0" } lgn-tasks = { path = "../lgn-tasks", version = "0.1.0" } tokio = { version = "1.13", features = ["full", "tracing"] } -retain_mut = "0.1" futures-lite = "1.12" [dev-dependencies] diff --git a/crates/lgn-async/src/runtime.rs b/crates/lgn-async/src/runtime.rs index dc06d9a15a..6530fba985 100644 --- a/crates/lgn-async/src/runtime.rs +++ b/crates/lgn-async/src/runtime.rs @@ -151,9 +151,7 @@ impl TokioAsyncRuntime { pub fn poll(&mut self) -> u32 { let mut num_completed = 0; - // TODO: #1886 Fix after we move to 1.61 - #[allow(deprecated)] - retain_mut::RetainMut::retain_mut(&mut self.result_handlers, |handler| { + self.result_handlers.retain_mut(|handler| { let is_complete = handler.try_complete(); if is_complete { diff --git a/crates/lgn-content-store/src/content_providers/hash_ref.rs b/crates/lgn-content-store/src/content_providers/hash_ref.rs index d34dea6881..daa62d757e 100644 --- a/crates/lgn-content-store/src/content_providers/hash_ref.rs +++ b/crates/lgn-content-store/src/content_providers/hash_ref.rs @@ -65,7 +65,7 @@ pub enum HashAlgorithm { impl Display for HashAlgorithm { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match self { - HashAlgorithm::Blake3 => write!(f, "blake3"), + Self::Blake3 => write!(f, "blake3"), } } } diff --git a/crates/lgn-data-codegen/src/lib.rs b/crates/lgn-data-codegen/src/lib.rs index c8b27ce1bd..9d8df49563 100644 --- a/crates/lgn-data-codegen/src/lib.rs +++ b/crates/lgn-data-codegen/src/lib.rs @@ -40,8 +40,8 @@ impl GenerationType { /// Returns the name of the generation type pub fn name(self) -> &'static str { match self { - GenerationType::OfflineFormat => "offline", - GenerationType::RuntimeFormat => "runtime", + Self::OfflineFormat => "offline", + Self::RuntimeFormat => "runtime", } } } diff --git a/crates/lgn-data-compiler/src/lib.rs b/crates/lgn-data-compiler/src/lib.rs index 68de5a6ee8..6f1673cce1 100644 --- a/crates/lgn-data-compiler/src/lib.rs +++ b/crates/lgn-data-compiler/src/lib.rs @@ -107,9 +107,9 @@ pub enum Target { impl fmt::Display for Target { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { - Target::Game => write!(f, "game"), - Target::Server => write!(f, "server"), - Target::Backend => write!(f, "backend"), + Self::Game => write!(f, "game"), + Self::Server => write!(f, "server"), + Self::Backend => write!(f, "backend"), } } } @@ -141,9 +141,9 @@ pub enum Platform { impl fmt::Display for Platform { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { - Platform::Windows => write!(f, "windows"), - Platform::Unix => write!(f, "unix"), - Platform::ConsoleX => write!(f, "consolex"), + Self::Windows => write!(f, "windows"), + Self::Unix => write!(f, "unix"), + Self::ConsoleX => write!(f, "consolex"), } } } diff --git a/crates/lgn-data-model/src/array_descriptor.rs b/crates/lgn-data-model/src/array_descriptor.rs index 12c61b638a..68dfd94719 100644 --- a/crates/lgn-data-model/src/array_descriptor.rs +++ b/crates/lgn-data-model/src/array_descriptor.rs @@ -66,23 +66,23 @@ macro_rules! implement_array_descriptor { static ref ARRAY_DESCRIPTOR: $crate::ArrayDescriptor = $crate::ArrayDescriptor { base_descriptor : $crate::create_base_descriptor!(Vec<$type_id>, concat!("Vec<",stringify!($type_id),">").into(), Result::, $crate::ReflectionError>::Ok(Vec::<$type_id>::new())), inner_type: <$type_id as $crate::TypeReflection>::get_type_def(), - len: |array: *const ()| unsafe { (*(array as *const Vec<$type_id>)).len() }, + len: |array: *const ()| unsafe { (*array.cast::>()).len() }, get: |array: *const (), index: usize| unsafe { - (*(array as *const Vec<$type_id>)) + (*array.cast::>()) .get(index).ok_or_else(|| $crate::ReflectionError::InvalidArrayIndex(index, concat!("Vec<",stringify!($type_id),">"))) .and_then(|value| Ok((value as *const $type_id).cast::<()>())) }, get_mut:|array: *mut (), index: usize| unsafe { - (*(array as *mut Vec<$type_id>)) + (*array.cast::>()) .get_mut(index).ok_or_else(|| $crate::ReflectionError::InvalidArrayIndex(index, concat!("Vec<",stringify!($type_id),">"))) .and_then(|value| Ok((value as *mut $type_id).cast::<()>())) }, clear:|array: *mut ()| unsafe { - (*(array as *mut Vec<$type_id>)).clear(); + (*array.cast::>()).clear(); }, insert_element : |array: *mut(), index : Option, deserializer: &mut dyn::erased_serde::Deserializer<'_>| unsafe { - let array = &mut (*(array as *mut Vec<$type_id>)); + let array = &mut (*array.cast::>()); let new_element : $type_id = ::erased_serde::deserialize(deserializer) .map_err(|err|$crate::utils::ReflectionError::ErrorErasedSerde(err))?; @@ -95,7 +95,7 @@ macro_rules! implement_array_descriptor { }, delete_element : |array: *mut(), index : usize, old_value_ser: Option<&mut dyn::erased_serde::Serializer> | unsafe { - let array = &mut (*(array as *mut Vec<$type_id>)); + let array = &mut (*array.cast::>()); if index >= array.len() { return Err($crate::ReflectionError::InvalidArrayIndex(index, concat!("Vec<",stringify!($type_id),">"))); } @@ -107,7 +107,7 @@ macro_rules! implement_array_descriptor { Ok(()) }, reorder_element : |array: *mut(), old_index : usize, new_index : usize | unsafe { - let array = &mut (*(array as *mut Vec<$type_id>)); + let array = &mut (*array.cast::>()); if old_index >= array.len() { return Err($crate::ReflectionError::InvalidArrayIndex(old_index, concat!("Vec<",stringify!($type_id),">"))); } @@ -123,7 +123,7 @@ macro_rules! implement_array_descriptor { let value_to_delete = ::erased_serde::deserialize::<$type_id>(value_de) .map_err(|err| $crate::ReflectionError::ErrorErasedSerde(err))?; - let array = &mut (*(array as *mut Vec<$type_id>)); + let array = &mut (*array.cast::>()); if let Some((old_value,index)) = $crate::array_remove_value(array,&value_to_delete) { if let Some(serializer) = old_value_ser { ::erased_serde::serialize(&old_value, serializer) diff --git a/crates/lgn-data-model/src/option_descriptor.rs b/crates/lgn-data-model/src/option_descriptor.rs index b55f2b0a24..32327a33ac 100644 --- a/crates/lgn-data-model/src/option_descriptor.rs +++ b/crates/lgn-data-model/src/option_descriptor.rs @@ -22,12 +22,12 @@ macro_rules! implement_option_descriptor { Result::, $crate::ReflectionError>::Ok(Option::<$type_id>::None)), inner_type: <$type_id as $crate::TypeReflection>::get_type_def(), get_inner: |option: *const ()| unsafe { - (*(option as *const Option<$type_id>)) + (*option.cast::>()) .as_ref() .map(|val| (val as *const $type_id).cast::<()>()) }, get_inner_mut: |option: *mut ()| unsafe { - (*(option as *mut Option<$type_id>)) + (*option.cast::>()) .as_mut() .map(|val| (val as *mut $type_id).cast::<()>()) }, diff --git a/crates/lgn-data-model/src/type_reflection.rs b/crates/lgn-data-model/src/type_reflection.rs index 3a7f5ae48b..dddeb97f3c 100644 --- a/crates/lgn-data-model/src/type_reflection.rs +++ b/crates/lgn-data-model/src/type_reflection.rs @@ -47,25 +47,17 @@ impl TypeDefinition { /// Return the name of the type pub fn get_type_name(&self) -> &str { match *self { - TypeDefinition::Array(array_descriptor) => { - array_descriptor.base_descriptor.type_name.as_str() - } - TypeDefinition::Struct(struct_descriptor) => { - struct_descriptor.base_descriptor.type_name.as_str() - } - TypeDefinition::Primitive(primitive_descriptor) => { + Self::Array(array_descriptor) => array_descriptor.base_descriptor.type_name.as_str(), + Self::Struct(struct_descriptor) => struct_descriptor.base_descriptor.type_name.as_str(), + Self::Primitive(primitive_descriptor) => { primitive_descriptor.base_descriptor.type_name.as_str() } - TypeDefinition::Option(option_descriptor) => { - option_descriptor.base_descriptor.type_name.as_str() - } - TypeDefinition::BoxDyn(box_dyn_descriptor) => { + Self::Option(option_descriptor) => option_descriptor.base_descriptor.type_name.as_str(), + Self::BoxDyn(box_dyn_descriptor) => { box_dyn_descriptor.base_descriptor.type_name.as_str() } - TypeDefinition::Enum(enum_descriptor) => { - enum_descriptor.base_descriptor.type_name.as_str() - } - TypeDefinition::None => "None", + Self::Enum(enum_descriptor) => enum_descriptor.base_descriptor.type_name.as_str(), + Self::None => "None", } } @@ -75,27 +67,25 @@ impl TypeDefinition { serializer: &mut dyn ::erased_serde::Serializer, ) -> Result<(), crate::ReflectionError> { match *self { - TypeDefinition::Array(array_descriptor) => { + Self::Array(array_descriptor) => { (array_descriptor.base_descriptor.serialize_new_instance)(serializer) } - TypeDefinition::Struct(struct_descriptor) => { + Self::Struct(struct_descriptor) => { (struct_descriptor.base_descriptor.serialize_new_instance)(serializer) } - TypeDefinition::Primitive(primitive_descriptor) => { + Self::Primitive(primitive_descriptor) => { (primitive_descriptor.base_descriptor.serialize_new_instance)(serializer) } - TypeDefinition::Option(option_descriptor) => { + Self::Option(option_descriptor) => { (option_descriptor.base_descriptor.serialize_new_instance)(serializer) } - TypeDefinition::BoxDyn(box_dyn_descriptor) => { + Self::BoxDyn(box_dyn_descriptor) => { (box_dyn_descriptor.base_descriptor.serialize_new_instance)(serializer) } - TypeDefinition::Enum(enum_descriptor) => { + Self::Enum(enum_descriptor) => { (enum_descriptor.base_descriptor.serialize_new_instance)(serializer) } - TypeDefinition::None => { - Err(crate::ReflectionError::InvalidTypeDescriptor("None".into())) - } + Self::None => Err(crate::ReflectionError::InvalidTypeDescriptor("None".into())), } } } diff --git a/crates/lgn-graphics-api/src/backends/vulkan/device_context.rs b/crates/lgn-graphics-api/src/backends/vulkan/device_context.rs index a76183a9e3..2e6243b025 100644 --- a/crates/lgn-graphics-api/src/backends/vulkan/device_context.rs +++ b/crates/lgn-graphics-api/src/backends/vulkan/device_context.rs @@ -25,11 +25,11 @@ impl PhysicalDeviceType { /// Convert to `vk::PhysicalDeviceType` pub(crate) fn to_vk(self) -> vk::PhysicalDeviceType { match self { - PhysicalDeviceType::Other => vk::PhysicalDeviceType::OTHER, - PhysicalDeviceType::IntegratedGpu => vk::PhysicalDeviceType::INTEGRATED_GPU, - PhysicalDeviceType::DiscreteGpu => vk::PhysicalDeviceType::DISCRETE_GPU, - PhysicalDeviceType::VirtualGpu => vk::PhysicalDeviceType::VIRTUAL_GPU, - PhysicalDeviceType::Cpu => vk::PhysicalDeviceType::CPU, + Self::Other => vk::PhysicalDeviceType::OTHER, + Self::IntegratedGpu => vk::PhysicalDeviceType::INTEGRATED_GPU, + Self::DiscreteGpu => vk::PhysicalDeviceType::DISCRETE_GPU, + Self::VirtualGpu => vk::PhysicalDeviceType::VIRTUAL_GPU, + Self::Cpu => vk::PhysicalDeviceType::CPU, } } } diff --git a/crates/lgn-graphics-api/src/backends/vulkan/queue.rs b/crates/lgn-graphics-api/src/backends/vulkan/queue.rs index 24c1367a07..f01a6fea51 100644 --- a/crates/lgn-graphics-api/src/backends/vulkan/queue.rs +++ b/crates/lgn-graphics-api/src/backends/vulkan/queue.rs @@ -200,6 +200,7 @@ impl Queue { Ok(PresentSuccessResult::Success) } } + #[allow(clippy::match_single_binding)] Err(e) => match e { // todo(jal) //GfxError::VkError(vk::Result::ERROR_OUT_OF_DATE_KHR) => { diff --git a/crates/lgn-graphics-api/src/backends/vulkan/swapchain.rs b/crates/lgn-graphics-api/src/backends/vulkan/swapchain.rs index dfc0668f36..ea04ed503c 100644 --- a/crates/lgn-graphics-api/src/backends/vulkan/swapchain.rs +++ b/crates/lgn-graphics-api/src/backends/vulkan/swapchain.rs @@ -51,10 +51,10 @@ impl VkPresentMode { /// Convert to `vk::PresentModeKHR` pub fn to_vk(self) -> vk::PresentModeKHR { match self { - VkPresentMode::Immediate => vk::PresentModeKHR::IMMEDIATE, - VkPresentMode::Mailbox => vk::PresentModeKHR::MAILBOX, - VkPresentMode::Fifo => vk::PresentModeKHR::FIFO, - VkPresentMode::FifoRelaxed => vk::PresentModeKHR::FIFO_RELAXED, + Self::Immediate => vk::PresentModeKHR::IMMEDIATE, + Self::Mailbox => vk::PresentModeKHR::MAILBOX, + Self::Fifo => vk::PresentModeKHR::FIFO, + Self::FifoRelaxed => vk::PresentModeKHR::FIFO_RELAXED, } } } diff --git a/crates/lgn-graphics-api/src/device_context.rs b/crates/lgn-graphics-api/src/device_context.rs index 102cf207c3..31300a8696 100644 --- a/crates/lgn-graphics-api/src/device_context.rs +++ b/crates/lgn-graphics-api/src/device_context.rs @@ -87,7 +87,9 @@ pub(crate) struct DeviceContextInner { impl std::fmt::Debug for DeviceContext { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_struct("DeviceContext").field("handle", &0).finish() + f.debug_struct("DeviceContext") + .field("handle", &0_u64) + .finish() } } diff --git a/crates/lgn-graphics-api/src/shader.rs b/crates/lgn-graphics-api/src/shader.rs index 5b23a99a47..a66cb12a94 100644 --- a/crates/lgn-graphics-api/src/shader.rs +++ b/crates/lgn-graphics-api/src/shader.rs @@ -25,8 +25,8 @@ pub enum ShaderPackage { impl ShaderPackage { pub fn module_def(&self) -> ShaderModuleDef<'_> { match self { - ShaderPackage::SpirV(bytes) => ShaderModuleDef::SpirVBytes(bytes), - ShaderPackage::Null => ShaderModuleDef::Null(PhantomData::default()), + Self::SpirV(bytes) => ShaderModuleDef::SpirVBytes(bytes), + Self::Null => ShaderModuleDef::Null(PhantomData::default()), } } } diff --git a/crates/lgn-graphics-api/src/types/format.rs b/crates/lgn-graphics-api/src/types/format.rs index be3c2d4fa1..073563ae97 100644 --- a/crates/lgn-graphics-api/src/types/format.rs +++ b/crates/lgn-graphics-api/src/types/format.rs @@ -604,12 +604,10 @@ impl Format { } pub fn is_depth_and_stencil(self) -> bool { - match self { - Format::D16_UNORM_S8_UINT | Format::D24_UNORM_S8_UINT | Format::D32_SFLOAT_S8_UINT => { - true - } - _ => false, - } + matches!( + self, + Self::D16_UNORM_S8_UINT | Self::D24_UNORM_S8_UINT | Self::D32_SFLOAT_S8_UINT + ) } pub fn has_depth(self) -> bool { @@ -691,62 +689,62 @@ impl Format { #[allow(clippy::match_same_arms)] pub fn block_width_in_pixels(self) -> u32 { match self { - Format::UNDEFINED => unreachable!(), + Self::UNDEFINED => unreachable!(), - Format::BC1_RGB_UNORM_BLOCK => 4, - Format::BC1_RGB_SRGB_BLOCK => 4, - Format::BC1_RGBA_UNORM_BLOCK => 4, - Format::BC1_RGBA_SRGB_BLOCK => 4, - Format::BC2_UNORM_BLOCK => 4, - Format::BC2_SRGB_BLOCK => 4, - Format::BC3_UNORM_BLOCK => 4, - Format::BC3_SRGB_BLOCK => 4, - Format::BC4_UNORM_BLOCK => 4, - Format::BC4_SNORM_BLOCK => 4, - Format::BC5_UNORM_BLOCK => 4, - Format::BC5_SNORM_BLOCK => 4, - Format::BC6H_UFLOAT_BLOCK => 4, - Format::BC6H_SFLOAT_BLOCK => 4, - Format::BC7_UNORM_BLOCK => 4, - Format::BC7_SRGB_BLOCK => 4, - Format::ETC2_R8G8B8_UNORM_BLOCK => 4, - Format::ETC2_R8G8B8_SRGB_BLOCK => 4, - Format::ETC2_R8G8B8A1_UNORM_BLOCK => 4, - Format::ETC2_R8G8B8A1_SRGB_BLOCK => 4, - Format::ETC2_R8G8B8A8_UNORM_BLOCK => 4, - Format::ETC2_R8G8B8A8_SRGB_BLOCK => 4, - Format::EAC_R11_UNORM_BLOCK => 4, - Format::EAC_R11_SNORM_BLOCK => 4, - Format::EAC_R11G11_UNORM_BLOCK => 4, - Format::EAC_R11G11_SNORM_BLOCK => 4, - Format::ASTC_4X4_UNORM_BLOCK => 4, - Format::ASTC_4X4_SRGB_BLOCK => 4, - Format::ASTC_5X4_UNORM_BLOCK => 5, - Format::ASTC_5X4_SRGB_BLOCK => 5, - Format::ASTC_5X5_UNORM_BLOCK => 5, - Format::ASTC_5X5_SRGB_BLOCK => 5, - Format::ASTC_6X5_UNORM_BLOCK => 6, - Format::ASTC_6X5_SRGB_BLOCK => 6, - Format::ASTC_6X6_UNORM_BLOCK => 6, - Format::ASTC_6X6_SRGB_BLOCK => 6, - Format::ASTC_8X5_UNORM_BLOCK => 8, - Format::ASTC_8X5_SRGB_BLOCK => 8, - Format::ASTC_8X6_UNORM_BLOCK => 8, - Format::ASTC_8X6_SRGB_BLOCK => 8, - Format::ASTC_8X8_UNORM_BLOCK => 8, - Format::ASTC_8X8_SRGB_BLOCK => 8, - Format::ASTC_10X5_UNORM_BLOCK => 10, - Format::ASTC_10X5_SRGB_BLOCK => 10, - Format::ASTC_10X6_UNORM_BLOCK => 10, - Format::ASTC_10X6_SRGB_BLOCK => 10, - Format::ASTC_10X8_UNORM_BLOCK => 10, - Format::ASTC_10X8_SRGB_BLOCK => 10, - Format::ASTC_10X10_UNORM_BLOCK => 10, - Format::ASTC_10X10_SRGB_BLOCK => 10, - Format::ASTC_12X10_UNORM_BLOCK => 12, - Format::ASTC_12X10_SRGB_BLOCK => 12, - Format::ASTC_12X12_UNORM_BLOCK => 12, - Format::ASTC_12X12_SRGB_BLOCK => 12, + Self::BC1_RGB_UNORM_BLOCK => 4, + Self::BC1_RGB_SRGB_BLOCK => 4, + Self::BC1_RGBA_UNORM_BLOCK => 4, + Self::BC1_RGBA_SRGB_BLOCK => 4, + Self::BC2_UNORM_BLOCK => 4, + Self::BC2_SRGB_BLOCK => 4, + Self::BC3_UNORM_BLOCK => 4, + Self::BC3_SRGB_BLOCK => 4, + Self::BC4_UNORM_BLOCK => 4, + Self::BC4_SNORM_BLOCK => 4, + Self::BC5_UNORM_BLOCK => 4, + Self::BC5_SNORM_BLOCK => 4, + Self::BC6H_UFLOAT_BLOCK => 4, + Self::BC6H_SFLOAT_BLOCK => 4, + Self::BC7_UNORM_BLOCK => 4, + Self::BC7_SRGB_BLOCK => 4, + Self::ETC2_R8G8B8_UNORM_BLOCK => 4, + Self::ETC2_R8G8B8_SRGB_BLOCK => 4, + Self::ETC2_R8G8B8A1_UNORM_BLOCK => 4, + Self::ETC2_R8G8B8A1_SRGB_BLOCK => 4, + Self::ETC2_R8G8B8A8_UNORM_BLOCK => 4, + Self::ETC2_R8G8B8A8_SRGB_BLOCK => 4, + Self::EAC_R11_UNORM_BLOCK => 4, + Self::EAC_R11_SNORM_BLOCK => 4, + Self::EAC_R11G11_UNORM_BLOCK => 4, + Self::EAC_R11G11_SNORM_BLOCK => 4, + Self::ASTC_4X4_UNORM_BLOCK => 4, + Self::ASTC_4X4_SRGB_BLOCK => 4, + Self::ASTC_5X4_UNORM_BLOCK => 5, + Self::ASTC_5X4_SRGB_BLOCK => 5, + Self::ASTC_5X5_UNORM_BLOCK => 5, + Self::ASTC_5X5_SRGB_BLOCK => 5, + Self::ASTC_6X5_UNORM_BLOCK => 6, + Self::ASTC_6X5_SRGB_BLOCK => 6, + Self::ASTC_6X6_UNORM_BLOCK => 6, + Self::ASTC_6X6_SRGB_BLOCK => 6, + Self::ASTC_8X5_UNORM_BLOCK => 8, + Self::ASTC_8X5_SRGB_BLOCK => 8, + Self::ASTC_8X6_UNORM_BLOCK => 8, + Self::ASTC_8X6_SRGB_BLOCK => 8, + Self::ASTC_8X8_UNORM_BLOCK => 8, + Self::ASTC_8X8_SRGB_BLOCK => 8, + Self::ASTC_10X5_UNORM_BLOCK => 10, + Self::ASTC_10X5_SRGB_BLOCK => 10, + Self::ASTC_10X6_UNORM_BLOCK => 10, + Self::ASTC_10X6_SRGB_BLOCK => 10, + Self::ASTC_10X8_UNORM_BLOCK => 10, + Self::ASTC_10X8_SRGB_BLOCK => 10, + Self::ASTC_10X10_UNORM_BLOCK => 10, + Self::ASTC_10X10_SRGB_BLOCK => 10, + Self::ASTC_12X10_UNORM_BLOCK => 12, + Self::ASTC_12X10_SRGB_BLOCK => 12, + Self::ASTC_12X12_UNORM_BLOCK => 12, + Self::ASTC_12X12_SRGB_BLOCK => 12, _ => 1, } @@ -755,62 +753,62 @@ impl Format { #[allow(clippy::match_same_arms)] pub fn block_height_in_pixels(self) -> u32 { match self { - Format::UNDEFINED => unreachable!(), + Self::UNDEFINED => unreachable!(), - Format::BC1_RGB_UNORM_BLOCK => 4, - Format::BC1_RGB_SRGB_BLOCK => 4, - Format::BC1_RGBA_UNORM_BLOCK => 4, - Format::BC1_RGBA_SRGB_BLOCK => 4, - Format::BC2_UNORM_BLOCK => 4, - Format::BC2_SRGB_BLOCK => 4, - Format::BC3_UNORM_BLOCK => 4, - Format::BC3_SRGB_BLOCK => 4, - Format::BC4_UNORM_BLOCK => 4, - Format::BC4_SNORM_BLOCK => 4, - Format::BC5_UNORM_BLOCK => 4, - Format::BC5_SNORM_BLOCK => 4, - Format::BC6H_UFLOAT_BLOCK => 4, - Format::BC6H_SFLOAT_BLOCK => 4, - Format::BC7_UNORM_BLOCK => 4, - Format::BC7_SRGB_BLOCK => 4, - Format::ETC2_R8G8B8_UNORM_BLOCK => 4, - Format::ETC2_R8G8B8_SRGB_BLOCK => 4, - Format::ETC2_R8G8B8A1_UNORM_BLOCK => 4, - Format::ETC2_R8G8B8A1_SRGB_BLOCK => 4, - Format::ETC2_R8G8B8A8_UNORM_BLOCK => 4, - Format::ETC2_R8G8B8A8_SRGB_BLOCK => 4, - Format::EAC_R11_UNORM_BLOCK => 4, - Format::EAC_R11_SNORM_BLOCK => 4, - Format::EAC_R11G11_UNORM_BLOCK => 4, - Format::EAC_R11G11_SNORM_BLOCK => 4, - Format::ASTC_4X4_UNORM_BLOCK => 4, - Format::ASTC_4X4_SRGB_BLOCK => 4, - Format::ASTC_5X4_UNORM_BLOCK => 4, - Format::ASTC_5X4_SRGB_BLOCK => 4, - Format::ASTC_5X5_UNORM_BLOCK => 5, - Format::ASTC_5X5_SRGB_BLOCK => 5, - Format::ASTC_6X5_UNORM_BLOCK => 5, - Format::ASTC_6X5_SRGB_BLOCK => 5, - Format::ASTC_6X6_UNORM_BLOCK => 6, - Format::ASTC_6X6_SRGB_BLOCK => 6, - Format::ASTC_8X5_UNORM_BLOCK => 5, - Format::ASTC_8X5_SRGB_BLOCK => 5, - Format::ASTC_8X6_UNORM_BLOCK => 6, - Format::ASTC_8X6_SRGB_BLOCK => 6, - Format::ASTC_8X8_UNORM_BLOCK => 8, - Format::ASTC_8X8_SRGB_BLOCK => 8, - Format::ASTC_10X5_UNORM_BLOCK => 5, - Format::ASTC_10X5_SRGB_BLOCK => 5, - Format::ASTC_10X6_UNORM_BLOCK => 6, - Format::ASTC_10X6_SRGB_BLOCK => 6, - Format::ASTC_10X8_UNORM_BLOCK => 8, - Format::ASTC_10X8_SRGB_BLOCK => 8, - Format::ASTC_10X10_UNORM_BLOCK => 10, - Format::ASTC_10X10_SRGB_BLOCK => 10, - Format::ASTC_12X10_UNORM_BLOCK => 10, - Format::ASTC_12X10_SRGB_BLOCK => 10, - Format::ASTC_12X12_UNORM_BLOCK => 12, - Format::ASTC_12X12_SRGB_BLOCK => 12, + Self::BC1_RGB_UNORM_BLOCK => 4, + Self::BC1_RGB_SRGB_BLOCK => 4, + Self::BC1_RGBA_UNORM_BLOCK => 4, + Self::BC1_RGBA_SRGB_BLOCK => 4, + Self::BC2_UNORM_BLOCK => 4, + Self::BC2_SRGB_BLOCK => 4, + Self::BC3_UNORM_BLOCK => 4, + Self::BC3_SRGB_BLOCK => 4, + Self::BC4_UNORM_BLOCK => 4, + Self::BC4_SNORM_BLOCK => 4, + Self::BC5_UNORM_BLOCK => 4, + Self::BC5_SNORM_BLOCK => 4, + Self::BC6H_UFLOAT_BLOCK => 4, + Self::BC6H_SFLOAT_BLOCK => 4, + Self::BC7_UNORM_BLOCK => 4, + Self::BC7_SRGB_BLOCK => 4, + Self::ETC2_R8G8B8_UNORM_BLOCK => 4, + Self::ETC2_R8G8B8_SRGB_BLOCK => 4, + Self::ETC2_R8G8B8A1_UNORM_BLOCK => 4, + Self::ETC2_R8G8B8A1_SRGB_BLOCK => 4, + Self::ETC2_R8G8B8A8_UNORM_BLOCK => 4, + Self::ETC2_R8G8B8A8_SRGB_BLOCK => 4, + Self::EAC_R11_UNORM_BLOCK => 4, + Self::EAC_R11_SNORM_BLOCK => 4, + Self::EAC_R11G11_UNORM_BLOCK => 4, + Self::EAC_R11G11_SNORM_BLOCK => 4, + Self::ASTC_4X4_UNORM_BLOCK => 4, + Self::ASTC_4X4_SRGB_BLOCK => 4, + Self::ASTC_5X4_UNORM_BLOCK => 4, + Self::ASTC_5X4_SRGB_BLOCK => 4, + Self::ASTC_5X5_UNORM_BLOCK => 5, + Self::ASTC_5X5_SRGB_BLOCK => 5, + Self::ASTC_6X5_UNORM_BLOCK => 5, + Self::ASTC_6X5_SRGB_BLOCK => 5, + Self::ASTC_6X6_UNORM_BLOCK => 6, + Self::ASTC_6X6_SRGB_BLOCK => 6, + Self::ASTC_8X5_UNORM_BLOCK => 5, + Self::ASTC_8X5_SRGB_BLOCK => 5, + Self::ASTC_8X6_UNORM_BLOCK => 6, + Self::ASTC_8X6_SRGB_BLOCK => 6, + Self::ASTC_8X8_UNORM_BLOCK => 8, + Self::ASTC_8X8_SRGB_BLOCK => 8, + Self::ASTC_10X5_UNORM_BLOCK => 5, + Self::ASTC_10X5_SRGB_BLOCK => 5, + Self::ASTC_10X6_UNORM_BLOCK => 6, + Self::ASTC_10X6_SRGB_BLOCK => 6, + Self::ASTC_10X8_UNORM_BLOCK => 8, + Self::ASTC_10X8_SRGB_BLOCK => 8, + Self::ASTC_10X10_UNORM_BLOCK => 10, + Self::ASTC_10X10_SRGB_BLOCK => 10, + Self::ASTC_12X10_UNORM_BLOCK => 10, + Self::ASTC_12X10_SRGB_BLOCK => 10, + Self::ASTC_12X12_UNORM_BLOCK => 12, + Self::ASTC_12X12_SRGB_BLOCK => 12, _ => 1, } } @@ -818,304 +816,304 @@ impl Format { #[allow(clippy::match_same_arms)] pub fn channel_count(self) -> u32 { match self { - Format::UNDEFINED => unreachable!(), + Self::UNDEFINED => unreachable!(), // Pixel-based - Format::R4G4_UNORM_PACK8 => 2, - Format::R4G4B4A4_UNORM_PACK16 => 4, - Format::B4G4R4A4_UNORM_PACK16 => 4, - Format::R5G6B5_UNORM_PACK16 => 3, - Format::B5G6R5_UNORM_PACK16 => 3, - Format::R5G5B5A1_UNORM_PACK16 => 4, - Format::B5G5R5A1_UNORM_PACK16 => 4, - Format::A1R5G5B5_UNORM_PACK16 => 4, - Format::R8_UNORM => 1, - Format::R8_SNORM => 1, - Format::R8_USCALED => 1, - Format::R8_SSCALED => 1, - Format::R8_UINT => 1, - Format::R8_SINT => 1, - Format::R8_SRGB => 1, - Format::R8G8_UNORM => 2, - Format::R8G8_SNORM => 2, - Format::R8G8_USCALED => 2, - Format::R8G8_SSCALED => 2, - Format::R8G8_UINT => 2, - Format::R8G8_SINT => 2, - Format::R8G8_SRGB => 2, - Format::R8G8B8_UNORM => 3, - Format::R8G8B8_SNORM => 3, - Format::R8G8B8_USCALED => 3, - Format::R8G8B8_SSCALED => 3, - Format::R8G8B8_UINT => 3, - Format::R8G8B8_SINT => 3, - Format::R8G8B8_SRGB => 3, - Format::B8G8R8_UNORM => 3, - Format::B8G8R8_SNORM => 3, - Format::B8G8R8_USCALED => 3, - Format::B8G8R8_SSCALED => 3, - Format::B8G8R8_UINT => 3, - Format::B8G8R8_SINT => 3, - Format::B8G8R8_SRGB => 3, - Format::R8G8B8A8_UNORM => 4, - Format::R8G8B8A8_SNORM => 4, - Format::R8G8B8A8_USCALED => 4, - Format::R8G8B8A8_SSCALED => 4, - Format::R8G8B8A8_UINT => 4, - Format::R8G8B8A8_SINT => 4, - Format::R8G8B8A8_SRGB => 4, - Format::B8G8R8A8_UNORM => 4, - Format::B8G8R8A8_SNORM => 4, - Format::B8G8R8A8_USCALED => 4, - Format::B8G8R8A8_SSCALED => 4, - Format::B8G8R8A8_UINT => 4, - Format::B8G8R8A8_SINT => 4, - Format::B8G8R8A8_SRGB => 4, - Format::A8B8G8R8_UNORM_PACK32 => 4, - Format::A8B8G8R8_SNORM_PACK32 => 4, - Format::A8B8G8R8_USCALED_PACK32 => 4, - Format::A8B8G8R8_SSCALED_PACK32 => 4, - Format::A8B8G8R8_UINT_PACK32 => 4, - Format::A8B8G8R8_SINT_PACK32 => 4, - Format::A8B8G8R8_SRGB_PACK32 => 4, - Format::A2R10G10B10_UNORM_PACK32 => 4, - Format::A2R10G10B10_SNORM_PACK32 => 4, - Format::A2R10G10B10_USCALED_PACK32 => 4, - Format::A2R10G10B10_SSCALED_PACK32 => 4, - Format::A2R10G10B10_UINT_PACK32 => 4, - Format::A2R10G10B10_SINT_PACK32 => 4, - Format::A2B10G10R10_UNORM_PACK32 => 4, - Format::A2B10G10R10_SNORM_PACK32 => 4, - Format::A2B10G10R10_USCALED_PACK32 => 4, - Format::A2B10G10R10_SSCALED_PACK32 => 4, - Format::A2B10G10R10_UINT_PACK32 => 4, - Format::A2B10G10R10_SINT_PACK32 => 4, - Format::R16_UNORM => 1, - Format::R16_SNORM => 1, - Format::R16_USCALED => 1, - Format::R16_SSCALED => 1, - Format::R16_UINT => 1, - Format::R16_SINT => 1, - Format::R16_SFLOAT => 1, - Format::R16G16_UNORM => 2, - Format::R16G16_SNORM => 2, - Format::R16G16_USCALED => 2, - Format::R16G16_SSCALED => 2, - Format::R16G16_UINT => 2, - Format::R16G16_SINT => 2, - Format::R16G16_SFLOAT => 2, - Format::R16G16B16_UNORM => 3, - Format::R16G16B16_SNORM => 3, - Format::R16G16B16_USCALED => 3, - Format::R16G16B16_SSCALED => 3, - Format::R16G16B16_UINT => 3, - Format::R16G16B16_SINT => 3, - Format::R16G16B16_SFLOAT => 3, - Format::R16G16B16A16_UNORM => 4, - Format::R16G16B16A16_SNORM => 4, - Format::R16G16B16A16_USCALED => 4, - Format::R16G16B16A16_SSCALED => 4, - Format::R16G16B16A16_UINT => 4, - Format::R16G16B16A16_SINT => 4, - Format::R16G16B16A16_SFLOAT => 4, - Format::R32_UINT => 1, - Format::R32_SINT => 1, - Format::R32_SFLOAT => 1, - Format::R32G32_UINT => 2, - Format::R32G32_SINT => 2, - Format::R32G32_SFLOAT => 2, - Format::R32G32B32_UINT => 3, - Format::R32G32B32_SINT => 3, - Format::R32G32B32_SFLOAT => 3, - Format::R32G32B32A32_UINT => 4, - Format::R32G32B32A32_SINT => 4, - Format::R32G32B32A32_SFLOAT => 4, - Format::R64_UINT => 1, - Format::R64_SINT => 1, - Format::R64_SFLOAT => 1, - Format::R64G64_UINT => 2, - Format::R64G64_SINT => 2, - Format::R64G64_SFLOAT => 2, - Format::R64G64B64_UINT => 3, - Format::R64G64B64_SINT => 3, - Format::R64G64B64_SFLOAT => 3, - Format::R64G64B64A64_UINT => 4, - Format::R64G64B64A64_SINT => 4, - Format::R64G64B64A64_SFLOAT => 4, - Format::B10G11R11_UFLOAT_PACK32 => 3, - Format::E5B9G9R9_UFLOAT_PACK32 => 4, - Format::G8_B8_R8_3PLANE_420_UNORM => 3, - Format::D16_UNORM => 1, - Format::X8_D24_UNORM_PACK32 => 2, - Format::D32_SFLOAT => 1, - Format::S8_UINT => 1, - Format::D16_UNORM_S8_UINT => 2, - Format::D24_UNORM_S8_UINT => 2, - Format::D32_SFLOAT_S8_UINT => 2, + Self::R4G4_UNORM_PACK8 => 2, + Self::R4G4B4A4_UNORM_PACK16 => 4, + Self::B4G4R4A4_UNORM_PACK16 => 4, + Self::R5G6B5_UNORM_PACK16 => 3, + Self::B5G6R5_UNORM_PACK16 => 3, + Self::R5G5B5A1_UNORM_PACK16 => 4, + Self::B5G5R5A1_UNORM_PACK16 => 4, + Self::A1R5G5B5_UNORM_PACK16 => 4, + Self::R8_UNORM => 1, + Self::R8_SNORM => 1, + Self::R8_USCALED => 1, + Self::R8_SSCALED => 1, + Self::R8_UINT => 1, + Self::R8_SINT => 1, + Self::R8_SRGB => 1, + Self::R8G8_UNORM => 2, + Self::R8G8_SNORM => 2, + Self::R8G8_USCALED => 2, + Self::R8G8_SSCALED => 2, + Self::R8G8_UINT => 2, + Self::R8G8_SINT => 2, + Self::R8G8_SRGB => 2, + Self::R8G8B8_UNORM => 3, + Self::R8G8B8_SNORM => 3, + Self::R8G8B8_USCALED => 3, + Self::R8G8B8_SSCALED => 3, + Self::R8G8B8_UINT => 3, + Self::R8G8B8_SINT => 3, + Self::R8G8B8_SRGB => 3, + Self::B8G8R8_UNORM => 3, + Self::B8G8R8_SNORM => 3, + Self::B8G8R8_USCALED => 3, + Self::B8G8R8_SSCALED => 3, + Self::B8G8R8_UINT => 3, + Self::B8G8R8_SINT => 3, + Self::B8G8R8_SRGB => 3, + Self::R8G8B8A8_UNORM => 4, + Self::R8G8B8A8_SNORM => 4, + Self::R8G8B8A8_USCALED => 4, + Self::R8G8B8A8_SSCALED => 4, + Self::R8G8B8A8_UINT => 4, + Self::R8G8B8A8_SINT => 4, + Self::R8G8B8A8_SRGB => 4, + Self::B8G8R8A8_UNORM => 4, + Self::B8G8R8A8_SNORM => 4, + Self::B8G8R8A8_USCALED => 4, + Self::B8G8R8A8_SSCALED => 4, + Self::B8G8R8A8_UINT => 4, + Self::B8G8R8A8_SINT => 4, + Self::B8G8R8A8_SRGB => 4, + Self::A8B8G8R8_UNORM_PACK32 => 4, + Self::A8B8G8R8_SNORM_PACK32 => 4, + Self::A8B8G8R8_USCALED_PACK32 => 4, + Self::A8B8G8R8_SSCALED_PACK32 => 4, + Self::A8B8G8R8_UINT_PACK32 => 4, + Self::A8B8G8R8_SINT_PACK32 => 4, + Self::A8B8G8R8_SRGB_PACK32 => 4, + Self::A2R10G10B10_UNORM_PACK32 => 4, + Self::A2R10G10B10_SNORM_PACK32 => 4, + Self::A2R10G10B10_USCALED_PACK32 => 4, + Self::A2R10G10B10_SSCALED_PACK32 => 4, + Self::A2R10G10B10_UINT_PACK32 => 4, + Self::A2R10G10B10_SINT_PACK32 => 4, + Self::A2B10G10R10_UNORM_PACK32 => 4, + Self::A2B10G10R10_SNORM_PACK32 => 4, + Self::A2B10G10R10_USCALED_PACK32 => 4, + Self::A2B10G10R10_SSCALED_PACK32 => 4, + Self::A2B10G10R10_UINT_PACK32 => 4, + Self::A2B10G10R10_SINT_PACK32 => 4, + Self::R16_UNORM => 1, + Self::R16_SNORM => 1, + Self::R16_USCALED => 1, + Self::R16_SSCALED => 1, + Self::R16_UINT => 1, + Self::R16_SINT => 1, + Self::R16_SFLOAT => 1, + Self::R16G16_UNORM => 2, + Self::R16G16_SNORM => 2, + Self::R16G16_USCALED => 2, + Self::R16G16_SSCALED => 2, + Self::R16G16_UINT => 2, + Self::R16G16_SINT => 2, + Self::R16G16_SFLOAT => 2, + Self::R16G16B16_UNORM => 3, + Self::R16G16B16_SNORM => 3, + Self::R16G16B16_USCALED => 3, + Self::R16G16B16_SSCALED => 3, + Self::R16G16B16_UINT => 3, + Self::R16G16B16_SINT => 3, + Self::R16G16B16_SFLOAT => 3, + Self::R16G16B16A16_UNORM => 4, + Self::R16G16B16A16_SNORM => 4, + Self::R16G16B16A16_USCALED => 4, + Self::R16G16B16A16_SSCALED => 4, + Self::R16G16B16A16_UINT => 4, + Self::R16G16B16A16_SINT => 4, + Self::R16G16B16A16_SFLOAT => 4, + Self::R32_UINT => 1, + Self::R32_SINT => 1, + Self::R32_SFLOAT => 1, + Self::R32G32_UINT => 2, + Self::R32G32_SINT => 2, + Self::R32G32_SFLOAT => 2, + Self::R32G32B32_UINT => 3, + Self::R32G32B32_SINT => 3, + Self::R32G32B32_SFLOAT => 3, + Self::R32G32B32A32_UINT => 4, + Self::R32G32B32A32_SINT => 4, + Self::R32G32B32A32_SFLOAT => 4, + Self::R64_UINT => 1, + Self::R64_SINT => 1, + Self::R64_SFLOAT => 1, + Self::R64G64_UINT => 2, + Self::R64G64_SINT => 2, + Self::R64G64_SFLOAT => 2, + Self::R64G64B64_UINT => 3, + Self::R64G64B64_SINT => 3, + Self::R64G64B64_SFLOAT => 3, + Self::R64G64B64A64_UINT => 4, + Self::R64G64B64A64_SINT => 4, + Self::R64G64B64A64_SFLOAT => 4, + Self::B10G11R11_UFLOAT_PACK32 => 3, + Self::E5B9G9R9_UFLOAT_PACK32 => 4, + Self::G8_B8_R8_3PLANE_420_UNORM => 3, + Self::D16_UNORM => 1, + Self::X8_D24_UNORM_PACK32 => 2, + Self::D32_SFLOAT => 1, + Self::S8_UINT => 1, + Self::D16_UNORM_S8_UINT => 2, + Self::D24_UNORM_S8_UINT => 2, + Self::D32_SFLOAT_S8_UINT => 2, // Block-based - Format::BC1_RGB_UNORM_BLOCK => 3, - Format::BC1_RGB_SRGB_BLOCK => 3, - Format::BC1_RGBA_UNORM_BLOCK => 4, - Format::BC1_RGBA_SRGB_BLOCK => 4, - Format::BC2_UNORM_BLOCK => 4, - Format::BC2_SRGB_BLOCK => 4, - Format::BC3_UNORM_BLOCK => 4, - Format::BC3_SRGB_BLOCK => 4, - Format::BC4_UNORM_BLOCK => 1, - Format::BC4_SNORM_BLOCK => 1, - Format::BC5_UNORM_BLOCK => 2, - Format::BC5_SNORM_BLOCK => 2, - Format::BC6H_UFLOAT_BLOCK => 3, - Format::BC6H_SFLOAT_BLOCK => 3, - Format::BC7_UNORM_BLOCK => 4, - Format::BC7_SRGB_BLOCK => 4, - Format::ETC2_R8G8B8_UNORM_BLOCK => 3, - Format::ETC2_R8G8B8_SRGB_BLOCK => 3, - Format::ETC2_R8G8B8A1_UNORM_BLOCK => 4, - Format::ETC2_R8G8B8A1_SRGB_BLOCK => 4, - Format::ETC2_R8G8B8A8_UNORM_BLOCK => 4, - Format::ETC2_R8G8B8A8_SRGB_BLOCK => 4, - Format::EAC_R11_UNORM_BLOCK => 1, - Format::EAC_R11_SNORM_BLOCK => 1, - Format::EAC_R11G11_UNORM_BLOCK => 2, - Format::EAC_R11G11_SNORM_BLOCK => 2, - Format::ASTC_4X4_UNORM_BLOCK => 4, - Format::ASTC_4X4_SRGB_BLOCK => 4, - Format::ASTC_5X4_UNORM_BLOCK => 4, - Format::ASTC_5X4_SRGB_BLOCK => 4, - Format::ASTC_5X5_UNORM_BLOCK => 4, - Format::ASTC_5X5_SRGB_BLOCK => 4, - Format::ASTC_6X5_UNORM_BLOCK => 4, - Format::ASTC_6X5_SRGB_BLOCK => 4, - Format::ASTC_6X6_UNORM_BLOCK => 4, - Format::ASTC_6X6_SRGB_BLOCK => 4, - Format::ASTC_8X5_UNORM_BLOCK => 4, - Format::ASTC_8X5_SRGB_BLOCK => 4, - Format::ASTC_8X6_UNORM_BLOCK => 4, - Format::ASTC_8X6_SRGB_BLOCK => 4, - Format::ASTC_8X8_UNORM_BLOCK => 4, - Format::ASTC_8X8_SRGB_BLOCK => 4, - Format::ASTC_10X5_UNORM_BLOCK => 4, - Format::ASTC_10X5_SRGB_BLOCK => 4, - Format::ASTC_10X6_UNORM_BLOCK => 4, - Format::ASTC_10X6_SRGB_BLOCK => 4, - Format::ASTC_10X8_UNORM_BLOCK => 4, - Format::ASTC_10X8_SRGB_BLOCK => 4, - Format::ASTC_10X10_UNORM_BLOCK => 4, - Format::ASTC_10X10_SRGB_BLOCK => 4, - Format::ASTC_12X10_UNORM_BLOCK => 4, - Format::ASTC_12X10_SRGB_BLOCK => 4, - Format::ASTC_12X12_UNORM_BLOCK => 4, - Format::ASTC_12X12_SRGB_BLOCK => 4, + Self::BC1_RGB_UNORM_BLOCK => 3, + Self::BC1_RGB_SRGB_BLOCK => 3, + Self::BC1_RGBA_UNORM_BLOCK => 4, + Self::BC1_RGBA_SRGB_BLOCK => 4, + Self::BC2_UNORM_BLOCK => 4, + Self::BC2_SRGB_BLOCK => 4, + Self::BC3_UNORM_BLOCK => 4, + Self::BC3_SRGB_BLOCK => 4, + Self::BC4_UNORM_BLOCK => 1, + Self::BC4_SNORM_BLOCK => 1, + Self::BC5_UNORM_BLOCK => 2, + Self::BC5_SNORM_BLOCK => 2, + Self::BC6H_UFLOAT_BLOCK => 3, + Self::BC6H_SFLOAT_BLOCK => 3, + Self::BC7_UNORM_BLOCK => 4, + Self::BC7_SRGB_BLOCK => 4, + Self::ETC2_R8G8B8_UNORM_BLOCK => 3, + Self::ETC2_R8G8B8_SRGB_BLOCK => 3, + Self::ETC2_R8G8B8A1_UNORM_BLOCK => 4, + Self::ETC2_R8G8B8A1_SRGB_BLOCK => 4, + Self::ETC2_R8G8B8A8_UNORM_BLOCK => 4, + Self::ETC2_R8G8B8A8_SRGB_BLOCK => 4, + Self::EAC_R11_UNORM_BLOCK => 1, + Self::EAC_R11_SNORM_BLOCK => 1, + Self::EAC_R11G11_UNORM_BLOCK => 2, + Self::EAC_R11G11_SNORM_BLOCK => 2, + Self::ASTC_4X4_UNORM_BLOCK => 4, + Self::ASTC_4X4_SRGB_BLOCK => 4, + Self::ASTC_5X4_UNORM_BLOCK => 4, + Self::ASTC_5X4_SRGB_BLOCK => 4, + Self::ASTC_5X5_UNORM_BLOCK => 4, + Self::ASTC_5X5_SRGB_BLOCK => 4, + Self::ASTC_6X5_UNORM_BLOCK => 4, + Self::ASTC_6X5_SRGB_BLOCK => 4, + Self::ASTC_6X6_UNORM_BLOCK => 4, + Self::ASTC_6X6_SRGB_BLOCK => 4, + Self::ASTC_8X5_UNORM_BLOCK => 4, + Self::ASTC_8X5_SRGB_BLOCK => 4, + Self::ASTC_8X6_UNORM_BLOCK => 4, + Self::ASTC_8X6_SRGB_BLOCK => 4, + Self::ASTC_8X8_UNORM_BLOCK => 4, + Self::ASTC_8X8_SRGB_BLOCK => 4, + Self::ASTC_10X5_UNORM_BLOCK => 4, + Self::ASTC_10X5_SRGB_BLOCK => 4, + Self::ASTC_10X6_UNORM_BLOCK => 4, + Self::ASTC_10X6_SRGB_BLOCK => 4, + Self::ASTC_10X8_UNORM_BLOCK => 4, + Self::ASTC_10X8_SRGB_BLOCK => 4, + Self::ASTC_10X10_UNORM_BLOCK => 4, + Self::ASTC_10X10_SRGB_BLOCK => 4, + Self::ASTC_12X10_UNORM_BLOCK => 4, + Self::ASTC_12X10_SRGB_BLOCK => 4, + Self::ASTC_12X12_UNORM_BLOCK => 4, + Self::ASTC_12X12_SRGB_BLOCK => 4, } } #[allow(clippy::match_same_arms)] pub fn is_normalized(self) -> bool { match self { - Format::UNDEFINED => unreachable!(), + Self::UNDEFINED => unreachable!(), // Pixel-based - Format::R4G4_UNORM_PACK8 => true, - Format::R4G4B4A4_UNORM_PACK16 => true, - Format::B4G4R4A4_UNORM_PACK16 => true, - Format::R5G6B5_UNORM_PACK16 => true, - Format::B5G6R5_UNORM_PACK16 => true, - Format::R5G5B5A1_UNORM_PACK16 => true, - Format::B5G5R5A1_UNORM_PACK16 => true, - Format::A1R5G5B5_UNORM_PACK16 => true, - Format::R8_UNORM => true, - Format::R8_SNORM => true, - Format::R8_SRGB => true, - Format::R8G8_UNORM => true, - Format::R8G8_SNORM => true, - Format::R8G8_SRGB => true, - Format::R8G8B8_UNORM => true, - Format::R8G8B8_SNORM => true, - Format::R8G8B8_SRGB => true, - Format::B8G8R8_UNORM => true, - Format::B8G8R8_SNORM => true, - Format::B8G8R8_SRGB => true, - Format::R8G8B8A8_UNORM => true, - Format::R8G8B8A8_SNORM => true, - Format::R8G8B8A8_SRGB => true, - Format::B8G8R8A8_UNORM => true, - Format::B8G8R8A8_SNORM => true, - Format::B8G8R8A8_SRGB => true, - Format::A8B8G8R8_UNORM_PACK32 => true, - Format::A8B8G8R8_SNORM_PACK32 => true, - Format::A8B8G8R8_SRGB_PACK32 => true, - Format::A2R10G10B10_UNORM_PACK32 => true, - Format::A2R10G10B10_SNORM_PACK32 => true, - Format::A2B10G10R10_UNORM_PACK32 => true, - Format::A2B10G10R10_SNORM_PACK32 => true, - Format::R16_UNORM => true, - Format::R16_SNORM => true, - Format::R16G16_UNORM => true, - Format::R16G16_SNORM => true, - Format::R16G16B16_UNORM => true, - Format::R16G16B16_SNORM => true, - Format::R16G16B16A16_UNORM => true, - Format::R16G16B16A16_SNORM => true, - Format::D16_UNORM => true, - Format::X8_D24_UNORM_PACK32 => true, - Format::D16_UNORM_S8_UINT => true, - Format::D24_UNORM_S8_UINT => true, + Self::R4G4_UNORM_PACK8 => true, + Self::R4G4B4A4_UNORM_PACK16 => true, + Self::B4G4R4A4_UNORM_PACK16 => true, + Self::R5G6B5_UNORM_PACK16 => true, + Self::B5G6R5_UNORM_PACK16 => true, + Self::R5G5B5A1_UNORM_PACK16 => true, + Self::B5G5R5A1_UNORM_PACK16 => true, + Self::A1R5G5B5_UNORM_PACK16 => true, + Self::R8_UNORM => true, + Self::R8_SNORM => true, + Self::R8_SRGB => true, + Self::R8G8_UNORM => true, + Self::R8G8_SNORM => true, + Self::R8G8_SRGB => true, + Self::R8G8B8_UNORM => true, + Self::R8G8B8_SNORM => true, + Self::R8G8B8_SRGB => true, + Self::B8G8R8_UNORM => true, + Self::B8G8R8_SNORM => true, + Self::B8G8R8_SRGB => true, + Self::R8G8B8A8_UNORM => true, + Self::R8G8B8A8_SNORM => true, + Self::R8G8B8A8_SRGB => true, + Self::B8G8R8A8_UNORM => true, + Self::B8G8R8A8_SNORM => true, + Self::B8G8R8A8_SRGB => true, + Self::A8B8G8R8_UNORM_PACK32 => true, + Self::A8B8G8R8_SNORM_PACK32 => true, + Self::A8B8G8R8_SRGB_PACK32 => true, + Self::A2R10G10B10_UNORM_PACK32 => true, + Self::A2R10G10B10_SNORM_PACK32 => true, + Self::A2B10G10R10_UNORM_PACK32 => true, + Self::A2B10G10R10_SNORM_PACK32 => true, + Self::R16_UNORM => true, + Self::R16_SNORM => true, + Self::R16G16_UNORM => true, + Self::R16G16_SNORM => true, + Self::R16G16B16_UNORM => true, + Self::R16G16B16_SNORM => true, + Self::R16G16B16A16_UNORM => true, + Self::R16G16B16A16_SNORM => true, + Self::D16_UNORM => true, + Self::X8_D24_UNORM_PACK32 => true, + Self::D16_UNORM_S8_UINT => true, + Self::D24_UNORM_S8_UINT => true, // Block-based - Format::BC1_RGB_UNORM_BLOCK => true, - Format::BC1_RGB_SRGB_BLOCK => true, - Format::BC1_RGBA_UNORM_BLOCK => true, - Format::BC1_RGBA_SRGB_BLOCK => true, - Format::BC2_UNORM_BLOCK => true, - Format::BC2_SRGB_BLOCK => true, - Format::BC3_UNORM_BLOCK => true, - Format::BC3_SRGB_BLOCK => true, - Format::BC4_UNORM_BLOCK => true, - Format::BC4_SNORM_BLOCK => true, - Format::BC5_UNORM_BLOCK => true, - Format::BC5_SNORM_BLOCK => true, - Format::BC7_UNORM_BLOCK => true, - Format::BC7_SRGB_BLOCK => true, - Format::ETC2_R8G8B8_UNORM_BLOCK => true, - Format::ETC2_R8G8B8_SRGB_BLOCK => true, - Format::ETC2_R8G8B8A1_UNORM_BLOCK => true, - Format::ETC2_R8G8B8A1_SRGB_BLOCK => true, - Format::ETC2_R8G8B8A8_UNORM_BLOCK => true, - Format::ETC2_R8G8B8A8_SRGB_BLOCK => true, - Format::EAC_R11_UNORM_BLOCK => true, - Format::EAC_R11_SNORM_BLOCK => true, - Format::EAC_R11G11_UNORM_BLOCK => true, - Format::EAC_R11G11_SNORM_BLOCK => true, - Format::ASTC_4X4_UNORM_BLOCK => true, - Format::ASTC_4X4_SRGB_BLOCK => true, - Format::ASTC_5X4_UNORM_BLOCK => true, - Format::ASTC_5X4_SRGB_BLOCK => true, - Format::ASTC_5X5_UNORM_BLOCK => true, - Format::ASTC_5X5_SRGB_BLOCK => true, - Format::ASTC_6X5_UNORM_BLOCK => true, - Format::ASTC_6X5_SRGB_BLOCK => true, - Format::ASTC_6X6_UNORM_BLOCK => true, - Format::ASTC_6X6_SRGB_BLOCK => true, - Format::ASTC_8X5_UNORM_BLOCK => true, - Format::ASTC_8X5_SRGB_BLOCK => true, - Format::ASTC_8X6_UNORM_BLOCK => true, - Format::ASTC_8X6_SRGB_BLOCK => true, - Format::ASTC_8X8_UNORM_BLOCK => true, - Format::ASTC_8X8_SRGB_BLOCK => true, - Format::ASTC_10X5_UNORM_BLOCK => true, - Format::ASTC_10X5_SRGB_BLOCK => true, - Format::ASTC_10X6_UNORM_BLOCK => true, - Format::ASTC_10X6_SRGB_BLOCK => true, - Format::ASTC_10X8_UNORM_BLOCK => true, - Format::ASTC_10X8_SRGB_BLOCK => true, - Format::ASTC_10X10_UNORM_BLOCK => true, - Format::ASTC_10X10_SRGB_BLOCK => true, - Format::ASTC_12X10_UNORM_BLOCK => true, - Format::ASTC_12X10_SRGB_BLOCK => true, - Format::ASTC_12X12_UNORM_BLOCK => true, - Format::ASTC_12X12_SRGB_BLOCK => true, + Self::BC1_RGB_UNORM_BLOCK => true, + Self::BC1_RGB_SRGB_BLOCK => true, + Self::BC1_RGBA_UNORM_BLOCK => true, + Self::BC1_RGBA_SRGB_BLOCK => true, + Self::BC2_UNORM_BLOCK => true, + Self::BC2_SRGB_BLOCK => true, + Self::BC3_UNORM_BLOCK => true, + Self::BC3_SRGB_BLOCK => true, + Self::BC4_UNORM_BLOCK => true, + Self::BC4_SNORM_BLOCK => true, + Self::BC5_UNORM_BLOCK => true, + Self::BC5_SNORM_BLOCK => true, + Self::BC7_UNORM_BLOCK => true, + Self::BC7_SRGB_BLOCK => true, + Self::ETC2_R8G8B8_UNORM_BLOCK => true, + Self::ETC2_R8G8B8_SRGB_BLOCK => true, + Self::ETC2_R8G8B8A1_UNORM_BLOCK => true, + Self::ETC2_R8G8B8A1_SRGB_BLOCK => true, + Self::ETC2_R8G8B8A8_UNORM_BLOCK => true, + Self::ETC2_R8G8B8A8_SRGB_BLOCK => true, + Self::EAC_R11_UNORM_BLOCK => true, + Self::EAC_R11_SNORM_BLOCK => true, + Self::EAC_R11G11_UNORM_BLOCK => true, + Self::EAC_R11G11_SNORM_BLOCK => true, + Self::ASTC_4X4_UNORM_BLOCK => true, + Self::ASTC_4X4_SRGB_BLOCK => true, + Self::ASTC_5X4_UNORM_BLOCK => true, + Self::ASTC_5X4_SRGB_BLOCK => true, + Self::ASTC_5X5_UNORM_BLOCK => true, + Self::ASTC_5X5_SRGB_BLOCK => true, + Self::ASTC_6X5_UNORM_BLOCK => true, + Self::ASTC_6X5_SRGB_BLOCK => true, + Self::ASTC_6X6_UNORM_BLOCK => true, + Self::ASTC_6X6_SRGB_BLOCK => true, + Self::ASTC_8X5_UNORM_BLOCK => true, + Self::ASTC_8X5_SRGB_BLOCK => true, + Self::ASTC_8X6_UNORM_BLOCK => true, + Self::ASTC_8X6_SRGB_BLOCK => true, + Self::ASTC_8X8_UNORM_BLOCK => true, + Self::ASTC_8X8_SRGB_BLOCK => true, + Self::ASTC_10X5_UNORM_BLOCK => true, + Self::ASTC_10X5_SRGB_BLOCK => true, + Self::ASTC_10X6_UNORM_BLOCK => true, + Self::ASTC_10X6_SRGB_BLOCK => true, + Self::ASTC_10X8_UNORM_BLOCK => true, + Self::ASTC_10X8_SRGB_BLOCK => true, + Self::ASTC_10X10_UNORM_BLOCK => true, + Self::ASTC_10X10_SRGB_BLOCK => true, + Self::ASTC_12X10_UNORM_BLOCK => true, + Self::ASTC_12X10_SRGB_BLOCK => true, + Self::ASTC_12X12_UNORM_BLOCK => true, + Self::ASTC_12X12_SRGB_BLOCK => true, _ => false, } diff --git a/crates/lgn-graphics-cgen/src/db/descriptor_set.rs b/crates/lgn-graphics-cgen/src/db/descriptor_set.rs index cf312564bf..c7397c0f11 100644 --- a/crates/lgn-graphics-cgen/src/db/descriptor_set.rs +++ b/crates/lgn-graphics-cgen/src/db/descriptor_set.rs @@ -61,24 +61,20 @@ pub enum DescriptorDef { impl DescriptorDef { pub fn shader_resource_type(&self) -> ShaderResourceType { match self { - crate::db::DescriptorDef::Sampler => ShaderResourceType::Sampler, - crate::db::DescriptorDef::ConstantBuffer(_) => ShaderResourceType::ConstantBuffer, - crate::db::DescriptorDef::StructuredBuffer(_) => ShaderResourceType::StructuredBuffer, - crate::db::DescriptorDef::RWStructuredBuffer(_) => { - ShaderResourceType::RWStructuredBuffer - } - crate::db::DescriptorDef::ByteAddressBuffer => ShaderResourceType::ByteAddressBuffer, - crate::db::DescriptorDef::RWByteAddressBuffer => { - ShaderResourceType::RWByteAddressBuffer - } - crate::db::DescriptorDef::Texture2D(_) => ShaderResourceType::Texture2D, - crate::db::DescriptorDef::RWTexture2D(_) => ShaderResourceType::RWTexture2D, - crate::db::DescriptorDef::Texture3D(_) => ShaderResourceType::Texture3D, - crate::db::DescriptorDef::RWTexture3D(_) => ShaderResourceType::RWTexture3D, - crate::db::DescriptorDef::Texture2DArray(_) => ShaderResourceType::Texture2DArray, - crate::db::DescriptorDef::RWTexture2DArray(_) => ShaderResourceType::RWTexture2DArray, - crate::db::DescriptorDef::TextureCube(_) => ShaderResourceType::TextureCube, - crate::db::DescriptorDef::TextureCubeArray(_) => ShaderResourceType::TextureCubeArray, + Self::Sampler => ShaderResourceType::Sampler, + Self::ConstantBuffer(_) => ShaderResourceType::ConstantBuffer, + Self::StructuredBuffer(_) => ShaderResourceType::StructuredBuffer, + Self::RWStructuredBuffer(_) => ShaderResourceType::RWStructuredBuffer, + Self::ByteAddressBuffer => ShaderResourceType::ByteAddressBuffer, + Self::RWByteAddressBuffer => ShaderResourceType::RWByteAddressBuffer, + Self::Texture2D(_) => ShaderResourceType::Texture2D, + Self::RWTexture2D(_) => ShaderResourceType::RWTexture2D, + Self::Texture3D(_) => ShaderResourceType::Texture3D, + Self::RWTexture3D(_) => ShaderResourceType::RWTexture3D, + Self::Texture2DArray(_) => ShaderResourceType::Texture2DArray, + Self::RWTexture2DArray(_) => ShaderResourceType::RWTexture2DArray, + Self::TextureCube(_) => ShaderResourceType::TextureCube, + Self::TextureCubeArray(_) => ShaderResourceType::TextureCubeArray, } } } diff --git a/crates/lgn-graphics-cgen/src/db/types.rs b/crates/lgn-graphics-cgen/src/db/types.rs index 37bc237f75..b73904c5e2 100644 --- a/crates/lgn-graphics-cgen/src/db/types.rs +++ b/crates/lgn-graphics-cgen/src/db/types.rs @@ -30,19 +30,19 @@ static HALF_TYPESTRINGS: [&str; 4] = ["Half1", "Half2", "Half3", "Half4"]; impl NativeType { pub fn name(&self) -> &str { match self { - NativeType::Float(n) => { + Self::Float(n) => { assert!(*n >= 1 && *n <= 4); FLOAT_TYPESTRINGS[n - 1] } - NativeType::Uint(n) => { + Self::Uint(n) => { assert!(*n >= 1 && *n <= 4); UINT_TYPESTRINGS[n - 1] } - NativeType::Half(n) => { + Self::Half(n) => { assert!(*n >= 1 && *n <= 4); HALF_TYPESTRINGS[n - 1] } - NativeType::Float4x4 => "Float4x4", + Self::Float4x4 => "Float4x4", } } } diff --git a/crates/lgn-graphics-cgen/src/run.rs b/crates/lgn-graphics-cgen/src/run.rs index 9801d42c45..722fd16106 100644 --- a/crates/lgn-graphics-cgen/src/run.rs +++ b/crates/lgn-graphics-cgen/src/run.rs @@ -21,14 +21,14 @@ pub enum CGenVariant { impl CGenVariant { pub fn get_file_ext(self) -> &'static str { match self { - CGenVariant::Hlsl => "hlsl", - CGenVariant::Rust => "rs", + Self::Hlsl => "hlsl", + Self::Rust => "rs", } } pub fn dir(self) -> &'static str { match self { - CGenVariant::Hlsl => "hlsl", - CGenVariant::Rust => "rust", + Self::Hlsl => "hlsl", + Self::Rust => "rust", } } } diff --git a/crates/lgn-input/src/lib.rs b/crates/lgn-input/src/lib.rs index 342a7b2308..99dfe1b315 100644 --- a/crates/lgn-input/src/lib.rs +++ b/crates/lgn-input/src/lib.rs @@ -102,6 +102,6 @@ pub enum ButtonState { impl ButtonState { pub fn is_pressed(self) -> bool { - matches!(self, ButtonState::Pressed) + matches!(self, Self::Pressed) } } diff --git a/crates/lgn-mp4/src/types.rs b/crates/lgn-mp4/src/types.rs index 1e5371ed87..93084a8c24 100644 --- a/crates/lgn-mp4/src/types.rs +++ b/crates/lgn-mp4/src/types.rs @@ -109,9 +109,9 @@ pub enum TrackType { impl fmt::Display for TrackType { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let s = match self { - TrackType::Video => DISPLAY_TYPE_VIDEO, - TrackType::Audio => DISPLAY_TYPE_AUDIO, - TrackType::Subtitle => DISPLAY_TYPE_SUBTITLE, + Self::Video => DISPLAY_TYPE_VIDEO, + Self::Audio => DISPLAY_TYPE_AUDIO, + Self::Subtitle => DISPLAY_TYPE_SUBTITLE, }; write!(f, "{}", s) } @@ -154,9 +154,9 @@ impl From for FourCC { impl TrackType { pub fn friendly_name(self) -> &'static str { match self { - TrackType::Video => "VideoHandler", - TrackType::Audio => "SoundHandler", - TrackType::Subtitle => "", + Self::Video => "VideoHandler", + Self::Audio => "SoundHandler", + Self::Subtitle => "", } } } @@ -250,11 +250,11 @@ impl TryFrom<(u8, u8)> for AvcProfile { impl fmt::Display for AvcProfile { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let profile = match self { - AvcProfile::ConstrainedBaseline => "Constrained Baseline", - AvcProfile::Baseline => "Baseline", - AvcProfile::Main => "Main", - AvcProfile::Extended => "Extended", - AvcProfile::High => "High", + Self::ConstrainedBaseline => "Constrained Baseline", + Self::Baseline => "Baseline", + Self::Main => "Main", + Self::Extended => "Extended", + Self::High => "High", }; write!(f, "{}", profile) } @@ -360,48 +360,48 @@ impl TryFrom for AudioObjectType { impl fmt::Display for AudioObjectType { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let type_str = match self { - AudioObjectType::AacMain => "AAC Main", - AudioObjectType::AacLowComplexity => "LC", - AudioObjectType::AacScalableSampleRate => "SSR", - AudioObjectType::AacLongTermPrediction => "LTP", - AudioObjectType::SpectralBandReplication => "SBR", - AudioObjectType::AACScalable => "Scalable", - AudioObjectType::TwinVQ => "TwinVQ", - AudioObjectType::CodeExcitedLinearPrediction => "CELP", - AudioObjectType::HarmonicVectorExcitationCoding => "HVXC", - AudioObjectType::TextToSpeechtInterface => "TTSI", - AudioObjectType::MainSynthetic => "Main Synthetic", - AudioObjectType::WavetableSynthesis => "Wavetable Synthesis", - AudioObjectType::GeneralMIDI => "General MIDI", - AudioObjectType::AlgorithmicSynthesis => "Algorithmic Synthesis", - AudioObjectType::ErrorResilientAacLowComplexity => "ER AAC LC", - AudioObjectType::ErrorResilientAacLongTermPrediction => "ER AAC LTP", - AudioObjectType::ErrorResilientAacScalable => "ER AAC scalable", - AudioObjectType::ErrorResilientAacTwinVQ => "ER AAC TwinVQ", - AudioObjectType::ErrorResilientAacBitSlicedArithmeticCoding => "ER AAC BSAC", - AudioObjectType::ErrorResilientAacLowDelay => "ER AAC LD", - AudioObjectType::ErrorResilientCodeExcitedLinearPrediction => "ER CELP", - AudioObjectType::ErrorResilientHarmonicVectorExcitationCoding => "ER HVXC", - AudioObjectType::ErrorResilientHarmonicIndividualLinesNoise => "ER HILN", - AudioObjectType::ErrorResilientParametric => "ER Parametric", - AudioObjectType::SinuSoidalCoding => "SSC", - AudioObjectType::ParametricStereo => "Parametric Stereo", - AudioObjectType::MpegSurround => "MPEG surround", - AudioObjectType::MpegLayer1 => "MPEG Layer 1", - AudioObjectType::MpegLayer2 => "MPEG Layer 2", - AudioObjectType::MpegLayer3 => "MPEG Layer 3", - AudioObjectType::DirectStreamTransfer => "DST", - AudioObjectType::AudioLosslessCoding => "ALS", - AudioObjectType::ScalableLosslessCoding => "SLS", - AudioObjectType::ScalableLosslessCodingNoneCore => "SLS Non-core", - AudioObjectType::ErrorResilientAacEnhancedLowDelay => "ER AAC ELD", - AudioObjectType::SymbolicMusicRepresentationSimple => "SMR Simple", - AudioObjectType::SymbolicMusicRepresentationMain => "SMR Main", - AudioObjectType::UnifiedSpeechAudioCoding => "USAC", - AudioObjectType::SpatialAudioObjectCoding => "SAOC", - AudioObjectType::LowDelayMpegSurround => "LD MPEG Surround", - AudioObjectType::SpatialAudioObjectCodingDialogueEnhancement => "SAOC-DE", - AudioObjectType::AudioSync => "Audio Sync", + Self::AacMain => "AAC Main", + Self::AacLowComplexity => "LC", + Self::AacScalableSampleRate => "SSR", + Self::AacLongTermPrediction => "LTP", + Self::SpectralBandReplication => "SBR", + Self::AACScalable => "Scalable", + Self::TwinVQ => "TwinVQ", + Self::CodeExcitedLinearPrediction => "CELP", + Self::HarmonicVectorExcitationCoding => "HVXC", + Self::TextToSpeechtInterface => "TTSI", + Self::MainSynthetic => "Main Synthetic", + Self::WavetableSynthesis => "Wavetable Synthesis", + Self::GeneralMIDI => "General MIDI", + Self::AlgorithmicSynthesis => "Algorithmic Synthesis", + Self::ErrorResilientAacLowComplexity => "ER AAC LC", + Self::ErrorResilientAacLongTermPrediction => "ER AAC LTP", + Self::ErrorResilientAacScalable => "ER AAC scalable", + Self::ErrorResilientAacTwinVQ => "ER AAC TwinVQ", + Self::ErrorResilientAacBitSlicedArithmeticCoding => "ER AAC BSAC", + Self::ErrorResilientAacLowDelay => "ER AAC LD", + Self::ErrorResilientCodeExcitedLinearPrediction => "ER CELP", + Self::ErrorResilientHarmonicVectorExcitationCoding => "ER HVXC", + Self::ErrorResilientHarmonicIndividualLinesNoise => "ER HILN", + Self::ErrorResilientParametric => "ER Parametric", + Self::SinuSoidalCoding => "SSC", + Self::ParametricStereo => "Parametric Stereo", + Self::MpegSurround => "MPEG surround", + Self::MpegLayer1 => "MPEG Layer 1", + Self::MpegLayer2 => "MPEG Layer 2", + Self::MpegLayer3 => "MPEG Layer 3", + Self::DirectStreamTransfer => "DST", + Self::AudioLosslessCoding => "ALS", + Self::ScalableLosslessCoding => "SLS", + Self::ScalableLosslessCodingNoneCore => "SLS Non-core", + Self::ErrorResilientAacEnhancedLowDelay => "ER AAC ELD", + Self::SymbolicMusicRepresentationSimple => "SMR Simple", + Self::SymbolicMusicRepresentationMain => "SMR Main", + Self::UnifiedSpeechAudioCoding => "USAC", + Self::SpatialAudioObjectCoding => "SAOC", + Self::LowDelayMpegSurround => "LD MPEG Surround", + Self::SpatialAudioObjectCodingDialogueEnhancement => "SAOC-DE", + Self::AudioSync => "Audio Sync", }; write!(f, "{}", type_str) } @@ -449,19 +449,19 @@ impl TryFrom for SampleFreqIndex { impl SampleFreqIndex { pub fn freq(self) -> u32 { match self { - SampleFreqIndex::Freq96000 => 96000, - SampleFreqIndex::Freq88200 => 88200, - SampleFreqIndex::Freq64000 => 64000, - SampleFreqIndex::Freq48000 => 48000, - SampleFreqIndex::Freq44100 => 44100, - SampleFreqIndex::Freq32000 => 32000, - SampleFreqIndex::Freq24000 => 24000, - SampleFreqIndex::Freq22050 => 22050, - SampleFreqIndex::Freq16000 => 16000, - SampleFreqIndex::Freq12000 => 12000, - SampleFreqIndex::Freq11025 => 11025, - SampleFreqIndex::Freq8000 => 8000, - SampleFreqIndex::Freq7350 => 7350, + Self::Freq96000 => 96000, + Self::Freq88200 => 88200, + Self::Freq64000 => 64000, + Self::Freq48000 => 48000, + Self::Freq44100 => 44100, + Self::Freq32000 => 32000, + Self::Freq24000 => 24000, + Self::Freq22050 => 22050, + Self::Freq16000 => 16000, + Self::Freq12000 => 12000, + Self::Freq11025 => 11025, + Self::Freq8000 => 8000, + Self::Freq7350 => 7350, } } } @@ -496,13 +496,13 @@ impl TryFrom for ChannelConfig { impl fmt::Display for ChannelConfig { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let s = match self { - ChannelConfig::Mono => "mono", - ChannelConfig::Stereo => "stereo", - ChannelConfig::Three => "three", - ChannelConfig::Four => "four", - ChannelConfig::Five => "five", - ChannelConfig::FiveOne => "five.one", - ChannelConfig::SevenOne => "seven.one", + Self::Mono => "mono", + Self::Stereo => "stereo", + Self::Three => "three", + Self::Four => "four", + Self::Five => "five", + Self::FiveOne => "five.one", + Self::SevenOne => "seven.one", }; write!(f, "{}", s) } diff --git a/crates/lgn-pso-compiler/src/hlsl_compiler.rs b/crates/lgn-pso-compiler/src/hlsl_compiler.rs index 18ed448055..2154365ff4 100644 --- a/crates/lgn-pso-compiler/src/hlsl_compiler.rs +++ b/crates/lgn-pso-compiler/src/hlsl_compiler.rs @@ -32,9 +32,9 @@ pub enum TargetProfile { impl TargetProfile { fn to_profile_string(&self) -> &str { match self { - TargetProfile::Vertex => "vs_6_2", - TargetProfile::Pixel => "ps_6_2", - TargetProfile::Compute => "cs_6_2", + Self::Vertex => "vs_6_2", + Self::Pixel => "ps_6_2", + Self::Compute => "cs_6_2", } } } diff --git a/crates/lgn-resource-registry/src/settings.rs b/crates/lgn-resource-registry/src/settings.rs index d6419e2bf9..349cc4625c 100644 --- a/crates/lgn-resource-registry/src/settings.rs +++ b/crates/lgn-resource-registry/src/settings.rs @@ -19,9 +19,9 @@ impl Default for CompilationMode { impl std::fmt::Display for CompilationMode { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - CompilationMode::InProcess => write!(f, "in-process"), - CompilationMode::External => write!(f, "external"), - CompilationMode::Remote { url } => write!(f, "remote:{}", url), + Self::InProcess => write!(f, "in-process"), + Self::External => write!(f, "external"), + Self::Remote { url } => write!(f, "remote:{}", url), } } } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index a5c3f62ea5..5ace10f703 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "1.60.0" +channel = "1.61.0" profile = "default" targets = ["x86_64-unknown-linux-musl"] components = ["llvm-tools-preview"]