diff --git a/examples/basic-compute-shader/main.rs b/examples/basic-compute-shader/main.rs index 1a1242a8..3662fb05 100644 --- a/examples/basic-compute-shader/main.rs +++ b/examples/basic-compute-shader/main.rs @@ -186,7 +186,7 @@ fn main() { // // If you want to run the pipeline on multiple different buffers, you need to create multiple // descriptor sets that each contain the buffer you want to run the shader on. - let layout = pipeline.layout().set_layouts().get(0).unwrap(); + let layout = &pipeline.layout().set_layouts()[0]; let set = DescriptorSet::new( descriptor_set_allocator, layout.clone(), diff --git a/examples/deferred/frame/ambient_lighting_system.rs b/examples/deferred/frame/ambient_lighting_system.rs index 7e8cb1ff..181fabec 100644 --- a/examples/deferred/frame/ambient_lighting_system.rs +++ b/examples/deferred/frame/ambient_lighting_system.rs @@ -168,7 +168,7 @@ impl AmbientLightingSystem { color: [ambient_color[0], ambient_color[1], ambient_color[2], 1.0], }; - let layout = self.pipeline.layout().set_layouts().get(0).unwrap(); + let layout = &self.pipeline.layout().set_layouts()[0]; let descriptor_set = DescriptorSet::new( self.descriptor_set_allocator.clone(), layout.clone(), diff --git a/examples/deferred/frame/directional_lighting_system.rs b/examples/deferred/frame/directional_lighting_system.rs index baa6dc47..525d762f 100644 --- a/examples/deferred/frame/directional_lighting_system.rs +++ b/examples/deferred/frame/directional_lighting_system.rs @@ -179,7 +179,7 @@ impl DirectionalLightingSystem { direction: direction.extend(0.0).into(), }; - let layout = self.pipeline.layout().set_layouts().get(0).unwrap(); + let layout = &self.pipeline.layout().set_layouts()[0]; let descriptor_set = DescriptorSet::new( self.descriptor_set_allocator.clone(), layout.clone(), diff --git a/examples/deferred/frame/mod.rs b/examples/deferred/frame/mod.rs index 4e69dc36..628f4492 100644 --- a/examples/deferred/frame/mod.rs +++ b/examples/deferred/frame/mod.rs @@ -5,7 +5,7 @@ use vulkano::{buffer::BufferContents, pipeline::graphics::vertex_input::Vertex}; -pub use self::system::{DrawPass, Frame, FrameSystem, LightingPass, Pass}; +pub use self::system::{FrameSystem, Pass}; mod ambient_lighting_system; mod directional_lighting_system; diff --git a/examples/deferred/frame/point_lighting_system.rs b/examples/deferred/frame/point_lighting_system.rs index 61906b9a..806bfb92 100644 --- a/examples/deferred/frame/point_lighting_system.rs +++ b/examples/deferred/frame/point_lighting_system.rs @@ -191,7 +191,7 @@ impl PointLightingSystem { position: position.extend(0.0).into(), }; - let layout = self.pipeline.layout().set_layouts().get(0).unwrap(); + let layout = &self.pipeline.layout().set_layouts()[0]; let descriptor_set = DescriptorSet::new( self.descriptor_set_allocator.clone(), layout.clone(), diff --git a/examples/dynamic-buffers/main.rs b/examples/dynamic-buffers/main.rs index 0965c514..8424171a 100644 --- a/examples/dynamic-buffers/main.rs +++ b/examples/dynamic-buffers/main.rs @@ -214,7 +214,7 @@ fn main() { ) .unwrap(); - let layout = pipeline.layout().set_layouts().get(0).unwrap(); + let layout = &pipeline.layout().set_layouts()[0]; let set = DescriptorSet::new( descriptor_set_allocator, layout.clone(), diff --git a/examples/dynamic-local-size/main.rs b/examples/dynamic-local-size/main.rs index 982789da..a87c46a3 100644 --- a/examples/dynamic-local-size/main.rs +++ b/examples/dynamic-local-size/main.rs @@ -225,7 +225,7 @@ fn main() { .unwrap(); let view = ImageView::new_default(image.clone()).unwrap(); - let layout = pipeline.layout().set_layouts().get(0).unwrap(); + let layout = &pipeline.layout().set_layouts()[0]; let set = DescriptorSet::new( descriptor_set_allocator, layout.clone(), diff --git a/examples/gl-interop/main.rs b/examples/gl-interop/main.rs index 920cbb33..339ed937 100644 --- a/examples/gl-interop/main.rs +++ b/examples/gl-interop/main.rs @@ -280,7 +280,7 @@ mod linux { Default::default(), )); - let layout = pipeline.layout().set_layouts().get(0).unwrap(); + let layout = &pipeline.layout().set_layouts()[0]; let set = DescriptorSet::new( descriptor_set_allocator, diff --git a/examples/image-self-copy-blit/main.rs b/examples/image-self-copy-blit/main.rs index 40e3e2fc..1dcf8630 100644 --- a/examples/image-self-copy-blit/main.rs +++ b/examples/image-self-copy-blit/main.rs @@ -387,7 +387,7 @@ fn main() -> Result<(), impl Error> { .unwrap() }; - let layout = pipeline.layout().set_layouts().get(0).unwrap(); + let layout = &pipeline.layout().set_layouts()[0]; let set = DescriptorSet::new( descriptor_set_allocator, layout.clone(), diff --git a/examples/image/main.rs b/examples/image/main.rs index 93b7201f..1fde1104 100644 --- a/examples/image/main.rs +++ b/examples/image/main.rs @@ -334,7 +334,7 @@ fn main() -> Result<(), impl Error> { .unwrap() }; - let layout = pipeline.layout().set_layouts().get(0).unwrap(); + let layout = &pipeline.layout().set_layouts()[0]; let set = DescriptorSet::new( descriptor_set_allocator, layout.clone(), diff --git a/examples/immutable-sampler/main.rs b/examples/immutable-sampler/main.rs index 7074ea00..85f75684 100644 --- a/examples/immutable-sampler/main.rs +++ b/examples/immutable-sampler/main.rs @@ -352,7 +352,7 @@ fn main() -> Result<(), impl Error> { .unwrap() }; - let layout = pipeline.layout().set_layouts().get(0).unwrap(); + let layout = &pipeline.layout().set_layouts()[0]; // Use `image_view` instead of `image_view_sampler`, since the sampler is already in the // layout. diff --git a/examples/indirect/main.rs b/examples/indirect/main.rs index 2b28081f..fd6ebf30 100644 --- a/examples/indirect/main.rs +++ b/examples/indirect/main.rs @@ -455,7 +455,7 @@ fn main() -> Result<(), impl Error> { } // Pass the two buffers to the compute shader. - let layout = compute_pipeline.layout().set_layouts().get(0).unwrap(); + let layout = &compute_pipeline.layout().set_layouts()[0]; let cs_desciptor_set = DescriptorSet::new( descriptor_set_allocator.clone(), layout.clone(), diff --git a/examples/interactive-fractal/fractal_compute_pipeline.rs b/examples/interactive-fractal/fractal_compute_pipeline.rs index 1603a304..e13ddb28 100644 --- a/examples/interactive-fractal/fractal_compute_pipeline.rs +++ b/examples/interactive-fractal/fractal_compute_pipeline.rs @@ -137,7 +137,7 @@ impl FractalComputePipeline { // Resize image if needed. let image_extent = image_view.image().extent(); let pipeline_layout = self.pipeline.layout(); - let desc_layout = pipeline_layout.set_layouts().get(0).unwrap(); + let desc_layout = &pipeline_layout.set_layouts()[0]; let set = DescriptorSet::new( self.descriptor_set_allocator.clone(), desc_layout.clone(), diff --git a/examples/interactive-fractal/pixels_draw_pipeline.rs b/examples/interactive-fractal/pixels_draw_pipeline.rs index 7f1f0e28..77b11439 100644 --- a/examples/interactive-fractal/pixels_draw_pipeline.rs +++ b/examples/interactive-fractal/pixels_draw_pipeline.rs @@ -174,7 +174,7 @@ impl PixelsDrawPipeline { } fn create_descriptor_set(&self, image: Arc) -> Arc { - let layout = self.pipeline.layout().set_layouts().get(0).unwrap(); + let layout = &self.pipeline.layout().set_layouts()[0]; let sampler = Sampler::new( self.gfx_queue.device().clone(), SamplerCreateInfo { diff --git a/examples/multi-window-game-of-life/game_of_life.rs b/examples/multi-window-game-of-life/game_of_life.rs index 764a3d9d..0a525694 100644 --- a/examples/multi-window-game-of-life/game_of_life.rs +++ b/examples/multi-window-game-of-life/game_of_life.rs @@ -176,7 +176,7 @@ impl GameOfLifeComputePipeline { // Resize image if needed. let image_extent = self.image.image().extent(); let pipeline_layout = self.compute_life_pipeline.layout(); - let desc_layout = pipeline_layout.set_layouts().get(0).unwrap(); + let desc_layout = &pipeline_layout.set_layouts()[0]; let set = DescriptorSet::new( self.descriptor_set_allocator.clone(), desc_layout.clone(), diff --git a/examples/multi-window-game-of-life/pixels_draw.rs b/examples/multi-window-game-of-life/pixels_draw.rs index 07cc3cf4..cbd655c9 100644 --- a/examples/multi-window-game-of-life/pixels_draw.rs +++ b/examples/multi-window-game-of-life/pixels_draw.rs @@ -170,7 +170,7 @@ impl PixelsDrawPipeline { } fn create_image_sampler_nearest(&self, image: Arc) -> Arc { - let layout = self.pipeline.layout().set_layouts().get(0).unwrap(); + let layout = &self.pipeline.layout().set_layouts()[0]; let sampler = Sampler::new( self.gfx_queue.device().clone(), SamplerCreateInfo { diff --git a/examples/push-constants/main.rs b/examples/push-constants/main.rs index f7f22d14..343747fc 100644 --- a/examples/push-constants/main.rs +++ b/examples/push-constants/main.rs @@ -158,7 +158,7 @@ fn main() { ) .unwrap(); - let layout = pipeline.layout().set_layouts().get(0).unwrap(); + let layout = &pipeline.layout().set_layouts()[0]; let set = DescriptorSet::new( descriptor_set_allocator, layout.clone(), diff --git a/examples/runtime-array/main.rs b/examples/runtime-array/main.rs index e94fd5ba..2d55ea1f 100644 --- a/examples/runtime-array/main.rs +++ b/examples/runtime-array/main.rs @@ -454,7 +454,7 @@ fn main() -> Result<(), impl Error> { .unwrap() }; - let layout = pipeline.layout().set_layouts().get(0).unwrap(); + let layout = &pipeline.layout().set_layouts()[0]; let set = DescriptorSet::new_variable( descriptor_set_allocator, layout.clone(), diff --git a/examples/self-copy-buffer/main.rs b/examples/self-copy-buffer/main.rs index af0bf6ca..0779f114 100644 --- a/examples/self-copy-buffer/main.rs +++ b/examples/self-copy-buffer/main.rs @@ -153,7 +153,7 @@ fn main() { ) .unwrap(); - let layout = pipeline.layout().set_layouts().get(0).unwrap(); + let layout = &pipeline.layout().set_layouts()[0]; let set = DescriptorSet::new( descriptor_set_allocator, layout.clone(), diff --git a/examples/shader-include/main.rs b/examples/shader-include/main.rs index 3173bed4..6fc5f5c1 100644 --- a/examples/shader-include/main.rs +++ b/examples/shader-include/main.rs @@ -158,7 +158,7 @@ fn main() { ) .unwrap(); - let layout = pipeline.layout().set_layouts().get(0).unwrap(); + let layout = &pipeline.layout().set_layouts()[0]; let set = DescriptorSet::new( descriptor_set_allocator, layout.clone(), diff --git a/examples/shader-types-sharing/main.rs b/examples/shader-types-sharing/main.rs index c91b55e2..04746964 100644 --- a/examples/shader-types-sharing/main.rs +++ b/examples/shader-types-sharing/main.rs @@ -184,7 +184,7 @@ fn main() { descriptor_set_allocator: Arc, command_buffer_allocator: Arc, ) { - let layout = pipeline.layout().set_layouts().get(0).unwrap(); + let layout = &pipeline.layout().set_layouts()[0]; let set = DescriptorSet::new( descriptor_set_allocator, layout.clone(), diff --git a/examples/simple-particles/main.rs b/examples/simple-particles/main.rs index 87298f05..09ef07d7 100644 --- a/examples/simple-particles/main.rs +++ b/examples/simple-particles/main.rs @@ -440,13 +440,8 @@ fn main() -> Result<(), impl Error> { use vulkano::pipeline::Pipeline; // Required to access the `layout` method of pipeline. let descriptor_set = DescriptorSet::new( descriptor_set_allocator.clone(), - compute_pipeline - .layout() - .set_layouts() - // 0 is the index of the descriptor set. - .get(0) - .unwrap() - .clone(), + // 0 is the index of the descriptor set. + compute_pipeline.layout().set_layouts()[0].clone(), [ // 0 is the binding of the data in this set. We bind the `Buffer` of vertices here. WriteDescriptorSet::buffer(0, vertex_buffer.clone()), diff --git a/examples/specialization-constants/main.rs b/examples/specialization-constants/main.rs index 5dc86bd7..59b20b8c 100644 --- a/examples/specialization-constants/main.rs +++ b/examples/specialization-constants/main.rs @@ -159,7 +159,7 @@ fn main() { ) .unwrap(); - let layout = pipeline.layout().set_layouts().get(0).unwrap(); + let layout = &pipeline.layout().set_layouts()[0]; let set = DescriptorSet::new( descriptor_set_allocator, layout.clone(), diff --git a/examples/teapot/main.rs b/examples/teapot/main.rs index fdc35c92..b9a53484 100644 --- a/examples/teapot/main.rs +++ b/examples/teapot/main.rs @@ -342,7 +342,7 @@ fn main() -> Result<(), impl Error> { subbuffer }; - let layout = pipeline.layout().set_layouts().get(0).unwrap(); + let layout = &pipeline.layout().set_layouts()[0]; let set = DescriptorSet::new( descriptor_set_allocator.clone(), layout.clone(), diff --git a/examples/texture-array/main.rs b/examples/texture-array/main.rs index 0b510e31..49738d3e 100644 --- a/examples/texture-array/main.rs +++ b/examples/texture-array/main.rs @@ -345,7 +345,7 @@ fn main() -> Result<(), impl Error> { .unwrap() }; - let layout = pipeline.layout().set_layouts().get(0).unwrap(); + let layout = &pipeline.layout().set_layouts()[0]; let set = DescriptorSet::new( descriptor_set_allocator, layout.clone(), diff --git a/vulkano-shaders/src/codegen.rs b/vulkano-shaders/src/codegen.rs index 038cc19c..91561ad1 100644 --- a/vulkano-shaders/src/codegen.rs +++ b/vulkano-shaders/src/codegen.rs @@ -550,7 +550,7 @@ mod tests { } // Check first entrypoint - let e1_descriptors = descriptors.get(0).expect("could not find entrypoint1"); + let e1_descriptors = &descriptors[0]; let mut e1_bindings = Vec::new(); for loc in e1_descriptors.keys() { e1_bindings.push(*loc); @@ -564,7 +564,7 @@ mod tests { assert!(e1_bindings.contains(&(0, 4))); // Check second entrypoint - let e2_descriptors = descriptors.get(1).expect("could not find entrypoint2"); + let e2_descriptors = &descriptors[1]; let mut e2_bindings = Vec::new(); for loc in e2_descriptors.keys() { e2_bindings.push(*loc); diff --git a/vulkano/src/command_buffer/mod.rs b/vulkano/src/command_buffer/mod.rs index 66c3bb53..2a227ebd 100644 --- a/vulkano/src/command_buffer/mod.rs +++ b/vulkano/src/command_buffer/mod.rs @@ -94,12 +94,13 @@ //! [`end`]: RecordingCommandBuffer::end //! [`GpuFuture`]: crate::sync::GpuFuture +#[allow(unused_imports)] // everything is exported for future-proofing +pub use self::commands::{ + acceleration_structure::*, clear::*, copy::*, debug::*, dynamic_state::*, pipeline::*, + query::*, render_pass::*, secondary::*, sync::*, +}; pub use self::{ auto::{CommandBuffer, RecordingCommandBuffer}, - commands::{ - acceleration_structure::*, clear::*, copy::*, debug::*, dynamic_state::*, pipeline::*, - query::*, render_pass::*, secondary::*, sync::*, - }, sys::CommandBufferBeginInfo, traits::{CommandBufferExecError, CommandBufferExecFuture}, }; diff --git a/vulkano/src/device/mod.rs b/vulkano/src/device/mod.rs index 715dc71c..04046b5a 100644 --- a/vulkano/src/device/mod.rs +++ b/vulkano/src/device/mod.rs @@ -1844,7 +1844,7 @@ mod tests { #[test] fn empty_extensions() { let d: Vec = (&DeviceExtensions::empty()).into(); - assert!(d.get(0).is_none()); + assert!(d.is_empty()); } #[test] diff --git a/vulkano/src/device/physical.rs b/vulkano/src/device/physical.rs index 57cfae5c..732e8cbe 100644 --- a/vulkano/src/device/physical.rs +++ b/vulkano/src/device/physical.rs @@ -153,7 +153,7 @@ impl PhysicalDevice { let fns = instance.fns(); let mut output = MaybeUninit::uninit(); (fns.v1_0.get_physical_device_properties)(handle, output.as_mut_ptr()); - let api_version = Version::try_from(output.assume_init().api_version).unwrap(); + let api_version = Version::from(output.assume_init().api_version); std::cmp::min(instance.max_api_version(), api_version) } diff --git a/vulkano/src/device/properties.rs b/vulkano/src/device/properties.rs index 85e189ce..5e733c93 100644 --- a/vulkano/src/device/properties.rs +++ b/vulkano/src/device/properties.rs @@ -114,7 +114,7 @@ impl FromVulkan<[c_char; N]> for String { impl FromVulkan for Version { #[inline] fn from_vulkan(val: u32) -> Option { - val.try_into().ok() + Some(val.into()) } } diff --git a/vulkano/src/instance/mod.rs b/vulkano/src/instance/mod.rs index d6ff16ab..a9d13295 100644 --- a/vulkano/src/instance/mod.rs +++ b/vulkano/src/instance/mod.rs @@ -1239,7 +1239,7 @@ mod tests { #[test] fn empty_extensions() { let i: Vec = (&InstanceExtensions::empty()).into(); - assert!(i.get(0).is_none()); + assert!(i.is_empty()); } #[test] diff --git a/vulkano/src/pipeline/compute.rs b/vulkano/src/pipeline/compute.rs index 7964eca5..87526f0d 100644 --- a/vulkano/src/pipeline/compute.rs +++ b/vulkano/src/pipeline/compute.rs @@ -547,7 +547,7 @@ mod tests { )); let set = DescriptorSet::new( ds_allocator, - pipeline.layout().set_layouts().get(0).unwrap().clone(), + pipeline.layout().set_layouts()[0].clone(), [WriteDescriptorSet::buffer(0, data_buffer.clone())], [], ) @@ -702,7 +702,7 @@ mod tests { )); let set = DescriptorSet::new( ds_allocator, - pipeline.layout().set_layouts().get(0).unwrap().clone(), + pipeline.layout().set_layouts()[0].clone(), [WriteDescriptorSet::buffer(0, data_buffer.clone())], [], ) diff --git a/vulkano/src/pipeline/layout.rs b/vulkano/src/pipeline/layout.rs index b926eeb0..d65a4057 100644 --- a/vulkano/src/pipeline/layout.rs +++ b/vulkano/src/pipeline/layout.rs @@ -686,7 +686,7 @@ impl PipelineLayoutCreateInfo { let mut total_descriptors_not_uab = [0; TOTAL_DESCRIPTOR_LIMITS.len()]; let mut has_push_descriptor_set = false; - for (_set_num, set_layout) in set_layouts.iter().enumerate() { + for set_layout in set_layouts { assert_eq!(device, set_layout.device().as_ref()); if set_layout