Fix warnings for Rust 1.75 (#2436)

This commit is contained in:
Rua 2023-12-28 20:32:13 +01:00 committed by GitHub
parent 2bbd4eff69
commit bef7b94aef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 40 additions and 44 deletions

View File

@ -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(),

View File

@ -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(),

View File

@ -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(),

View File

@ -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;

View File

@ -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(),

View File

@ -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(),

View File

@ -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(),

View File

@ -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,

View File

@ -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(),

View File

@ -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(),

View File

@ -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.

View File

@ -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(),

View File

@ -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(),

View File

@ -174,7 +174,7 @@ impl PixelsDrawPipeline {
}
fn create_descriptor_set(&self, image: Arc<ImageView>) -> Arc<DescriptorSet> {
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 {

View File

@ -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(),

View File

@ -170,7 +170,7 @@ impl PixelsDrawPipeline {
}
fn create_image_sampler_nearest(&self, image: Arc<ImageView>) -> Arc<DescriptorSet> {
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 {

View File

@ -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(),

View File

@ -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(),

View File

@ -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(),

View File

@ -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(),

View File

@ -184,7 +184,7 @@ fn main() {
descriptor_set_allocator: Arc<StandardDescriptorSetAllocator>,
command_buffer_allocator: Arc<StandardCommandBufferAllocator>,
) {
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(),

View File

@ -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()),

View File

@ -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(),

View File

@ -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(),

View File

@ -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(),

View File

@ -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);

View File

@ -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},
};

View File

@ -1844,7 +1844,7 @@ mod tests {
#[test]
fn empty_extensions() {
let d: Vec<CString> = (&DeviceExtensions::empty()).into();
assert!(d.get(0).is_none());
assert!(d.is_empty());
}
#[test]

View File

@ -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)
}

View File

@ -114,7 +114,7 @@ impl<const N: usize> FromVulkan<[c_char; N]> for String {
impl FromVulkan<u32> for Version {
#[inline]
fn from_vulkan(val: u32) -> Option<Self> {
val.try_into().ok()
Some(val.into())
}
}

View File

@ -1239,7 +1239,7 @@ mod tests {
#[test]
fn empty_extensions() {
let i: Vec<CString> = (&InstanceExtensions::empty()).into();
assert!(i.get(0).is_none());
assert!(i.is_empty());
}
#[test]

View File

@ -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())],
[],
)

View File

@ -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