diff --git a/examples/debug/main.rs b/examples/debug/main.rs index ca5e5490..402a63fe 100644 --- a/examples/debug/main.rs +++ b/examples/debug/main.rs @@ -139,7 +139,7 @@ fn main() { }) .expect("no device available"); - let (_device, mut _queues) = Device::new( + let (_device, _queues) = Device::new( physical_device, DeviceCreateInfo { enabled_extensions: device_extensions, diff --git a/examples/gl-interop/main.rs b/examples/gl-interop/main.rs index 84937758..0a8f11b8 100644 --- a/examples/gl-interop/main.rs +++ b/examples/gl-interop/main.rs @@ -455,11 +455,11 @@ mod linux { } Err(VulkanError::OutOfDate) => { recreate_swapchain = true; - previous_frame_end = Some(vulkano::sync::now(device.clone()).boxed()); + previous_frame_end = Some(now(device.clone()).boxed()); } Err(e) => { println!("failed to flush future: {e}"); - previous_frame_end = Some(vulkano::sync::now(device.clone()).boxed()); + previous_frame_end = Some(now(device.clone()).boxed()); } }; } diff --git a/examples/interactive-fractal/app.rs b/examples/interactive-fractal/app.rs index 5d6ede6c..2af81028 100644 --- a/examples/interactive-fractal/app.rs +++ b/examples/interactive-fractal/app.rs @@ -362,7 +362,7 @@ impl InputState { } /// Update toggle julia state (if right mouse is clicked) - fn on_mouse_click_event(&mut self, state: ElementState, mouse_btn: winit::event::MouseButton) { + fn on_mouse_click_event(&mut self, state: ElementState, mouse_btn: MouseButton) { if mouse_btn == MouseButton::Right { self.toggle_c = state_is_pressed(state) } diff --git a/examples/interactive-fractal/fractal_compute_pipeline.rs b/examples/interactive-fractal/fractal_compute_pipeline.rs index d9e524c9..6f6451b9 100644 --- a/examples/interactive-fractal/fractal_compute_pipeline.rs +++ b/examples/interactive-fractal/fractal_compute_pipeline.rs @@ -1,5 +1,5 @@ use glam::f32::Vec2; -use rand::Rng; +use rand::random; use std::sync::Arc; use vulkano::{ buffer::{Buffer, BufferCreateInfo, BufferUsage, Subbuffer}, @@ -103,10 +103,10 @@ impl FractalComputePipeline { pub fn randomize_palette(&mut self) { let mut colors = vec![]; for _ in 0..self.palette_size { - let r = rand::thread_rng().gen::(); - let g = rand::thread_rng().gen::(); - let b = rand::thread_rng().gen::(); - let a = rand::thread_rng().gen::(); + let r = random::(); + let g = random::(); + let b = random::(); + let a = random::(); colors.push([r, g, b, a]); } self.palette = Buffer::from_iter( diff --git a/vulkano-util/src/renderer.rs b/vulkano-util/src/renderer.rs index 8da85e6f..d36d9e13 100644 --- a/vulkano-util/src/renderer.rs +++ b/vulkano-util/src/renderer.rs @@ -35,7 +35,7 @@ pub struct VulkanoWindowRenderer { recreate_swapchain: bool, previous_frame_end: Option>, image_index: u32, - present_mode: vulkano::swapchain::PresentMode, + present_mode: PresentMode, } impl VulkanoWindowRenderer { @@ -44,7 +44,7 @@ impl VulkanoWindowRenderer { /// [`SwapchainCreateInfo`] parameters. pub fn new( vulkano_context: &VulkanoContext, - window: winit::window::Window, + window: Window, descriptor: &WindowDescriptor, swapchain_create_info_modify: fn(&mut SwapchainCreateInfo), ) -> VulkanoWindowRenderer { @@ -315,10 +315,7 @@ impl VulkanoWindowRenderer { match future.map_err(Validated::unwrap) { Ok(mut future) => { if wait_future { - match future.wait(None) { - Ok(x) => x, - Err(e) => println!("{e}"), - } + future.wait(None).unwrap_or_else(|e| println!("{e}")) // wait allows you to organize resource waiting yourself. } else { future.cleanup_finished(); diff --git a/vulkano-util/src/window.rs b/vulkano-util/src/window.rs index 76a7b303..82239741 100644 --- a/vulkano-util/src/window.rs +++ b/vulkano-util/src/window.rs @@ -37,8 +37,8 @@ use winit::{ /// ``` #[derive(Default)] pub struct VulkanoWindows { - windows: HashMap, - primary: Option, + windows: HashMap, + primary: Option, } impl VulkanoWindows { @@ -50,7 +50,7 @@ impl VulkanoWindows { vulkano_context: &VulkanoContext, window_descriptor: &WindowDescriptor, swapchain_create_info_modify: fn(&mut SwapchainCreateInfo), - ) -> winit::window::WindowId { + ) -> WindowId { let mut winit_window_builder = winit::window::WindowBuilder::new(); winit_window_builder = match window_descriptor.mode { @@ -96,12 +96,10 @@ impl VulkanoWindows { } } if let Some(sf) = scale_factor_override { - winit_window_builder.with_inner_size( - winit::dpi::LogicalSize::new(*width, *height).to_physical::(*sf), - ) - } else { winit_window_builder - .with_inner_size(winit::dpi::LogicalSize::new(*width, *height)) + .with_inner_size(LogicalSize::new(*width, *height).to_physical::(*sf)) + } else { + winit_window_builder.with_inner_size(LogicalSize::new(*width, *height)) } } .with_resizable(window_descriptor.resizable) @@ -193,34 +191,31 @@ impl VulkanoWindows { /// Get a mutable reference to the renderer by winit window id. #[inline] - pub fn get_renderer_mut( - &mut self, - id: winit::window::WindowId, - ) -> Option<&mut VulkanoWindowRenderer> { + pub fn get_renderer_mut(&mut self, id: WindowId) -> Option<&mut VulkanoWindowRenderer> { self.windows.get_mut(&id) } /// Get a reference to the renderer by winit window id. #[inline] - pub fn get_renderer(&self, id: winit::window::WindowId) -> Option<&VulkanoWindowRenderer> { + pub fn get_renderer(&self, id: WindowId) -> Option<&VulkanoWindowRenderer> { self.windows.get(&id) } /// Get a reference to the winit window by winit window id. #[inline] - pub fn get_window(&self, id: winit::window::WindowId) -> Option<&winit::window::Window> { + pub fn get_window(&self, id: WindowId) -> Option<&winit::window::Window> { self.windows.get(&id).map(|v_window| v_window.window()) } /// Return primary window id. #[inline] - pub fn primary_window_id(&self) -> Option { + pub fn primary_window_id(&self) -> Option { self.primary } /// Remove renderer by window id. #[inline] - pub fn remove_renderer(&mut self, id: winit::window::WindowId) { + pub fn remove_renderer(&mut self, id: WindowId) { self.windows.remove(&id); if let Some(primary) = self.primary { if primary == id { diff --git a/vulkano/autogen/extensions.rs b/vulkano/autogen/extensions.rs index ece6b1d5..86bfad17 100644 --- a/vulkano/autogen/extensions.rs +++ b/vulkano/autogen/extensions.rs @@ -108,29 +108,33 @@ fn device_extensions_output(members: &[ExtensionsMember]) -> TokenStream { instance_extensions, device_features: _, }| { - let condition_items = (api_version.iter().map(|version| { - let version = format_ident!("V{}_{}", version.0, version.1); - quote! { api_version >= crate::Version::#version } - })) - .chain(instance_extensions.iter().map(|ext_name| { - let ident = format_ident!("{}", ext_name); - quote! { instance_extensions.#ident } - })); - let requires_one_of_items = (api_version.iter().map(|(major, minor)| { - let version = format_ident!("V{}_{}", major, minor); - quote! { - crate::RequiresAllOf(&[ - crate::Requires::APIVersion(crate::Version::#version), - ]), - } - })) - .chain(instance_extensions.iter().map(|ext_name| { - quote! { - crate::RequiresAllOf(&[ - crate::Requires::InstanceExtension(#ext_name), - ]), - } - })); + let condition_items = api_version + .iter() + .map(|version| { + let version = format_ident!("V{}_{}", version.0, version.1); + quote! { api_version >= crate::Version::#version } + }) + .chain(instance_extensions.iter().map(|ext_name| { + let ident = format_ident!("{}", ext_name); + quote! { instance_extensions.#ident } + })); + let requires_one_of_items = api_version + .iter() + .map(|(major, minor)| { + let version = format_ident!("V{}_{}", major, minor); + quote! { + crate::RequiresAllOf(&[ + crate::Requires::APIVersion(crate::Version::#version), + ]), + } + }) + .chain(instance_extensions.iter().map(|ext_name| { + quote! { + crate::RequiresAllOf(&[ + crate::Requires::InstanceExtension(#ext_name), + ]), + } + })); let problem = format!("contains `{}`", name_string); quote! { @@ -173,7 +177,7 @@ fn device_extensions_output(members: &[ExtensionsMember]) -> TokenStream { name: _, requires_all_of, .. - }| (!requires_all_of.is_empty()), + }| !requires_all_of.is_empty(), ) .map( |ExtensionsMember { @@ -191,7 +195,7 @@ fn device_extensions_output(members: &[ExtensionsMember]) -> TokenStream { device_extensions, instance_extensions: _, device_features: _, - }| (!device_extensions.is_empty()), + }| !device_extensions.is_empty(), ) .map( |RequiresOneOf { @@ -364,7 +368,7 @@ fn instance_extensions_output(members: &[ExtensionsMember]) -> TokenStream { name: _, requires_all_of, .. - }| (!requires_all_of.is_empty()), + }| !requires_all_of.is_empty(), ) .map( |ExtensionsMember { @@ -382,7 +386,7 @@ fn instance_extensions_output(members: &[ExtensionsMember]) -> TokenStream { device_extensions: _, instance_extensions, device_features: _, - }| (!instance_extensions.is_empty()), + }| !instance_extensions.is_empty(), ) .map( |RequiresOneOf { diff --git a/vulkano/autogen/formats.rs b/vulkano/autogen/formats.rs index d57b173b..f6a7be97 100644 --- a/vulkano/autogen/formats.rs +++ b/vulkano/autogen/formats.rs @@ -179,7 +179,7 @@ fn formats_output(members: &[FormatMember]) -> TokenStream { .filter( |&FormatMember { texels_per_block, .. - }| (*texels_per_block != 1), + }| *texels_per_block != 1, ) .map( |FormatMember { @@ -257,7 +257,7 @@ fn formats_output(members: &[FormatMember]) -> TokenStream { type_cgmath, .. }| { - (type_cgmath.as_ref().or(type_std_array.as_ref())).map(|ty| { + type_cgmath.as_ref().or(type_std_array.as_ref()).map(|ty| { quote! { (cgmath, #name) => { #ty }; } }) }, @@ -269,7 +269,7 @@ fn formats_output(members: &[FormatMember]) -> TokenStream { type_glam, .. }| { - (type_glam.as_ref().or(type_std_array.as_ref())).map(|ty| { + type_glam.as_ref().or(type_std_array.as_ref()).map(|ty| { quote! { (glam, #name) => { #ty }; } }) }, @@ -281,9 +281,12 @@ fn formats_output(members: &[FormatMember]) -> TokenStream { type_nalgebra, .. }| { - (type_nalgebra.as_ref().or(type_std_array.as_ref())).map(|ty| { - quote! { (nalgebra, #name) => { #ty }; } - }) + type_nalgebra + .as_ref() + .or(type_std_array.as_ref()) + .map(|ty| { + quote! { (nalgebra, #name) => { #ty }; } + }) }, ); @@ -300,41 +303,45 @@ fn formats_output(members: &[FormatMember]) -> TokenStream { instance_extensions, device_features: _, }| { - let condition_items = (api_version.iter().map(|(major, minor)| { - let version = format_ident!("V{}_{}", major, minor); - quote! { device_api_version >= crate::Version::#version } - })) - .chain(device_extensions.iter().map(|ext_name| { - let ident = format_ident!("{}", ext_name); - quote! { device_extensions.#ident } - })) - .chain(instance_extensions.iter().map(|ext_name| { - let ident = format_ident!("{}", ext_name); - quote! { instance_extensions.#ident } - })); + let condition_items = api_version + .iter() + .map(|(major, minor)| { + let version = format_ident!("V{}_{}", major, minor); + quote! { device_api_version >= crate::Version::#version } + }) + .chain(device_extensions.iter().map(|ext_name| { + let ident = format_ident!("{}", ext_name); + quote! { device_extensions.#ident } + })) + .chain(instance_extensions.iter().map(|ext_name| { + let ident = format_ident!("{}", ext_name); + quote! { instance_extensions.#ident } + })); let required_for = format!("is `Format::{}`", name); - let requires_one_of_items = (api_version.iter().map(|(major, minor)| { - let version = format_ident!("V{}_{}", major, minor); - quote! { - crate::RequiresAllOf(&[ - crate::Requires::APIVersion(crate::Version::#version), - ]), - } - })) - .chain(device_extensions.iter().map(|ext_name| { - quote! { - crate::RequiresAllOf(&[ - crate::Requires::DeviceExtension(#ext_name), - ]), - } - })) - .chain(instance_extensions.iter().map(|ext_name| { - quote! { - crate::RequiresAllOf(&[ - crate::Requires::InstanceExtension(#ext_name), - ]), - } - })); + let requires_one_of_items = api_version + .iter() + .map(|(major, minor)| { + let version = format_ident!("V{}_{}", major, minor); + quote! { + crate::RequiresAllOf(&[ + crate::Requires::APIVersion(crate::Version::#version), + ]), + } + }) + .chain(device_extensions.iter().map(|ext_name| { + quote! { + crate::RequiresAllOf(&[ + crate::Requires::DeviceExtension(#ext_name), + ]), + } + })) + .chain(instance_extensions.iter().map(|ext_name| { + quote! { + crate::RequiresAllOf(&[ + crate::Requires::InstanceExtension(#ext_name), + ]), + } + })); quote! { if !(#(#condition_items)||*) { diff --git a/vulkano/autogen/mod.rs b/vulkano/autogen/mod.rs index 52e30d7a..21f64245 100644 --- a/vulkano/autogen/mod.rs +++ b/vulkano/autogen/mod.rs @@ -66,7 +66,7 @@ fn write_file(file: impl AsRef, source: impl AsRef, content: impl Dis ) .unwrap(); - std::mem::drop(writer); // Ensure that the file is fully written + drop(writer); // Ensure that the file is fully written Command::new("rustfmt").arg(&path).status().ok(); } @@ -221,7 +221,7 @@ impl<'r> VkRegistryData<'r> { features: &IndexMap<&'a str, &'a Feature>, extensions: &IndexMap<&'a str, &'a Extension>, ) -> Vec<&'a str> { - (registry + registry .0 .iter() .filter_map(|child| match child { @@ -244,36 +244,38 @@ impl<'r> VkRegistryData<'r> { })), _ => None, }) - .flatten()) - .chain( - (features.values().map(|feature| feature.children.iter())) - .chain( - extensions - .values() - .map(|extension| extension.children.iter()), - ) - .flatten() - .filter_map(|child| { - if let ExtensionChild::Require { items, .. } = child { - return Some(items.iter().filter_map(|item| match item { - InterfaceItem::Enum(Enum { - name, - spec: - EnumSpec::Offset { - extends, - dir: false, - .. - }, - .. - }) if extends == "VkResult" => Some(name.as_str()), - _ => None, - })); - } - None - }) - .flatten(), - ) - .collect() + .flatten() + .chain( + features + .values() + .map(|feature| feature.children.iter()) + .chain( + extensions + .values() + .map(|extension| extension.children.iter()), + ) + .flatten() + .filter_map(|child| { + if let ExtensionChild::Require { items, .. } = child { + return Some(items.iter().filter_map(|item| match item { + InterfaceItem::Enum(Enum { + name, + spec: + EnumSpec::Offset { + extends, + dir: false, + .. + }, + .. + }) if extends == "VkResult" => Some(name.as_str()), + _ => None, + })); + } + None + }) + .flatten(), + ) + .collect() } fn get_extensions(registry: &Registry) -> IndexMap<&str, &Extension> { diff --git a/vulkano/autogen/spirv_reqs.rs b/vulkano/autogen/spirv_reqs.rs index c82e26b6..48598ff7 100644 --- a/vulkano/autogen/spirv_reqs.rs +++ b/vulkano/autogen/spirv_reqs.rs @@ -100,40 +100,44 @@ fn spirv_reqs_output(members: &[SpirvReqsMember], is_extension: bool) -> TokenSt ref device_features, } = requires_one_of; - let condition_items = (api_version.iter().map(|version| { - let version = format_ident!("V{}_{}", version.0, version.1); - quote! { api_version >= crate::Version::#version } - })) - .chain(device_extensions.iter().map(|name| { - let ident = format_ident!("{}", name); - quote! { device_extensions.#ident } - })) - .chain(device_features.iter().map(|name| { - let ident = format_ident!("{}", name); - quote! { device_features.#ident } - })); - let requires_one_of_items = (api_version.iter().map(|(major, minor)| { - let version = format_ident!("V{}_{}", major, minor); - quote! { - crate::RequiresAllOf(&[ - crate::Requires::APIVersion(crate::Version::#version), - ]), - } - })) - .chain(device_extensions.iter().map(|name| { - quote! { - crate::RequiresAllOf(&[ - crate::Requires::DeviceExtension(#name), - ]), - } - })) - .chain(device_features.iter().map(|name| { - quote! { - crate::RequiresAllOf(&[ - crate::Requires::DeviceFeature(#name), - ]), - } - })); + let condition_items = api_version + .iter() + .map(|version| { + let version = format_ident!("V{}_{}", version.0, version.1); + quote! { api_version >= crate::Version::#version } + }) + .chain(device_extensions.iter().map(|name| { + let ident = format_ident!("{}", name); + quote! { device_extensions.#ident } + })) + .chain(device_features.iter().map(|name| { + let ident = format_ident!("{}", name); + quote! { device_features.#ident } + })); + let requires_one_of_items = api_version + .iter() + .map(|(major, minor)| { + let version = format_ident!("V{}_{}", major, minor); + quote! { + crate::RequiresAllOf(&[ + crate::Requires::APIVersion(crate::Version::#version), + ]), + } + }) + .chain(device_extensions.iter().map(|name| { + quote! { + crate::RequiresAllOf(&[ + crate::Requires::DeviceExtension(#name), + ]), + } + })) + .chain(device_features.iter().map(|name| { + quote! { + crate::RequiresAllOf(&[ + crate::Requires::DeviceFeature(#name), + ]), + } + })); let problem = format!("uses the SPIR-V {} `{}`", item_type, name); quote! { diff --git a/vulkano/src/buffer/mod.rs b/vulkano/src/buffer/mod.rs index a72b9c90..80bda741 100644 --- a/vulkano/src/buffer/mod.rs +++ b/vulkano/src/buffer/mod.rs @@ -65,9 +65,8 @@ //! See also [the `shader` module documentation] for information about how buffer contents need to //! be laid out in accordance with the shader interface. //! -//! [`RawBuffer`]: self::sys::RawBuffer -//! [`SubbufferAllocator`]: self::allocator::SubbufferAllocator -//! [the `view` module]: self::view +//! [`SubbufferAllocator`]: allocator::SubbufferAllocator +//! [the `view` module]: view //! [the `shader` module documentation]: crate::shader pub use self::{subbuffer::*, sys::*, usage::*}; @@ -865,8 +864,6 @@ vulkan_bitflags! { } /// The buffer configuration to query in [`PhysicalDevice::external_buffer_properties`]. -/// -/// [`PhysicalDevice::external_buffer_properties`]: crate::device::physical::PhysicalDevice::external_buffer_properties #[derive(Clone, Debug, PartialEq, Eq, Hash)] pub struct ExternalBufferInfo { /// The flags that will be used. diff --git a/vulkano/src/buffer/subbuffer.rs b/vulkano/src/buffer/subbuffer.rs index 8e0b794f..6b723a04 100644 --- a/vulkano/src/buffer/subbuffer.rs +++ b/vulkano/src/buffer/subbuffer.rs @@ -115,8 +115,8 @@ impl Subbuffer { /// /// See [`MappingState::slice`] for the safety invariants of the returned pointer. /// - /// [`DeviceMemory::map`]: crate::memory::DeviceMemory::map - /// [`MappingState::slice`]: crate::memory::MappingState::slice + /// [`DeviceMemory::map`]: memory::DeviceMemory::map + /// [`MappingState::slice`]: memory::MappingState::slice pub fn mapped_slice(&self) -> Result, HostAccessError> { match self.buffer().memory() { BufferMemory::Normal(allocation) => { @@ -167,8 +167,8 @@ impl Subbuffer { #[inline(always)] unsafe fn reinterpret_unchecked_ref_inner(&self) -> &Subbuffer { - assert!(size_of::>() == size_of::>()); - assert!(align_of::>() == align_of::>()); + assert_eq!(size_of::>(), size_of::>()); + assert_eq!(align_of::>(), align_of::>()); // SAFETY: All `Subbuffer`s share the same layout. mem::transmute::<&Subbuffer, &Subbuffer>(self) @@ -261,10 +261,13 @@ where assert!(is_aligned(self.memory_offset(), new_layout.alignment())); if new_layout.is_sized() { - assert!(self.size == new_layout.unwrap_sized().size()); + assert_eq!(self.size, new_layout.unwrap_sized().size()); } else { assert!(self.size > new_layout.head_size()); - assert!((self.size - new_layout.head_size()) % new_layout.element_size().unwrap() == 0); + assert_eq!( + (self.size - new_layout.head_size()) % new_layout.element_size().unwrap(), + 0, + ); assert!(is_aligned(self.size(), new_layout.alignment())); } } @@ -293,8 +296,8 @@ where /// If the memory backing the buffer is not managed by vulkano, (i.e. this buffer was created /// from [`RawBuffer::assume_bound`]), then it can't be read from using this function. /// - /// [host-coherent]: crate::memory::MemoryPropertyFlags::HOST_COHERENT - /// [`invalidate_range`]: crate::memory::ResourceMemory::invalidate_range + /// [host-coherent]: memory::MemoryPropertyFlags::HOST_COHERENT + /// [`invalidate_range`]: memory::ResourceMemory::invalidate_range /// [`non_coherent_atom_size`]: crate::device::DeviceProperties::non_coherent_atom_size /// [`write`]: Self::write /// [`SubbufferAllocator`]: super::allocator::SubbufferAllocator @@ -386,8 +389,8 @@ where /// If the memory backing the buffer is not managed by vulkano, (i.e. this buffer was created /// from [`RawBuffer::assume_bound`]), then it can't be written to using this function. /// - /// [host-coherent]: crate::memory::MemoryPropertyFlags::HOST_COHERENT - /// [`flush_range`]: crate::memory::ResourceMemory::flush_range + /// [host-coherent]: memory::MemoryPropertyFlags::HOST_COHERENT + /// [`flush_range`]: memory::ResourceMemory::flush_range /// [`non_coherent_atom_size`]: crate::device::DeviceProperties::non_coherent_atom_size /// [`read`]: Self::read /// [`SubbufferAllocator`]: super::allocator::SubbufferAllocator @@ -505,7 +508,7 @@ impl Subbuffer<[T]> { self.offset += start * size_of::() as DeviceSize; self.size = (end - start) * size_of::() as DeviceSize; - assert!(self.size != 0); + assert_ne!(self.size, 0); self } @@ -1231,14 +1234,14 @@ mod tests { { let (left, right) = buffer.clone().split_at(2); - assert!(left.len() == 2); - assert!(right.len() == 4); + assert_eq!(left.len(), 2); + assert_eq!(right.len(), 4); } { let (left, right) = buffer.clone().split_at(5); - assert!(left.len() == 5); - assert!(right.len() == 1); + assert_eq!(left.len(), 5); + assert_eq!(right.len(), 1); } { diff --git a/vulkano/src/command_buffer/auto/builder.rs b/vulkano/src/command_buffer/auto/builder.rs index 16b04cb1..fd03451d 100644 --- a/vulkano/src/command_buffer/auto/builder.rs +++ b/vulkano/src/command_buffer/auto/builder.rs @@ -1375,7 +1375,9 @@ impl RenderPassState { RenderPassState { contents: SubpassContents::Inline, render_area_offset: [0, 0], - render_area_extent: (info.framebuffer.as_ref()) + render_area_extent: info + .framebuffer + .as_ref() // Still not exact, but it's a better upper bound. .map_or([u32::MAX, u32::MAX], |framebuffer| framebuffer.extent()), @@ -1452,10 +1454,12 @@ impl RenderPassStateAttachments { let fb_attachments = framebuffer.attachments(); Self { - color_attachments: (subpass_desc.color_attachments.iter()) + color_attachments: subpass_desc + .color_attachments + .iter() .zip(subpass_desc.color_resolve_attachments.iter()) .map(|(color_attachment, color_resolve_attachment)| { - (color_attachment.as_ref()).map(|color_attachment| { + color_attachment.as_ref().map(|color_attachment| { RenderPassStateAttachmentInfo { image_view: fb_attachments[color_attachment.attachment as usize] .clone(), @@ -1472,9 +1476,12 @@ impl RenderPassStateAttachments { }) }) .collect(), - depth_attachment: (subpass_desc.depth_stencil_attachment.as_ref()) + depth_attachment: subpass_desc + .depth_stencil_attachment + .as_ref() .filter(|depth_stencil_attachment| { - (rp_attachments[depth_stencil_attachment.attachment as usize].format) + rp_attachments[depth_stencil_attachment.attachment as usize] + .format .aspects() .intersects(ImageAspects::DEPTH) }) @@ -1491,9 +1498,12 @@ impl RenderPassStateAttachments { }, ), }), - stencil_attachment: (subpass_desc.depth_stencil_attachment.as_ref()) + stencil_attachment: subpass_desc + .depth_stencil_attachment + .as_ref() .filter(|depth_stencil_attachment| { - (rp_attachments[depth_stencil_attachment.attachment as usize].format) + rp_attachments[depth_stencil_attachment.attachment as usize] + .format .aspects() .intersects(ImageAspects::STENCIL) }) @@ -1519,21 +1529,25 @@ impl RenderPassStateAttachments { pub(in crate::command_buffer) fn from_rendering_info(info: &RenderingInfo) -> Self { Self { - color_attachments: (info.color_attachments.iter()) + color_attachments: info + .color_attachments + .iter() .map(|atch_info| { - (atch_info.as_ref()).map(|atch_info| RenderPassStateAttachmentInfo { - image_view: atch_info.image_view.clone(), - _image_layout: atch_info.image_layout, - _resolve_info: atch_info.resolve_info.as_ref().map(|resolve_atch_info| { - RenderPassStateAttachmentResolveInfo { - _image_view: resolve_atch_info.image_view.clone(), - _image_layout: resolve_atch_info.image_layout, - } - }), - }) + atch_info + .as_ref() + .map(|atch_info| RenderPassStateAttachmentInfo { + image_view: atch_info.image_view.clone(), + _image_layout: atch_info.image_layout, + _resolve_info: atch_info.resolve_info.as_ref().map( + |resolve_atch_info| RenderPassStateAttachmentResolveInfo { + _image_view: resolve_atch_info.image_view.clone(), + _image_layout: resolve_atch_info.image_layout, + }, + ), + }) }) .collect(), - depth_attachment: (info.depth_attachment.as_ref()).map(|atch_info| { + depth_attachment: info.depth_attachment.as_ref().map(|atch_info| { RenderPassStateAttachmentInfo { image_view: atch_info.image_view.clone(), _image_layout: atch_info.image_layout, @@ -1545,7 +1559,7 @@ impl RenderPassStateAttachments { }), } }), - stencil_attachment: (info.stencil_attachment.as_ref()).map(|atch_info| { + stencil_attachment: info.stencil_attachment.as_ref().map(|atch_info| { RenderPassStateAttachmentInfo { image_view: atch_info.image_view.clone(), _image_layout: atch_info.image_layout, diff --git a/vulkano/src/command_buffer/auto/mod.rs b/vulkano/src/command_buffer/auto/mod.rs index ca66e3b7..c89b376f 100644 --- a/vulkano/src/command_buffer/auto/mod.rs +++ b/vulkano/src/command_buffer/auto/mod.rs @@ -523,7 +523,7 @@ mod tests { // primaries is an error. assert!(builder.execute_commands(secondary.clone()).is_err()); - std::mem::drop(cb1); + drop(cb1); // Now that the first cb is dropped, we should be able to record. builder.execute_commands(secondary).unwrap(); diff --git a/vulkano/src/command_buffer/commands/acceleration_structure.rs b/vulkano/src/command_buffer/commands/acceleration_structure.rs index cd4b253c..f7ae77ef 100644 --- a/vulkano/src/command_buffer/commands/acceleration_structure.rs +++ b/vulkano/src/command_buffer/commands/acceleration_structure.rs @@ -74,8 +74,7 @@ impl RecordingCommandBuffer { /// [`AabbPositions`]: crate::acceleration_structure::AabbPositions /// [`AccelerationStructureInstance::acceleration_structure_reference`]: crate::acceleration_structure::AccelerationStructureInstance::acceleration_structure_reference /// [`AccelerationStructureGeometryInstancesData::data`]: crate::acceleration_structure::AccelerationStructureGeometryInstancesData::data - /// [`device_address`]: crate::acceleration_structure::AccelerationStructure::device_address - /// [`AccelerationStructureGeometryInstancesDataType::Pointers`]: crate::acceleration_structure::AccelerationStructureGeometryInstancesDataType::Pointers + /// [`device_address`]: AccelerationStructure::device_address #[inline] pub unsafe fn build_acceleration_structure( &mut self, diff --git a/vulkano/src/command_buffer/commands/pipeline.rs b/vulkano/src/command_buffer/commands/pipeline.rs index 6755ca80..76fa21d7 100644 --- a/vulkano/src/command_buffer/commands/pipeline.rs +++ b/vulkano/src/command_buffer/commands/pipeline.rs @@ -1699,7 +1699,10 @@ impl RecordingCommandBuffer { let check_buffer_view = |set_num: u32, binding_num: u32, index: u32, buffer_view: &Arc| { - for desc_reqs in (binding_reqs.descriptors.get(&Some(index)).into_iter()) + for desc_reqs in binding_reqs + .descriptors + .get(&Some(index)) + .into_iter() .chain(binding_reqs.descriptors.get(&None)) { if layout_binding.descriptor_type == DescriptorType::StorageTexelBuffer { @@ -1750,7 +1753,10 @@ impl RecordingCommandBuffer { let check_image_view_common = |set_num: u32, binding_num: u32, index: u32, image_view: &Arc| { - for desc_reqs in (binding_reqs.descriptors.get(&Some(index)).into_iter()) + for desc_reqs in binding_reqs + .descriptors + .get(&Some(index)) + .into_iter() .chain(binding_reqs.descriptors.get(&None)) { if desc_reqs.storage_image_atomic @@ -1936,7 +1942,10 @@ impl RecordingCommandBuffer { let check_sampler_common = |set_num: u32, binding_num: u32, index: u32, sampler: &Arc| { - for desc_reqs in (binding_reqs.descriptors.get(&Some(index)).into_iter()) + for desc_reqs in binding_reqs + .descriptors + .get(&Some(index)) + .into_iter() .chain(binding_reqs.descriptors.get(&None)) { if desc_reqs.sampler_no_unnormalized_coordinates @@ -2062,7 +2071,10 @@ impl RecordingCommandBuffer { |set_num: u32, binding_num: u32, index: u32, sampler: &Arc| { check_sampler_common(set_num, binding_num, index, sampler)?; - for desc_reqs in (binding_reqs.descriptors.get(&Some(index)).into_iter()) + for desc_reqs in binding_reqs + .descriptors + .get(&Some(index)) + .into_iter() .chain(binding_reqs.descriptors.get(&None)) { // Check sampler-image compatibility. Only done for separate samplers; diff --git a/vulkano/src/command_buffer/commands/query.rs b/vulkano/src/command_buffer/commands/query.rs index 0289c85f..126b1e70 100644 --- a/vulkano/src/command_buffer/commands/query.rs +++ b/vulkano/src/command_buffer/commands/query.rs @@ -251,9 +251,8 @@ impl RecordingCommandBuffer { /// /// See also [`get_results`]. /// - /// [`query_pool.ty().result_len()`]: crate::query::QueryPool::result_len - /// [`QueryResultFlags::WITH_AVAILABILITY`]: crate::query::QueryResultFlags::WITH_AVAILABILITY - /// [`get_results`]: crate::query::QueryPool::get_results + /// [`query_pool.ty().result_len()`]: QueryPool::result_len + /// [`get_results`]: QueryPool::get_results pub fn copy_query_pool_results( &mut self, query_pool: Arc, diff --git a/vulkano/src/command_buffer/commands/render_pass.rs b/vulkano/src/command_buffer/commands/render_pass.rs index 8474f8a2..000b2ddb 100644 --- a/vulkano/src/command_buffer/commands/render_pass.rs +++ b/vulkano/src/command_buffer/commands/render_pass.rs @@ -1095,7 +1095,9 @@ impl RawRecordingCommandBuffer { _ne: _, } = subpass_desc; - for atch_ref in (input_attachments.iter().flatten()) + for atch_ref in input_attachments + .iter() + .flatten() .chain(color_attachments.iter().flatten()) .chain(color_resolve_attachments.iter().flatten()) .chain(depth_stencil_attachment.iter()) @@ -2182,7 +2184,9 @@ impl RenderingInfo { } } - for image_view in (color_attachments.iter().flatten()) + for image_view in color_attachments + .iter() + .flatten() .chain(depth_attachment.iter()) .chain(stencil_attachment.iter()) .flat_map(|attachment_info| { @@ -3132,7 +3136,7 @@ impl RenderingAttachmentResolveInfo { /// Clear attachment type, used in [`clear_attachments`] command. /// -/// [`clear_attachments`]: crate::command_buffer::RecordingCommandBuffer::clear_attachments +/// [`clear_attachments`]: RecordingCommandBuffer::clear_attachments #[derive(Clone, Copy, Debug)] pub enum ClearAttachment { /// Clear the color attachment at the specified index, with the specified clear value. @@ -3218,7 +3222,7 @@ impl From for ash::vk::ClearAttachment { /// Specifies the clear region for the [`clear_attachments`] command. /// -/// [`clear_attachments`]: crate::command_buffer::RecordingCommandBuffer::clear_attachments +/// [`clear_attachments`]: RecordingCommandBuffer::clear_attachments #[derive(Clone, Debug, PartialEq, Eq)] pub struct ClearRect { /// The rectangle offset. diff --git a/vulkano/src/command_buffer/commands/secondary.rs b/vulkano/src/command_buffer/commands/secondary.rs index f0c8385a..4152bbcd 100644 --- a/vulkano/src/command_buffer/commands/secondary.rs +++ b/vulkano/src/command_buffer/commands/secondary.rs @@ -188,12 +188,14 @@ impl RecordingCommandBuffer { })); } - for (color_attachment_index, image_view, inherited_format) in (attachments + for (color_attachment_index, image_view, inherited_format) in attachments .color_attachments - .iter()) - .zip(inheritance_info.color_attachment_formats.iter().copied()) - .enumerate() - .filter_map(|(i, (a, f))| a.as_ref().map(|a| (i as u32, &a.image_view, f))) + .iter() + .zip(inheritance_info.color_attachment_formats.iter().copied()) + .enumerate() + .filter_map(|(i, (a, f))| { + a.as_ref().map(|a| (i as u32, &a.image_view, f)) + }) { let required_format = image_view.format(); diff --git a/vulkano/src/command_buffer/commands/sync.rs b/vulkano/src/command_buffer/commands/sync.rs index 6ba6ecb2..00a787ff 100644 --- a/vulkano/src/command_buffer/commands/sync.rs +++ b/vulkano/src/command_buffer/commands/sync.rs @@ -1139,7 +1139,9 @@ impl RawRecordingCommandBuffer { buffer_memory_barriers_vk, image_memory_barriers_vk, }, - ) in (dependency_infos_vk.iter_mut()).zip(per_dependency_info_vk.iter_mut()) + ) in dependency_infos_vk + .iter_mut() + .zip(per_dependency_info_vk.iter_mut()) { *dependency_info_vk = ash::vk::DependencyInfo { memory_barrier_count: memory_barriers_vk.len() as u32, diff --git a/vulkano/src/command_buffer/mod.rs b/vulkano/src/command_buffer/mod.rs index d14822f6..e66ac179 100644 --- a/vulkano/src/command_buffer/mod.rs +++ b/vulkano/src/command_buffer/mod.rs @@ -88,8 +88,8 @@ //! let future = cb.execute(queue.clone()); //! ``` //! -//! [`StandardCommandBufferAllocator`]: self::allocator::StandardCommandBufferAllocator -//! [`CommandBufferAllocator`]: self::allocator::CommandBufferAllocator +//! [`StandardCommandBufferAllocator`]: allocator::StandardCommandBufferAllocator +//! [`CommandBufferAllocator`]: allocator::CommandBufferAllocator //! [inherit]: CommandBufferInheritanceInfo //! [`end`]: RecordingCommandBuffer::end //! [`GpuFuture`]: crate::sync::GpuFuture diff --git a/vulkano/src/command_buffer/traits.rs b/vulkano/src/command_buffer/traits.rs index 5d0a0a70..d80c649c 100644 --- a/vulkano/src/command_buffer/traits.rs +++ b/vulkano/src/command_buffer/traits.rs @@ -99,7 +99,7 @@ impl CommandBuffer { assert_eq!(self.device().handle(), future.device().handle()); if !future.queue_change_allowed() { - assert!(future.queue().unwrap() == queue); + assert_eq!(future.queue().unwrap(), queue); } Ok(CommandBufferExecFuture { diff --git a/vulkano/src/descriptor_set/allocator.rs b/vulkano/src/descriptor_set/allocator.rs index 3fd23b55..256f3007 100644 --- a/vulkano/src/descriptor_set/allocator.rs +++ b/vulkano/src/descriptor_set/allocator.rs @@ -172,8 +172,6 @@ impl AllocationHandle { /// /// This allocator only needs to lock when a thread first allocates or when a thread that /// previously allocated exits. In all other cases, allocation is lock-free. -/// -/// [`DescriptorPool`]: crate::descriptor_set::pool::DescriptorPool #[derive(Debug)] pub struct StandardDescriptorSetAllocator { device: InstanceOwnedDebugWrapper>, @@ -340,7 +338,7 @@ impl FixedEntry { .descriptor_counts() .iter() .map(|(&ty, &count)| { - assert!(ty != DescriptorType::InlineUniformBlock); + assert_ne!(ty, DescriptorType::InlineUniformBlock); (ty, count * create_info.set_count as u32) }) .collect(), @@ -425,7 +423,7 @@ impl VariableEntry { .descriptor_counts() .iter() .map(|(&ty, &count)| { - assert!(ty != DescriptorType::InlineUniformBlock); + assert_ne!(ty, DescriptorType::InlineUniformBlock); (ty, count * create_info.set_count as u32) }) .collect(), diff --git a/vulkano/src/descriptor_set/mod.rs b/vulkano/src/descriptor_set/mod.rs index cd5dedc4..e9fa8052 100644 --- a/vulkano/src/descriptor_set/mod.rs +++ b/vulkano/src/descriptor_set/mod.rs @@ -63,9 +63,6 @@ //! - The [`DescriptorSetsCollection`] trait is implemented on collections of descriptor sets. It //! is what you pass to the bind function. //! -//! [`DescriptorPool`]: pool::DescriptorPool -//! [`RawDescriptorSet`]: sys::RawDescriptorSet -//! [`DescriptorSetAllocator`]: allocator::DescriptorSetAllocator //! [`StandardDescriptorSetAllocator`]: allocator::StandardDescriptorSetAllocator pub(crate) use self::update::DescriptorWriteInfo; diff --git a/vulkano/src/descriptor_set/update.rs b/vulkano/src/descriptor_set/update.rs index 6d7016df..f7f78701 100644 --- a/vulkano/src/descriptor_set/update.rs +++ b/vulkano/src/descriptor_set/update.rs @@ -56,7 +56,7 @@ impl WriteDescriptorSet { /// See [`none`](Self::none) for more information. #[inline] pub fn none_array(binding: u32, first_array_element: u32, num_elements: u32) -> Self { - assert!(num_elements != 0); + assert_ne!(num_elements, 0); Self { binding, first_array_element, diff --git a/vulkano/src/device/mod.rs b/vulkano/src/device/mod.rs index a8e2b611..7d07574c 100644 --- a/vulkano/src/device/mod.rs +++ b/vulkano/src/device/mod.rs @@ -547,8 +547,8 @@ impl Device { /// Returns the Vulkan version supported by the device. /// /// This is the lower of the - /// [physical device's supported version](crate::device::physical::PhysicalDevice::api_version) - /// and the instance's [`max_api_version`](crate::instance::Instance::max_api_version). + /// [physical device's supported version](PhysicalDevice::api_version) + /// and the instance's [`max_api_version`](Instance::max_api_version). #[inline] pub fn api_version(&self) -> Version { self.api_version @@ -1566,7 +1566,7 @@ impl Device { object: &T, object_name: Option<&str>, ) -> Result<(), VulkanError> { - assert!(object.device().handle() == self.handle()); + assert_eq!(object.device().handle(), self.handle()); let object_name_vk = object_name.map(|object_name| CString::new(object_name).unwrap()); let info = ash::vk::DebugUtilsObjectNameInfoEXT { @@ -1750,7 +1750,7 @@ pub struct DeviceCreateInfo { /// /// The default value is `0`. /// - /// [private data slots]: self::private_data + /// [private data slots]: private_data /// [`ext_private_data`]: DeviceExtensions::ext_private_data pub private_data_slot_request_count: u32, @@ -2357,7 +2357,7 @@ mod tests { let queue_family_properties = &physical_device.queue_family_properties()[queue_family_index as usize]; let queues = (0..queue_family_properties.queue_count + 1) - .map(|_| (0.5)) + .map(|_| 0.5) .collect(); if Device::new( diff --git a/vulkano/src/device/physical.rs b/vulkano/src/device/physical.rs index 264679fc..0744bab9 100644 --- a/vulkano/src/device/physical.rs +++ b/vulkano/src/device/physical.rs @@ -488,8 +488,8 @@ impl PhysicalDevice { /// Returns the properties of displays attached to the physical device. #[inline] - pub fn display_properties<'a>( - self: &'a Arc, + pub fn display_properties( + self: &Arc, ) -> Result>, Validated> { self.validate_display_properties()?; @@ -510,8 +510,8 @@ impl PhysicalDevice { } #[cfg_attr(not(feature = "document_unchecked"), doc(hidden))] - pub unsafe fn display_properties_unchecked<'a>( - self: &'a Arc, + pub unsafe fn display_properties_unchecked( + self: &Arc, ) -> Result>, VulkanError> { let fns = self.instance.fns(); @@ -2543,7 +2543,11 @@ impl PhysicalDevice { Ok(surface_format2s_vk .into_iter() .filter_map(|surface_format2| { - (surface_format2.surface_format.format.try_into().ok()) + surface_format2 + .surface_format + .format + .try_into() + .ok() .zip(surface_format2.surface_format.color_space.try_into().ok()) }) .collect()) @@ -2580,7 +2584,10 @@ impl PhysicalDevice { Ok(surface_formats .into_iter() .filter_map(|surface_format| { - (surface_format.format.try_into().ok()) + surface_format + .format + .try_into() + .ok() .zip(surface_format.color_space.try_into().ok()) }) .collect()) diff --git a/vulkano/src/device/queue.rs b/vulkano/src/device/queue.rs index fb01499b..561bda14 100644 --- a/vulkano/src/device/queue.rs +++ b/vulkano/src/device/queue.rs @@ -425,10 +425,10 @@ impl<'a> QueueGuard<'a> { image_binds_vk, signal_semaphores_vk, }, - ) in (bind_infos_vk.iter_mut()).zip(per_bind_vk.iter_mut()) + ) in bind_infos_vk.iter_mut().zip(per_bind_vk.iter_mut()) { for (buffer_bind_infos_vk, buffer_binds_vk) in - (buffer_bind_infos_vk.iter_mut()).zip(buffer_binds_vk.iter()) + buffer_bind_infos_vk.iter_mut().zip(buffer_binds_vk.iter()) { *buffer_bind_infos_vk = ash::vk::SparseBufferMemoryBindInfo { bind_count: buffer_binds_vk.len() as u32, @@ -437,8 +437,9 @@ impl<'a> QueueGuard<'a> { }; } - for (image_opaque_bind_infos_vk, image_opaque_binds_vk) in - (image_opaque_bind_infos_vk.iter_mut()).zip(image_opaque_binds_vk.iter()) + for (image_opaque_bind_infos_vk, image_opaque_binds_vk) in image_opaque_bind_infos_vk + .iter_mut() + .zip(image_opaque_binds_vk.iter()) { *image_opaque_bind_infos_vk = ash::vk::SparseImageOpaqueMemoryBindInfo { bind_count: image_opaque_binds_vk.len() as u32, @@ -448,7 +449,7 @@ impl<'a> QueueGuard<'a> { } for (image_bind_infos_vk, image_binds_vk) in - (image_bind_infos_vk.iter_mut()).zip(image_binds_vk.iter()) + image_bind_infos_vk.iter_mut().zip(image_binds_vk.iter()) { *image_bind_infos_vk = ash::vk::SparseImageMemoryBindInfo { bind_count: image_binds_vk.len() as u32, @@ -686,7 +687,7 @@ impl<'a> QueueGuard<'a> { if has_present_regions { for (present_regions_vk, rectangles_vk) in - (present_regions_vk.iter_mut()).zip(rectangles_vk.iter()) + present_regions_vk.iter_mut().zip(rectangles_vk.iter()) { *present_regions_vk = ash::vk::PresentRegionKHR { rectangle_count: rectangles_vk.len() as u32, @@ -1005,7 +1006,7 @@ impl<'a> QueueGuard<'a> { command_buffer_infos_vk, signal_semaphore_infos_vk, }, - ) in (submit_info_vk.iter_mut()).zip(per_submit_vk.iter_mut()) + ) in submit_info_vk.iter_mut().zip(per_submit_vk.iter_mut()) { *submit_info_vk = ash::vk::SubmitInfo2 { wait_semaphore_info_count: wait_semaphore_infos_vk.len() as u32, @@ -1163,7 +1164,7 @@ impl<'a> QueueGuard<'a> { signal_semaphores_vk, signal_semaphore_values_vk, }, - ) in (submit_info_vk.iter_mut()).zip(per_submit_vk.iter_mut()) + ) in submit_info_vk.iter_mut().zip(per_submit_vk.iter_mut()) { *submit_info_vk = ash::vk::SubmitInfo { wait_semaphore_count: wait_semaphores_vk.len() as u32, diff --git a/vulkano/src/image/mod.rs b/vulkano/src/image/mod.rs index 17ca14ff..6f6a1276 100644 --- a/vulkano/src/image/mod.rs +++ b/vulkano/src/image/mod.rs @@ -43,7 +43,7 @@ //! You can [create a `ResourceMemory` from `DeviceMemory`] if you want to bind its own block of //! memory to an image. //! -//! [`ImageView`]: crate::image::view::ImageView +//! [`ImageView`]: view::ImageView //! [create an `Image` directly]: Image::new //! [create a `RawImage`]: RawImage::new //! [bind memory to it]: RawImage::bind_memory @@ -893,7 +893,7 @@ impl SubresourceRangeIterator { .collect::>() .into_iter() .peekable(); - assert!(aspect_nums.len() != 0); + assert_ne!(aspect_nums.len(), 0); let current_aspect_num = aspect_nums.next(); let current_mip_level = subresource_range.mip_levels.start; @@ -1032,9 +1032,6 @@ vulkan_bitflags! { /// For 2D images, whether an image view of type [`ImageViewType::Cube`] or /// [`ImageViewType::CubeArray`] can be created from the image. - /// - /// [`ImageViewType::Cube`]: crate::image::view::ImageViewType::Cube - /// [`ImageViewType::CubeArray`]: crate::image::view::ImageViewType::CubeArray CUBE_COMPATIBLE = CUBE_COMPATIBLE, /* TODO: enable @@ -1063,8 +1060,6 @@ vulkan_bitflags! { /// On [portability subset] devices, the [`image_view2_d_on3_d_image`] feature must be enabled /// on the device. /// - /// [`ImageViewType::Dim2d`]: crate::image::view::ImageViewType::Dim2d - /// [`ImageViewType::Dim2dArray`]: crate::image::view::ImageViewType::Dim2dArray /// [`DIM2D_VIEW_COMPATIBLE`]: ImageCreateFlags::DIM2D_VIEW_COMPATIBLE /// [portability subset]: crate::instance#portability-subset-devices-and-the-enumerate_portability-flag /// [`image_view2_d_on3_d_image`]: crate::device::DeviceFeatures::image_view2_d_on3_d_image @@ -1146,7 +1141,6 @@ vulkan_bitflags! { /// - [`image2_d_view_of3_d`] for storage images. /// - [`sampler2_d_view_of3_d`] for sampled images. /// - /// [`ImageViewType::Dim2d`]: crate::image::view::ImageViewType::Dim2d /// [`DIM2D_ARRAY_COMPATIBLE`]: ImageCreateFlags::DIM2D_ARRAY_COMPATIBLE /// [`image2_d_view_of3_d`]: crate::device::DeviceFeatures::image2_d_view_of3_d /// [`sampler2_d_view_of3_d`]: crate::device::DeviceFeatures::sampler2_d_view_of3_d @@ -1641,7 +1635,7 @@ pub struct SubresourceLayout { } /// The image configuration to query in -/// [`PhysicalDevice::image_format_properties`](crate::device::physical::PhysicalDevice::image_format_properties). +/// [`PhysicalDevice::image_format_properties`]. #[derive(Clone, Debug, PartialEq, Eq, Hash)] pub struct ImageFormatInfo { /// The `flags` that the image will have. @@ -1983,7 +1977,7 @@ impl ImageFormatInfo { } /// The image's DRM format modifier configuration to query in -/// [`PhysicalDevice::image_format_properties`](crate::device::physical::PhysicalDevice::image_format_properties). +/// [`PhysicalDevice::image_format_properties`]. #[derive(Clone, Debug, PartialEq, Eq, Hash)] pub struct ImageDrmFormatModifierInfo { /// The DRM format modifier to query. @@ -2095,13 +2089,13 @@ pub struct ImageFormatProperties { pub external_memory_properties: ExternalMemoryProperties, /// When querying with an image view type, whether such image views support sampling with - /// a [`Cubic`](crate::image::sampler::Filter::Cubic) `mag_filter` or `min_filter`. + /// a [`Cubic`](sampler::Filter::Cubic) `mag_filter` or `min_filter`. pub filter_cubic: bool, /// When querying with an image view type, whether such image views support sampling with - /// a [`Cubic`](crate::image::sampler::Filter::Cubic) `mag_filter` or `min_filter`, and with a - /// [`Min`](crate::image::sampler::SamplerReductionMode::Min) or - /// [`Max`](crate::image::sampler::SamplerReductionMode::Max) `reduction_mode`. + /// a [`Cubic`](sampler::Filter::Cubic) `mag_filter` or `min_filter`, and with a + /// [`Min`](sampler::SamplerReductionMode::Min) or + /// [`Max`](sampler::SamplerReductionMode::Max) `reduction_mode`. pub filter_cubic_minmax: bool, } @@ -2126,7 +2120,7 @@ impl From for ImageFormatProperties { } /// The image configuration to query in -/// [`PhysicalDevice::sparse_image_format_properties`](crate::device::physical::PhysicalDevice::sparse_image_format_properties). +/// [`PhysicalDevice::sparse_image_format_properties`]. #[derive(Clone, Debug, PartialEq, Eq, Hash)] pub struct SparseImageFormatInfo { /// The `format` that the image will have. diff --git a/vulkano/src/image/sampler/mod.rs b/vulkano/src/image/sampler/mod.rs index 2e04aa30..badda074 100644 --- a/vulkano/src/image/sampler/mod.rs +++ b/vulkano/src/image/sampler/mod.rs @@ -708,8 +708,8 @@ pub struct SamplerCreateInfo { /// - Anisotropy and depth comparison must be disabled. /// /// Some restrictions also apply to the image view being sampled: - /// - The view type must be [`Dim1d`](crate::image::view::ImageViewType::Dim1d) or - /// [`Dim2d`](crate::image::view::ImageViewType::Dim2d). Arrayed types are not allowed. + /// - The view type must be [`Dim1d`](ImageViewType::Dim1d) or [`Dim2d`](ImageViewType::Dim2d). + /// Arrayed types are not allowed. /// - It must have a single mipmap level. /// /// Finally, restrictions apply to the sampling operations that can be used in a shader: @@ -1323,7 +1323,7 @@ vulkan_enum! { /// /// The [`ext_filter_cubic`](crate::device::DeviceExtensions::ext_filter_cubic) extension must /// be enabled on the device, and anisotropy must be disabled. Sampled image views must have - /// a type of [`Dim2d`](crate::image::view::ImageViewType::Dim2d). + /// a type of [`Dim2d`](ImageViewType::Dim2d). Cubic = CUBIC_EXT RequiresOneOf([ RequiresAllOf([DeviceExtension(ext_filter_cubic)]), diff --git a/vulkano/src/image/sys.rs b/vulkano/src/image/sys.rs index 44229dc1..faa3621f 100644 --- a/vulkano/src/image/sys.rs +++ b/vulkano/src/image/sys.rs @@ -1196,7 +1196,7 @@ impl RawImage { }); }; - for (info_vk, plane_info_vk) in (infos_vk.iter_mut()).zip(plane_infos_vk.iter_mut()) { + for (info_vk, plane_info_vk) in infos_vk.iter_mut().zip(plane_infos_vk.iter_mut()) { info_vk.p_next = plane_info_vk as *mut _ as *mut _; } diff --git a/vulkano/src/instance/mod.rs b/vulkano/src/instance/mod.rs index 2d9ba237..66df2469 100644 --- a/vulkano/src/instance/mod.rs +++ b/vulkano/src/instance/mod.rs @@ -142,9 +142,9 @@ include!(concat!(env!("OUT_DIR"), "/instance_extensions.rs")); /// to use when used on a particular instance or device. It is possible for the instance and the /// device to support different versions. The supported version for an instance can be queried /// before creation with -/// [`VulkanLibrary::api_version`](crate::VulkanLibrary::api_version), +/// [`VulkanLibrary::api_version`], /// while for a device it can be retrieved with -/// [`PhysicalDevice::api_version`](crate::device::physical::PhysicalDevice::api_version). +/// [`PhysicalDevice::api_version`]. /// /// When creating an `Instance`, you have to specify a maximum API version that you will use. /// This restricts the API version that is available for the instance and any devices created from @@ -210,7 +210,7 @@ include!(concat!(env!("OUT_DIR"), "/instance_extensions.rs")); /// /// When creating an `Instance`, you have the possibility to pass a list of **layers** that will /// be activated on the newly-created instance. The list of available layers can be retrieved by -/// calling the [`layer_properties`](crate::VulkanLibrary::layer_properties) method of +/// calling the [`layer_properties`](VulkanLibrary::layer_properties) method of /// `VulkanLibrary`. /// /// A layer is a component that will hook and potentially modify the Vulkan function calls. @@ -592,7 +592,7 @@ impl Instance { /// Returns the Vulkan version supported by the instance. /// /// This is the lower of the - /// [driver's supported version](crate::VulkanLibrary::api_version) and + /// [driver's supported version](VulkanLibrary::api_version) and /// [`max_api_version`](Instance::max_api_version). #[inline] pub fn api_version(&self) -> Version { @@ -952,7 +952,7 @@ pub struct InstanceCreateInfo { /// to use during the creation and destruction of the instance. /// /// The debug messengers are not used at any other time, - /// [`DebugUtilsMessenger`](crate::instance::debug::DebugUtilsMessenger) should be used for + /// [`DebugUtilsMessenger`](debug::DebugUtilsMessenger) should be used for /// that. /// /// If this is not empty, the `ext_debug_utils` extension must be set in `enabled_extensions`. diff --git a/vulkano/src/lib.rs b/vulkano/src/lib.rs index 9463ba2e..92a83a32 100644 --- a/vulkano/src/lib.rs +++ b/vulkano/src/lib.rs @@ -40,7 +40,7 @@ //! of the surface change, such as when the size of the window changes. It then becomes //! necessary to create a new swapchain. //! -//! 8. Record a [*command buffer*](crate::command_buffer), containing commands that the device must +//! 8. Record a [*command buffer*](command_buffer), containing commands that the device must //! execute. Then build the command buffer and submit it to a `Queue`. //! //! Many different operations can be recorded to a command buffer, such as *draw*, *compute* and @@ -97,27 +97,26 @@ //! | `document_unchecked` | Include `_unchecked` functions in the generated documentation. | //! | `serde` | Enables (de)serialization of certain types using [`serde`]. | //! -//! [`VulkanLibrary`]: crate::VulkanLibrary -//! [`Instance`]: crate::instance::Instance -//! [`Surface`]: crate::swapchain::Surface +//! [`Instance`]: instance::Instance +//! [`Surface`]: swapchain::Surface //! [`vulkano-win`]: https://crates.io/crates/vulkano-win -//! [Enumerate the physical devices]: crate::instance::Instance::enumerate_physical_devices -//! [`PhysicalDevice`]: crate::device::physical::PhysicalDevice -//! [`Device`]: crate::device::Device -//! [`Queue`]: crate::device::Queue -//! [`Swapchain`]: crate::swapchain::Swapchain -//! [*command buffer*]: crate::command_buffer -//! [*Buffers*]: crate::buffer -//! [*Images*]: crate::image -//! [*Pipelines*]: crate::pipeline -//! [*shader*]: crate::shader -//! [`ComputePipeline`]: crate::pipeline::ComputePipeline -//! [`GraphicsPipeline`]: crate::pipeline::GraphicsPipeline -//! [*Descriptor sets*]: crate::descriptor_set -//! [`DescriptorSetLayout`]: crate::descriptor_set::layout -//! [`PipelineLayout`]: crate::pipeline::layout -//! [`RenderPass`]: crate::render_pass::RenderPass -//! [`Framebuffer`]: crate::render_pass::Framebuffer +//! [Enumerate the physical devices]: instance::Instance::enumerate_physical_devices +//! [`PhysicalDevice`]: device::physical::PhysicalDevice +//! [`Device`]: device::Device +//! [`Queue`]: device::Queue +//! [`Swapchain`]: swapchain::Swapchain +//! [*command buffer*]: command_buffer +//! [*Buffers*]: buffer +//! [*Images*]: image +//! [*Pipelines*]: pipeline +//! [*shader*]: shader +//! [`ComputePipeline`]: pipeline::ComputePipeline +//! [`GraphicsPipeline`]: pipeline::GraphicsPipeline +//! [*Descriptor sets*]: descriptor_set +//! [`DescriptorSetLayout`]: descriptor_set::layout +//! [`PipelineLayout`]: pipeline::layout +//! [`RenderPass`]: render_pass::RenderPass +//! [`Framebuffer`]: render_pass::Framebuffer //! [`vulkano-macros`]: vulkano_macros //! [`serde`]: https://crates.io/crates/serde @@ -252,7 +251,7 @@ unsafe impl SafeDeref for Box {} /// Gives access to the internal identifier of an object. pub unsafe trait VulkanObject { /// The type of the object. - type Handle: ash::vk::Handle; + type Handle: Handle; /// Returns the raw Vulkan handle of the object. fn handle(&self) -> Self::Handle; diff --git a/vulkano/src/memory/allocator/mod.rs b/vulkano/src/memory/allocator/mod.rs index 814f273c..634659c7 100644 --- a/vulkano/src/memory/allocator/mod.rs +++ b/vulkano/src/memory/allocator/mod.rs @@ -204,7 +204,6 @@ //! [buffer-image granularity]: crate::device::DeviceProperties::buffer_image_granularity //! [cyclic references]: Arc#breaking-cycles-with-weak //! [`Rc`]: std::rc::Rc -//! [`mem::forget`]: std::mem::forget //! [region]: Suballocator#regions mod layout; diff --git a/vulkano/src/memory/allocator/suballocator/mod.rs b/vulkano/src/memory/allocator/suballocator/mod.rs index 5117124a..2136a46c 100644 --- a/vulkano/src/memory/allocator/suballocator/mod.rs +++ b/vulkano/src/memory/allocator/suballocator/mod.rs @@ -372,13 +372,13 @@ mod tests { assert!(allocator .allocate(DUMMY_LAYOUT, AllocationType::Unknown, DeviceAlignment::MIN) .is_err()); - assert!(allocator.free_size() == 0); + assert_eq!(allocator.free_size(), 0); for alloc in allocs { unsafe { allocator.deallocate(alloc) }; } - assert!(allocator.free_size() == REGION_SIZE); + assert_eq!(allocator.free_size(), REGION_SIZE); let alloc = allocator .allocate( DeviceLayout::from_size_alignment(REGION_SIZE, 1).unwrap(), @@ -408,7 +408,7 @@ mod tests { assert!(allocator .allocate(LAYOUT, AllocationType::Unknown, DeviceAlignment::MIN) .is_err()); - assert!(allocator.free_size() == REGION_SIZE - 10); + assert_eq!(allocator.free_size(), REGION_SIZE - 10); for alloc in allocs.drain(..) { unsafe { allocator.deallocate(alloc) }; @@ -443,7 +443,7 @@ mod tests { assert!(allocator .allocate(DUMMY_LAYOUT, AllocationType::Linear, GRANULARITY) .is_err()); - assert!(allocator.free_size() == 0); + assert_eq!(allocator.free_size(), 0); for alloc in linear_allocs.drain(..) { unsafe { allocator.deallocate(alloc) }; @@ -498,7 +498,7 @@ mod tests { assert!(allocator .allocate(DUMMY_LAYOUT, AllocationType::Unknown, DeviceAlignment::MIN) .is_err()); - assert!(allocator.free_size() == 0); + assert_eq!(allocator.free_size(), 0); for alloc in allocs.drain(..) { unsafe { allocator.deallocate(alloc) }; @@ -528,7 +528,7 @@ mod tests { assert!(allocator .allocate(DUMMY_LAYOUT, AllocationType::Unknown, DeviceAlignment::MIN) .is_err()); - assert!(allocator.free_size() == 0); + assert_eq!(allocator.free_size(), 0); unsafe { allocator.deallocate(alloc) }; for alloc in allocs.drain(..) { @@ -552,7 +552,10 @@ mod tests { assert!(allocator .allocate(layout, AllocationType::Unknown, DeviceAlignment::MIN) .is_err()); - assert!(allocator.free_size() == REGION_SIZE - BuddyAllocator::MIN_NODE_SIZE); + assert_eq!( + allocator.free_size(), + REGION_SIZE - BuddyAllocator::MIN_NODE_SIZE, + ); unsafe { allocator.deallocate(alloc) }; } @@ -576,9 +579,9 @@ mod tests { assert!(allocator .allocate(layout_a, AllocationType::Unknown, DeviceAlignment::MIN) .is_err()); - assert!( - allocator.free_size() - == REGION_SIZE - allocations_a * BuddyAllocator::MIN_NODE_SIZE + assert_eq!( + allocator.free_size(), + REGION_SIZE - allocations_a * BuddyAllocator::MIN_NODE_SIZE, ); for _ in 0..allocations_b { @@ -592,7 +595,7 @@ mod tests { assert!(allocator .allocate(DUMMY_LAYOUT, AllocationType::Unknown, DeviceAlignment::MIN) .is_err()); - assert!(allocator.free_size() == 0); + assert_eq!(allocator.free_size(), 0); for alloc in allocs { unsafe { allocator.deallocate(alloc) }; @@ -623,7 +626,7 @@ mod tests { assert!(allocator .allocate(DUMMY_LAYOUT, AllocationType::Linear, GRANULARITY) .is_err()); - assert!(allocator.free_size() == 0); + assert_eq!(allocator.free_size(), 0); for alloc in allocs { unsafe { allocator.deallocate(alloc) }; @@ -640,7 +643,7 @@ mod tests { assert!(allocator .allocate(DUMMY_LAYOUT, AllocationType::Linear, GRANULARITY) .is_err()); - assert!(allocator.free_size() == 0); + assert_eq!(allocator.free_size(), 0); unsafe { allocator.deallocate(alloc1) }; unsafe { allocator.deallocate(alloc2) }; } @@ -673,10 +676,10 @@ mod tests { assert!(allocator .allocate(layout, AllocationType::Unknown, DeviceAlignment::MIN) .is_err()); - assert!(allocator.free_size() == 0); + assert_eq!(allocator.free_size(), 0); allocator.reset(); - assert!(allocator.free_size() == REGION_SIZE); + assert_eq!(allocator.free_size(), REGION_SIZE); } #[test] @@ -706,7 +709,7 @@ mod tests { assert!(allocator .allocate(DUMMY_LAYOUT, AllocationType::Linear, GRANULARITY) .is_err()); - assert!(allocator.free_size() == 0); + assert_eq!(allocator.free_size(), 0); allocator.reset(); @@ -727,9 +730,9 @@ mod tests { assert!(allocator .allocate(DUMMY_LAYOUT, AllocationType::Linear, GRANULARITY) .is_err()); - assert!(allocator.free_size() == GRANULARITY.as_devicesize() - 1); + assert_eq!(allocator.free_size(), GRANULARITY.as_devicesize() - 1); allocator.reset(); - assert!(allocator.free_size() == REGION_SIZE); + assert_eq!(allocator.free_size(), REGION_SIZE); } } diff --git a/vulkano/src/memory/device_memory.rs b/vulkano/src/memory/device_memory.rs index cb5c1c3b..34bc62e3 100644 --- a/vulkano/src/memory/device_memory.rs +++ b/vulkano/src/memory/device_memory.rs @@ -589,7 +589,7 @@ impl DeviceMemory { /// cache, then there must not be any references in Rust code to any portion of the specified /// `memory_range`. /// - /// [host-coherent]: crate::memory::MemoryPropertyFlags::HOST_COHERENT + /// [host-coherent]: MemoryPropertyFlags::HOST_COHERENT /// [`map`]: Self::map /// [`non_coherent_atom_size`]: crate::device::DeviceProperties::non_coherent_atom_size #[inline] @@ -644,7 +644,7 @@ impl DeviceMemory { /// - There must be no operations pending or executing in a device queue, that access the /// specified `memory_range`. /// - /// [host-coherent]: crate::memory::MemoryPropertyFlags::HOST_COHERENT + /// [host-coherent]: MemoryPropertyFlags::HOST_COHERENT /// [`map`]: Self::map /// [`non_coherent_atom_size`]: crate::device::DeviceProperties::non_coherent_atom_size #[inline] @@ -711,7 +711,7 @@ impl DeviceMemory { /// `self` must have been allocated from a memory type that has the [`LAZILY_ALLOCATED`] flag /// set. /// - /// [`LAZILY_ALLOCATED`]: crate::memory::MemoryPropertyFlags::LAZILY_ALLOCATED + /// [`LAZILY_ALLOCATED`]: MemoryPropertyFlags::LAZILY_ALLOCATED #[inline] pub fn commitment(&self) -> Result> { self.validate_commitment()?; diff --git a/vulkano/src/memory/mod.rs b/vulkano/src/memory/mod.rs index 0d8181ee..17175a1e 100644 --- a/vulkano/src/memory/mod.rs +++ b/vulkano/src/memory/mod.rs @@ -121,7 +121,7 @@ mod device_memory; /// block of `DeviceMemory` to a resource, or can't go through an allocator, you can use [the /// dedicated constructor]. /// -/// [memory allocator]: allocator::MemoryAllocator +/// [memory allocator]: MemoryAllocator /// [the dedicated constructor]: Self::new_dedicated #[derive(Debug)] pub struct ResourceMemory { @@ -251,8 +251,6 @@ impl ResourceMemory { /// range of the memory mapping given to [`DeviceMemory::map`]. /// /// See [`MappingState::slice`] for the safety invariants of the returned pointer. - /// - /// [`MappingState::slice`]: crate::memory::MappingState::slice #[inline] pub fn mapped_slice( &self, @@ -277,7 +275,7 @@ impl ResourceMemory { &self, range: impl RangeBounds, ) -> Result, HostAccessError> { - let mut range = self::range_unchecked(range, ..self.size()); + let mut range = range_unchecked(range, ..self.size()); range.start += self.offset(); range.end += self.offset(); @@ -306,7 +304,7 @@ impl ResourceMemory { /// cache, then there must not be any references in Rust code to any portion of the specified /// `memory_range`. /// - /// [host-coherent]: crate::memory::MemoryPropertyFlags::HOST_COHERENT + /// [host-coherent]: MemoryPropertyFlags::HOST_COHERENT /// [`non_coherent_atom_size`]: crate::device::DeviceProperties::non_coherent_atom_size #[inline] pub unsafe fn invalidate_range( @@ -340,7 +338,7 @@ impl ResourceMemory { /// - There must be no operations pending or executing in a device queue, that access any /// portion of the specified `memory_range`. /// - /// [host-coherent]: crate::memory::MemoryPropertyFlags::HOST_COHERENT + /// [host-coherent]: MemoryPropertyFlags::HOST_COHERENT /// [`non_coherent_atom_size`]: crate::device::DeviceProperties::non_coherent_atom_size #[inline] pub unsafe fn flush_range( @@ -538,8 +536,8 @@ vulkan_bitflags! { /// Host access to the memory does not require calling [`invalidate_range`] to make device /// writes visible to the host, nor [`flush_range`] to flush host writes back to the device. /// - /// [`invalidate_range`]: MappedDeviceMemory::invalidate_range - /// [`flush_range`]: MappedDeviceMemory::flush_range + /// [`invalidate_range`]: DeviceMemory::invalidate_range + /// [`flush_range`]: DeviceMemory::flush_range HOST_COHERENT = HOST_COHERENT, /// The memory is cached by the host. diff --git a/vulkano/src/pipeline/cache.rs b/vulkano/src/pipeline/cache.rs index ed3bbda3..88b9e6b0 100644 --- a/vulkano/src/pipeline/cache.rs +++ b/vulkano/src/pipeline/cache.rs @@ -9,8 +9,8 @@ //! doesn't exist. //! //! Once that is done, you can extract the data from the cache and store it. See the documentation -//! of [`get_data`](crate::pipeline::cache::PipelineCache::get_data) for example of how to store -//! the data on the disk, and [`new`](crate::pipeline::cache::PipelineCache::new) for how to reload +//! of [`get_data`](PipelineCache::get_data) for example of how to store +//! the data on the disk, and [`new`](PipelineCache::new) for how to reload //! it. use crate::{ diff --git a/vulkano/src/pipeline/graphics/mod.rs b/vulkano/src/pipeline/graphics/mod.rs index 9c6ff936..7196fae3 100644 --- a/vulkano/src/pipeline/graphics/mod.rs +++ b/vulkano/src/pipeline/graphics/mod.rs @@ -306,7 +306,7 @@ impl GraphicsPipeline { specialization_data_vk, required_subgroup_size_create_info, }, - ) in (stages_vk.iter_mut()).zip(per_stage_vk.iter_mut()) + ) in stages_vk.iter_mut().zip(per_stage_vk.iter_mut()) { *stage_vk = ash::vk::PipelineShaderStageCreateInfo { p_next: required_subgroup_size_create_info.as_ref().map_or( diff --git a/vulkano/src/pipeline/graphics/subpass.rs b/vulkano/src/pipeline/graphics/subpass.rs index b8604f86..7eaba878 100644 --- a/vulkano/src/pipeline/graphics/subpass.rs +++ b/vulkano/src/pipeline/graphics/subpass.rs @@ -85,19 +85,25 @@ impl PipelineRenderingCreateInfo { Self { view_mask: subpass_desc.view_mask, - color_attachment_formats: (subpass_desc.color_attachments.iter()) + color_attachment_formats: subpass_desc + .color_attachments + .iter() .map(|color_attachment| { color_attachment.as_ref().map(|color_attachment| { rp_attachments[color_attachment.attachment as usize].format }) }) .collect(), - depth_attachment_format: (subpass_desc.depth_stencil_attachment.as_ref()) + depth_attachment_format: subpass_desc + .depth_stencil_attachment + .as_ref() .map(|depth_stencil_attachment| { rp_attachments[depth_stencil_attachment.attachment as usize].format }) .filter(|format| format.aspects().intersects(ImageAspects::DEPTH)), - stencil_attachment_format: (subpass_desc.depth_stencil_attachment.as_ref()) + stencil_attachment_format: subpass_desc + .depth_stencil_attachment + .as_ref() .map(|depth_stencil_attachment| { rp_attachments[depth_stencil_attachment.attachment as usize].format }) @@ -109,16 +115,22 @@ impl PipelineRenderingCreateInfo { pub(crate) fn from_rendering_info(info: &RenderingInfo) -> Self { Self { view_mask: info.view_mask, - color_attachment_formats: (info.color_attachments.iter()) + color_attachment_formats: info + .color_attachments + .iter() .map(|atch_info| { atch_info .as_ref() .map(|atch_info| atch_info.image_view.format()) }) .collect(), - depth_attachment_format: (info.depth_attachment.as_ref()) + depth_attachment_format: info + .depth_attachment + .as_ref() .map(|atch_info| atch_info.image_view.format()), - stencil_attachment_format: (info.stencil_attachment.as_ref()) + stencil_attachment_format: info + .stencil_attachment + .as_ref() .map(|atch_info| atch_info.image_view.format()), _ne: crate::NonExhaustive(()), } diff --git a/vulkano/src/pipeline/graphics/vertex_input/collection.rs b/vulkano/src/pipeline/graphics/vertex_input/collection.rs index 0243027c..b5354b66 100644 --- a/vulkano/src/pipeline/graphics/vertex_input/collection.rs +++ b/vulkano/src/pipeline/graphics/vertex_input/collection.rs @@ -23,8 +23,14 @@ impl VertexBuffersCollection for Subbuffer { impl VertexBuffersCollection for Vec> { fn into_vec(self) -> Vec> { - assert!(mem::size_of::>() == mem::size_of::>()); - assert!(mem::align_of::>() == mem::align_of::>()); + assert_eq!( + mem::size_of::>(), + mem::size_of::>(), + ); + assert_eq!( + mem::align_of::>(), + mem::align_of::>(), + ); // SAFETY: All `Subbuffer`s share the same layout. unsafe { mem::transmute::>, Vec>>(self) } diff --git a/vulkano/src/pipeline/graphics/vertex_input/mod.rs b/vulkano/src/pipeline/graphics/vertex_input/mod.rs index 8a52cca5..29279234 100644 --- a/vulkano/src/pipeline/graphics/vertex_input/mod.rs +++ b/vulkano/src/pipeline/graphics/vertex_input/mod.rs @@ -334,30 +334,32 @@ impl VertexInputState { vuids: RequiredVertexInputsVUIDs, ) -> Result<(), Box> { for (&location, location_info) in vertex_shader_inputs { - let (is_previous, attribute_desc) = - (self.attributes.get(&location).map(|d| (false, d))) - .or_else(|| { - // If the previous location has at least three 64-bit components, - // then it extends into the current location, so try that instead. - location.checked_sub(1).and_then(|location| { - self.attributes - .get(&location) - .filter(|attribute_desc| attribute_desc.format.locations() == 2) - .map(|d| (true, d)) - }) + let (is_previous, attribute_desc) = self + .attributes + .get(&location) + .map(|d| (false, d)) + .or_else(|| { + // If the previous location has at least three 64-bit components, + // then it extends into the current location, so try that instead. + location.checked_sub(1).and_then(|location| { + self.attributes + .get(&location) + .filter(|attribute_desc| attribute_desc.format.locations() == 2) + .map(|d| (true, d)) }) - .ok_or_else(|| { - Box::new(ValidationError { - problem: format!( - "the vertex shader has an input variable with location {0}, but \ - the vertex input attributes do not contain {0}", - location, - ) - .into(), - vuids: vuids.not_present, - ..Default::default() - }) - })?; + }) + .ok_or_else(|| { + Box::new(ValidationError { + problem: format!( + "the vertex shader has an input variable with location {0}, but \ + the vertex input attributes do not contain {0}", + location, + ) + .into(), + vuids: vuids.not_present, + ..Default::default() + }) + })?; let attribute_numeric_type = attribute_desc .format diff --git a/vulkano/src/pipeline/graphics/viewport.rs b/vulkano/src/pipeline/graphics/viewport.rs index 95342588..27baf3f3 100644 --- a/vulkano/src/pipeline/graphics/viewport.rs +++ b/vulkano/src/pipeline/graphics/viewport.rs @@ -154,7 +154,8 @@ impl ViewportState { // VUID-VkPipelineViewportStateCreateInfo-x-02821 // Ensured by the use of an unsigned integer. - if (i32::try_from(offset[0]).ok()) + if i32::try_from(offset[0]) + .ok() .zip(i32::try_from(extent[0]).ok()) .and_then(|(o, e)| o.checked_add(e)) .is_none() @@ -167,7 +168,8 @@ impl ViewportState { })); } - if (i32::try_from(offset[1]).ok()) + if i32::try_from(offset[1]) + .ok() .zip(i32::try_from(extent[1]).ok()) .and_then(|(o, e)| o.checked_add(e)) .is_none() diff --git a/vulkano/src/pipeline/mod.rs b/vulkano/src/pipeline/mod.rs index 9fe3032b..57a01186 100644 --- a/vulkano/src/pipeline/mod.rs +++ b/vulkano/src/pipeline/mod.rs @@ -336,7 +336,7 @@ vulkan_enum! { DepthBias = DEPTH_BIAS, /// The value of - /// [`ColorBlendState::blend_constants`](crate::pipeline::graphics::color_blend::ColorBlendState::blend_constants). + /// [`ColorBlendState::blend_constants`](graphics::color_blend::ColorBlendState::blend_constants). /// /// Set with /// [`set_blend_constants`](crate::command_buffer::RecordingCommandBuffer::set_blend_constants). @@ -374,7 +374,7 @@ vulkan_enum! { StencilReference = STENCIL_REFERENCE, /// The value of - /// [`RasterizationState::cull_mode`](crate::pipeline::graphics::rasterization::RasterizationState::cull_mode). + /// [`RasterizationState::cull_mode`](graphics::rasterization::RasterizationState::cull_mode). /// /// Set with /// [`set_cull_mode`](crate::command_buffer::RecordingCommandBuffer::set_cull_mode). @@ -385,7 +385,7 @@ vulkan_enum! { ]), /// The value of - /// [`RasterizationState::front_face`](crate::pipeline::graphics::rasterization::RasterizationState::front_face). + /// [`RasterizationState::front_face`](graphics::rasterization::RasterizationState::front_face). /// /// Set with /// [`set_front_face`](crate::command_buffer::RecordingCommandBuffer::set_front_face). @@ -396,7 +396,7 @@ vulkan_enum! { ]), /// The value of - /// [`InputAssemblyState::topology`](crate::pipeline::graphics::input_assembly::InputAssemblyState::topology). + /// [`InputAssemblyState::topology`](graphics::input_assembly::InputAssemblyState::topology). /// /// Set with /// [`set_primitive_topology`](crate::command_buffer::RecordingCommandBuffer::set_primitive_topology). @@ -526,7 +526,7 @@ vulkan_enum! { ]), /// The value of - /// [`InputAssemblyState::primitive_restart_enable`](crate::pipeline::graphics::input_assembly::InputAssemblyState::primitive_restart_enable). + /// [`InputAssemblyState::primitive_restart_enable`](graphics::input_assembly::InputAssemblyState::primitive_restart_enable). /// /// Set with /// [`set_primitive_restart_enable`](crate::command_buffer::RecordingCommandBuffer::set_primitive_restart_enable). @@ -616,7 +616,7 @@ vulkan_enum! { ]), /// The value of - /// [`TessellationState::patch_control_points`](crate::pipeline::graphics::tessellation::TessellationState::patch_control_points). + /// [`TessellationState::patch_control_points`](graphics::tessellation::TessellationState::patch_control_points). /// /// Set with /// [`set_patch_control_points`](crate::command_buffer::RecordingCommandBuffer::set_patch_control_points). @@ -626,7 +626,7 @@ vulkan_enum! { ]), /// The value of - /// [`ColorBlendState::logic_op`](crate::pipeline::graphics::color_blend::ColorBlendState::logic_op). + /// [`ColorBlendState::logic_op`](graphics::color_blend::ColorBlendState::logic_op). /// /// Set with /// [`set_logic_op`](crate::command_buffer::RecordingCommandBuffer::set_logic_op). diff --git a/vulkano/src/pipeline/shader/inout_interface.rs b/vulkano/src/pipeline/shader/inout_interface.rs index 4477bb8a..a6fc11fe 100644 --- a/vulkano/src/pipeline/shader/inout_interface.rs +++ b/vulkano/src/pipeline/shader/inout_interface.rs @@ -388,7 +388,9 @@ fn are_interface_types_compatible( }, ) => { out_member_types.len() == in_member_types.len() - && (out_member_types.iter().zip(out_id_info.members())) + && out_member_types + .iter() + .zip(out_id_info.members()) .zip(in_member_types.iter().zip(in_id_info.members())) .all( |( diff --git a/vulkano/src/pipeline/shader/mod.rs b/vulkano/src/pipeline/shader/mod.rs index c33ecb14..5a1423ae 100644 --- a/vulkano/src/pipeline/shader/mod.rs +++ b/vulkano/src/pipeline/shader/mod.rs @@ -340,71 +340,72 @@ impl PipelineShaderStageCreateInfo { } } - let local_size = (spirv - .decorations() - .iter() - .find_map(|instruction| match *instruction { - Instruction::Decorate { - target, - decoration: - Decoration::BuiltIn { - built_in: BuiltIn::WorkgroupSize, - }, - } => { - let constituents: &[Id; 3] = match *spirv.id(target).instruction() { - Instruction::ConstantComposite { - ref constituents, .. - } => constituents.as_slice().try_into().unwrap(), - _ => unreachable!(), - }; - - let local_size = constituents.map(|id| match *spirv.id(id).instruction() { - Instruction::Constant { ref value, .. } => { - assert!(value.len() == 1); - value[0] - } - _ => unreachable!(), - }); - - Some(local_size) - } - _ => None, - })) - .or_else(|| { - entry_point_function - .execution_modes() + let local_size = + spirv + .decorations() .iter() .find_map(|instruction| match *instruction { - Instruction::ExecutionMode { - mode: - ExecutionMode::LocalSize { - x_size, - y_size, - z_size, + Instruction::Decorate { + target, + decoration: + Decoration::BuiltIn { + built_in: BuiltIn::WorkgroupSize, }, - .. - } => Some([x_size, y_size, z_size]), - Instruction::ExecutionModeId { - mode: - ExecutionMode::LocalSizeId { - x_size, - y_size, - z_size, - }, - .. - } => Some([x_size, y_size, z_size].map( - |id| match *spirv.id(id).instruction() { + } => { + let constituents: &[Id; 3] = match *spirv.id(target).instruction() { + Instruction::ConstantComposite { + ref constituents, .. + } => constituents.as_slice().try_into().unwrap(), + _ => unreachable!(), + }; + + let local_size = constituents.map(|id| match *spirv.id(id).instruction() { Instruction::Constant { ref value, .. } => { assert!(value.len() == 1); value[0] } _ => unreachable!(), - }, - )), + }); + + Some(local_size) + } _ => None, }) - }) - .unwrap_or_default(); + .or_else(|| { + entry_point_function + .execution_modes() + .iter() + .find_map(|instruction| match *instruction { + Instruction::ExecutionMode { + mode: + ExecutionMode::LocalSize { + x_size, + y_size, + z_size, + }, + .. + } => Some([x_size, y_size, z_size]), + Instruction::ExecutionModeId { + mode: + ExecutionMode::LocalSizeId { + x_size, + y_size, + z_size, + }, + .. + } => Some([x_size, y_size, z_size].map(|id| { + match *spirv.id(id).instruction() { + Instruction::Constant { ref value, .. } => { + assert_eq!(value.len(), 1); + value[0] + } + _ => unreachable!(), + } + })), + _ => None, + }) + }) + .unwrap_or_default(); let workgroup_size = local_size .into_iter() .try_fold(1, u32::checked_mul) diff --git a/vulkano/src/pipeline/shader/validate_runtime.rs b/vulkano/src/pipeline/shader/validate_runtime.rs index ea99842b..3ec4b557 100644 --- a/vulkano/src/pipeline/shader/validate_runtime.rs +++ b/vulkano/src/pipeline/shader/validate_runtime.rs @@ -1944,15 +1944,18 @@ impl<'a> RuntimeValidator<'a> { for instruction in self.spirv.function(function).instructions() { if let Some(pointer) = instruction.atomic_pointer_id() { - let (storage_class, ty) = - match (self.spirv.id(pointer).instruction().result_type_id()) - .map(|id| self.spirv.id(id).instruction()) - { - Some(&Instruction::TypePointer { - storage_class, ty, .. - }) => (storage_class, ty), - _ => unreachable!(), - }; + let (storage_class, ty) = match self + .spirv + .id(pointer) + .instruction() + .result_type_id() + .map(|id| self.spirv.id(id).instruction()) + { + Some(&Instruction::TypePointer { + storage_class, ty, .. + }) => (storage_class, ty), + _ => unreachable!(), + }; match *self.spirv.id(ty).instruction() { Instruction::TypeInt { width: 64, .. } => match storage_class { @@ -2462,9 +2465,10 @@ impl<'a> RuntimeValidator<'a> { if instruction.is_image_gather() { if let Some(image_operands) = instruction.image_operands() { - if let Some(components) = - (image_operands.const_offset.or(image_operands.offset)) - .and_then(|offset| get_constant_maybe_composite(self.spirv, offset)) + if let Some(components) = image_operands + .const_offset + .or(image_operands.offset) + .and_then(|offset| get_constant_maybe_composite(self.spirv, offset)) { for offset in components { if offset < properties.min_texel_gather_offset as u64 { @@ -2528,7 +2532,8 @@ impl<'a> RuntimeValidator<'a> { if instruction.is_image_sample() || instruction.is_image_fetch() { if let Some(image_operands) = instruction.image_operands() { - if let Some(components) = (image_operands.const_offset) + if let Some(components) = image_operands + .const_offset .and_then(|offset| get_constant_maybe_composite(self.spirv, offset)) { for offset in components { diff --git a/vulkano/src/query.rs b/vulkano/src/query.rs index 1aa21b83..a1d89371 100644 --- a/vulkano/src/query.rs +++ b/vulkano/src/query.rs @@ -651,7 +651,7 @@ vulkan_bitflags! { #[inline] pub const fn is_primitive_shading_graphics(self) -> bool { self.intersects( - (QueryPipelineStatisticFlags::INPUT_ASSEMBLY_VERTICES) + QueryPipelineStatisticFlags::INPUT_ASSEMBLY_VERTICES .union(QueryPipelineStatisticFlags::INPUT_ASSEMBLY_PRIMITIVES) .union(QueryPipelineStatisticFlags::VERTEX_SHADER_INVOCATIONS) .union(QueryPipelineStatisticFlags::GEOMETRY_SHADER_INVOCATIONS) @@ -668,7 +668,7 @@ vulkan_bitflags! { #[inline] pub const fn is_mesh_shading_graphics(self) -> bool { self.intersects( - (QueryPipelineStatisticFlags::TASK_SHADER_INVOCATIONS) + QueryPipelineStatisticFlags::TASK_SHADER_INVOCATIONS .union(QueryPipelineStatisticFlags::MESH_SHADER_INVOCATIONS), ) } diff --git a/vulkano/src/render_pass/framebuffer.rs b/vulkano/src/render_pass/framebuffer.rs index ca6687b0..9944aad0 100644 --- a/vulkano/src/render_pass/framebuffer.rs +++ b/vulkano/src/render_pass/framebuffer.rs @@ -547,7 +547,9 @@ impl FramebufferCreateInfo { match image_view.view_type() { ImageViewType::Dim2d | ImageViewType::Dim2dArray => { if image_view.image().image_type() == ImageType::Dim3d - && (image_view.format().aspects()) + && image_view + .format() + .aspects() .intersects(ImageAspects::DEPTH | ImageAspects::STENCIL) { return Err(Box::new(ValidationError { diff --git a/vulkano/src/render_pass/mod.rs b/vulkano/src/render_pass/mod.rs index 1d788e75..40adeaab 100644 --- a/vulkano/src/render_pass/mod.rs +++ b/vulkano/src/render_pass/mod.rs @@ -480,7 +480,8 @@ impl RenderPass { return false; } - if !(subpasses1.iter()) + if !subpasses1 + .iter() .zip(subpasses2.iter()) .all(|(subpass1, subpass2)| { let SubpassDescription { @@ -697,7 +698,10 @@ impl Subpass { let subpass_desc = self.subpass_desc(); // TODO: chain input attachments as well? - (subpass_desc.color_attachments.iter().flatten()) + subpass_desc + .color_attachments + .iter() + .flatten() .chain(subpass_desc.depth_stencil_attachment.iter()) .filter_map(|attachment_ref| { self.render_pass @@ -3261,8 +3265,8 @@ pub struct SubpassDependency { /// /// The default value is [`DependencyFlags::empty()`]. /// - /// [`BY_REGION`]: crate::sync::DependencyFlags::BY_REGION - /// [`VIEW_LOCAL`]: crate::sync::DependencyFlags::VIEW_LOCAL + /// [`BY_REGION`]: DependencyFlags::BY_REGION + /// [`VIEW_LOCAL`]: DependencyFlags::VIEW_LOCAL pub dependency_flags: DependencyFlags, /// If multiview rendering is being used (the subpasses have a nonzero `view_mask`), and @@ -3276,7 +3280,7 @@ pub struct SubpassDependency { /// /// The default value is `0`. /// - /// [`VIEW_LOCAL`]: crate::sync::DependencyFlags::VIEW_LOCAL + /// [`VIEW_LOCAL`]: DependencyFlags::VIEW_LOCAL pub view_offset: i32, pub _ne: crate::NonExhaustive, diff --git a/vulkano/src/shader/reflect.rs b/vulkano/src/shader/reflect.rs index 87743673..9c1e7c56 100644 --- a/vulkano/src/shader/reflect.rs +++ b/vulkano/src/shader/reflect.rs @@ -667,8 +667,8 @@ fn descriptor_binding_requirements_of(spirv: &Spirv, variable_id: Id) -> Descrip image_format, .. } => { - assert!( - sampled != 0, + assert_ne!( + sampled, 0, "Vulkan requires that variables of type OpTypeImage have a Sampled operand of \ 1 or 2", ); @@ -678,7 +678,7 @@ fn descriptor_binding_requirements_of(spirv: &Spirv, variable_id: Id) -> Descrip Instruction::TypeInt { width, signedness, .. } => { - assert!(width == 32); // TODO: 64-bit components + assert_eq!(width, 32); // TODO: 64-bit components match signedness { 0 => NumericType::Uint, 1 => NumericType::Int, @@ -686,7 +686,7 @@ fn descriptor_binding_requirements_of(spirv: &Spirv, variable_id: Id) -> Descrip } } Instruction::TypeFloat { width, .. } => { - assert!(width == 32); // TODO: 64-bit components + assert_eq!(width, 32); // TODO: 64-bit components NumericType::Float } _ => unreachable!(), @@ -698,8 +698,8 @@ fn descriptor_binding_requirements_of(spirv: &Spirv, variable_id: Id) -> Descrip reqs.image_format.is_none(), "If Dim is SubpassData, Image Format must be Unknown", ); - assert!(sampled == 2, "If Dim is SubpassData, Sampled must be 2"); - assert!(arrayed == 0, "If Dim is SubpassData, Arrayed must be 0"); + assert_eq!(sampled, 2, "If Dim is SubpassData, Sampled must be 2"); + assert_eq!(arrayed, 0, "If Dim is SubpassData, Arrayed must be 0"); reqs.descriptor_types = vec![DescriptorType::InputAttachment]; } @@ -991,9 +991,9 @@ pub(super) fn specialization_constants(spirv: &Spirv) -> HashMap { if width == 64 { - assert!(value.len() == 2); + assert_eq!(value.len(), 2); } else { - assert!(value.len() == 1); + assert_eq!(value.len(), 1); } match (signedness, width) { @@ -1014,9 +1014,9 @@ pub(super) fn specialization_constants(spirv: &Spirv) -> HashMap { if width == 64 { - assert!(value.len() == 2); + assert_eq!(value.len(), 2); } else { - assert!(value.len() == 1); + assert_eq!(value.len(), 1); } match width { @@ -1049,7 +1049,7 @@ pub(crate) fn size_of_type(spirv: &Spirv, id: Id) -> Option { Instruction::TypeVoid { .. } => Some(0), Instruction::TypeBool { .. } => Some(4), Instruction::TypeInt { width, .. } | Instruction::TypeFloat { width, .. } => { - assert!(width % 8 == 0); + assert_eq!(width % 8, 0); Some(width as DeviceSize / 8) } Instruction::TypePointer { diff --git a/vulkano/src/shader/spirv/mod.rs b/vulkano/src/shader/spirv/mod.rs index 95bf99cc..2fc6891a 100644 --- a/vulkano/src/shader/spirv/mod.rs +++ b/vulkano/src/shader/spirv/mod.rs @@ -298,7 +298,9 @@ impl Spirv { } => { let decorations = &decoration_groups[&decoration_group]; - (targets.iter().copied()) + targets + .iter() + .copied() .flat_map(|target| { decorations .iter() @@ -335,7 +337,9 @@ impl Spirv { } => { let decorations = &decoration_groups[&decoration_group]; - (targets.iter().copied()) + targets + .iter() + .copied() .flat_map(|target| { decorations .iter() diff --git a/vulkano/src/shader/spirv/specialization.rs b/vulkano/src/shader/spirv/specialization.rs index 1488b021..0f665699 100644 --- a/vulkano/src/shader/spirv/specialization.rs +++ b/vulkano/src/shader/spirv/specialization.rs @@ -165,9 +165,9 @@ pub(super) fn replace_specialization_instructions( width, signedness, .. } => { if width == 64 { - assert!(value.len() == 2); + assert_eq!(value.len(), 2); } else { - assert!(value.len() == 1); + assert_eq!(value.len(), 1); } match (signedness, width) { @@ -186,9 +186,9 @@ pub(super) fn replace_specialization_instructions( } Instruction::TypeFloat { width, .. } => { if width == 64 { - assert!(value.len() == 2); + assert_eq!(value.len(), 2); } else { - assert!(value.len() == 1); + assert_eq!(value.len(), 1); } match width { @@ -408,7 +408,9 @@ fn evaluate_spec_constant_op( let new_result_ids = std::iter::once(result_id).chain(new_ids.clone()); let new_constituent_ids = new_ids.chain(std::iter::once(object)); - let mut new_instructions: SmallVec<_> = (indexes.iter().copied()) + let mut new_instructions: SmallVec<_> = indexes + .iter() + .copied() .zip(new_result_ids.zip(new_constituent_ids)) .map(|(index, (new_result_id, new_constituent_id))| { let constant = &constants[&old_constituent_id]; @@ -448,19 +450,20 @@ fn evaluate_spec_constant_op( assert_eq!(conditions.len(), object_1.len()); assert_eq!(conditions.len(), object_2.len()); - let constituents: SmallVec<[Id; 4]> = - (conditions.iter().map(|c| constants[c].value.as_scalar())) - .zip(object_1.iter().zip(object_2.iter())) - .map( - |(condition, (&object_1, &object_2))| { - if condition != 0 { - object_1 - } else { - object_2 - } - }, - ) - .collect(); + let constituents: SmallVec<[Id; 4]> = conditions + .iter() + .map(|c| constants[c].value.as_scalar()) + .zip(object_1.iter().zip(object_2.iter())) + .map( + |(condition, (&object_1, &object_2))| { + if condition != 0 { + object_1 + } else { + object_2 + } + }, + ) + .collect(); smallvec![Instruction::ConstantComposite { result_type_id, @@ -547,7 +550,8 @@ fn evaluate_spec_constant_calculation_op( } (ConstantValue::Composite(constituents1), ConstantValue::Composite(constituents2)) => { assert_eq!(constituents1.len(), constituents2.len()); - (constituents1.iter()) + constituents1 + .iter() .zip(constituents2.iter()) .map(|(constituent1, constituent2)| { let operand1 = constants[constituent1].value.as_scalar(); diff --git a/vulkano/src/swapchain/mod.rs b/vulkano/src/swapchain/mod.rs index 2b2c7d0c..57550cc2 100644 --- a/vulkano/src/swapchain/mod.rs +++ b/vulkano/src/swapchain/mod.rs @@ -162,7 +162,7 @@ //! # } //! ``` //! -//! Then, call [`Swapchain::new`](crate::swapchain::Swapchain::new). +//! Then, call [`Swapchain::new`]. //! //! ```no_run //! # use std::{error::Error, sync::Arc}; @@ -578,7 +578,9 @@ impl Swapchain { .surface_capabilities_unchecked( surface, SurfaceInfo { - present_mode: (device.enabled_extensions().ext_swapchain_maintenance1) + present_mode: device + .enabled_extensions() + .ext_swapchain_maintenance1 .then_some(present_mode), full_screen_exclusive, win32_monitor: win32_monitor @@ -601,7 +603,9 @@ impl Swapchain { .surface_formats_unchecked( surface, SurfaceInfo { - present_mode: (device.enabled_extensions().ext_swapchain_maintenance1) + present_mode: device + .enabled_extensions() + .ext_swapchain_maintenance1 .then_some(present_mode), full_screen_exclusive, win32_monitor: win32_monitor.filter(|_| { diff --git a/vulkano/src/swapchain/surface.rs b/vulkano/src/swapchain/surface.rs index 5455956c..4af7e9f5 100644 --- a/vulkano/src/swapchain/surface.rs +++ b/vulkano/src/swapchain/surface.rs @@ -1809,7 +1809,7 @@ vulkan_enum! { /// Only `Fifo` is guaranteed to be supported on every device. For the others, you must call /// [`surface_present_modes`] to see if they are supported. /// - /// [`surface_present_modes`]: crate::device::physical::PhysicalDevice::surface_present_modes + /// [`surface_present_modes`]: PhysicalDevice::surface_present_modes PresentMode = PresentModeKHR(i32); /// The presentation engine holds only the currently displayed image. When presenting an image, @@ -2139,9 +2139,6 @@ vulkan_enum! { /// Parameters for [`PhysicalDevice::surface_capabilities`] and /// [`PhysicalDevice::surface_formats`]. -/// -/// [`PhysicalDevice::surface_capabilities`]: crate::device::physical::PhysicalDevice::surface_capabilities -/// [`PhysicalDevice::surface_formats`]: crate::device::physical::PhysicalDevice::surface_formats #[derive(Clone, Debug, PartialEq, Eq, Hash)] pub struct SurfaceInfo { /// If this is `Some`, the diff --git a/vulkano/src/sync/fence.rs b/vulkano/src/sync/fence.rs index 31b41316..aaa094c3 100644 --- a/vulkano/src/sync/fence.rs +++ b/vulkano/src/sync/fence.rs @@ -1169,7 +1169,7 @@ impl ImportFenceWin32HandleInfo { } /// The fence configuration to query in -/// [`PhysicalDevice::external_fence_properties`](crate::device::physical::PhysicalDevice::external_fence_properties). +/// [`PhysicalDevice::external_fence_properties`]. #[derive(Clone, Debug, PartialEq, Eq, Hash)] pub struct ExternalFenceInfo { /// The external handle type that will be used with the fence. diff --git a/vulkano/src/sync/future/join.rs b/vulkano/src/sync/future/join.rs index 9629143a..d52232b5 100644 --- a/vulkano/src/sync/future/join.rs +++ b/vulkano/src/sync/future/join.rs @@ -18,7 +18,7 @@ where assert_eq!(first.device().handle(), second.device().handle()); if !first.queue_change_allowed() && !second.queue_change_allowed() { - assert!(first.queue().unwrap() == second.queue().unwrap()); + assert_eq!(first.queue().unwrap(), second.queue().unwrap()); } JoinFuture { first, second } diff --git a/vulkano/src/sync/future/mod.rs b/vulkano/src/sync/future/mod.rs index faa16cb2..512430eb 100644 --- a/vulkano/src/sync/future/mod.rs +++ b/vulkano/src/sync/future/mod.rs @@ -2,7 +2,7 @@ //! //! Whenever you ask the GPU to start an operation by using a function of the vulkano library (for //! example executing a command buffer), this function will return a *future*. A future is an -//! object that implements [the `GpuFuture` trait](crate::sync::GpuFuture) and that represents the +//! object that implements [the `GpuFuture` trait](GpuFuture) and that represents the //! point in time when this operation is over. //! //! No function in vulkano immediately sends an operation to the GPU (with the exception of some diff --git a/vulkano/src/sync/pipeline.rs b/vulkano/src/sync/pipeline.rs index d1442e2f..854172c5 100644 --- a/vulkano/src/sync/pipeline.rs +++ b/vulkano/src/sync/pipeline.rs @@ -125,23 +125,19 @@ vulkan_bitflags_enum! { } if self.contains_flags2() { - if (self - PipelineStages::from(QueueFlags::GRAPHICS)).is_empty() { - return PipelineStages::ALL_GRAPHICS; + return if (self - PipelineStages::from(QueueFlags::GRAPHICS)).is_empty() { + PipelineStages::ALL_GRAPHICS } else { - return PipelineStages::ALL_COMMANDS; - } + PipelineStages::ALL_COMMANDS + }; } } - if self.validate_device(device).is_err() { - if (self - PipelineStages::from(QueueFlags::GRAPHICS)).is_empty() { - return PipelineStages::ALL_GRAPHICS; - } else { - return PipelineStages::ALL_COMMANDS; - } + match self.validate_device(device) { + Ok(_) => self, + Err(_) if (self - PipelineStages::from(QueueFlags::GRAPHICS)).is_empty() => PipelineStages::ALL_GRAPHICS, + Err(_) => PipelineStages::ALL_COMMANDS, } - - self } }, @@ -4082,7 +4078,6 @@ impl ImageMemoryBarrier { /// mentioned parameters do not match. /// /// [`Instance`]: crate::instance::Instance -/// [`Device`]: crate::device::Device /// [`device_uuid`]: crate::device::DeviceProperties::device_uuid /// [`driver_uuid`]: crate::device::DeviceProperties::driver_uuid #[derive(Clone, Copy, Debug)] diff --git a/vulkano/src/sync/semaphore.rs b/vulkano/src/sync/semaphore.rs index 7fbae9f5..45c708cd 100644 --- a/vulkano/src/sync/semaphore.rs +++ b/vulkano/src/sync/semaphore.rs @@ -1843,7 +1843,7 @@ impl ImportSemaphoreZirconHandleInfo { } /// The semaphore configuration to query in -/// [`PhysicalDevice::external_semaphore_properties`](crate::device::physical::PhysicalDevice::external_semaphore_properties). +/// [`PhysicalDevice::external_semaphore_properties`]. #[derive(Clone, Debug, PartialEq, Eq, Hash)] pub struct ExternalSemaphoreInfo { /// The external handle type that will be used with the semaphore.