mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-21 22:34:43 +00:00
Fix or allow all Clippy errors, re-enable dead code and unused variable warnings (#1953)
This commit is contained in:
parent
604c154d63
commit
f0e6e4c6b7
@ -137,7 +137,7 @@ fn main() {
|
||||
// We start by creating the buffer that will store the data.
|
||||
let data_buffer = {
|
||||
// Iterator that produces the data.
|
||||
let data_iter = (0..65536u32).map(|n| n);
|
||||
let data_iter = 0..65536u32;
|
||||
// Builds the buffer and fills it with this iterator.
|
||||
CpuAccessibleBuffer::from_iter(
|
||||
device.clone(),
|
||||
@ -186,7 +186,7 @@ fn main() {
|
||||
PipelineBindPoint::Compute,
|
||||
pipeline.layout().clone(),
|
||||
0,
|
||||
set.clone(),
|
||||
set,
|
||||
)
|
||||
.dispatch([1024, 1, 1])
|
||||
.unwrap();
|
||||
@ -195,8 +195,8 @@ fn main() {
|
||||
|
||||
// Let's execute this command buffer now.
|
||||
// To do so, we TODO: this is a bit clumsy, probably needs a shortcut
|
||||
let future = sync::now(device.clone())
|
||||
.then_execute(queue.clone(), command_buffer)
|
||||
let future = sync::now(device)
|
||||
.then_execute(queue, command_buffer)
|
||||
.unwrap()
|
||||
// This line instructs the GPU to signal a *fence* once the command buffer has finished
|
||||
// execution. A fence is a Vulkan object that allows the CPU to know when the GPU has
|
||||
|
@ -53,8 +53,8 @@ fn main() {
|
||||
// and you should verify that list for safety - Vulkano will return an error if you specify
|
||||
// any layers that are not installed on this system. That code to do could look like this:
|
||||
println!("List of Vulkan debugging layers available to use:");
|
||||
let mut layers = library.layer_properties().unwrap();
|
||||
while let Some(l) = layers.next() {
|
||||
let layers = library.layer_properties().unwrap();
|
||||
for l in layers {
|
||||
println!("\t{}", l.name());
|
||||
}
|
||||
|
||||
@ -140,13 +140,11 @@ fn main() {
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| p.supported_extensions().is_superset_of(&device_extensions))
|
||||
.filter_map(|p| {
|
||||
Some(
|
||||
p.queue_families()
|
||||
.next()
|
||||
.map(|q| (p, q))
|
||||
.expect("couldn't find a queue family"),
|
||||
)
|
||||
.map(|p| {
|
||||
p.queue_families()
|
||||
.next()
|
||||
.map(|q| (p, q))
|
||||
.expect("couldn't find a queue family")
|
||||
})
|
||||
.min_by_key(|(p, _)| match p.properties().device_type {
|
||||
PhysicalDeviceType::DiscreteGpu => 0,
|
||||
@ -181,7 +179,7 @@ fn main() {
|
||||
dimensions,
|
||||
MipmapsCount::One,
|
||||
pixel_format,
|
||||
queue.clone(),
|
||||
queue,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
|
@ -144,7 +144,7 @@ impl AmbientLightingSystem {
|
||||
)
|
||||
.unwrap();
|
||||
builder
|
||||
.set_viewport(0, [viewport.clone()])
|
||||
.set_viewport(0, [viewport])
|
||||
.bind_pipeline_graphics(self.pipeline.clone())
|
||||
.bind_descriptor_sets(
|
||||
PipelineBindPoint::Graphics,
|
||||
|
@ -158,7 +158,7 @@ impl DirectionalLightingSystem {
|
||||
)
|
||||
.unwrap();
|
||||
builder
|
||||
.set_viewport(0, [viewport.clone()])
|
||||
.set_viewport(0, [viewport])
|
||||
.bind_pipeline_graphics(self.pipeline.clone())
|
||||
.bind_descriptor_sets(
|
||||
PipelineBindPoint::Graphics,
|
||||
|
@ -126,6 +126,7 @@ impl PointLightingSystem {
|
||||
/// - `position` is the position of the spot light in world coordinates.
|
||||
/// - `color` is the color of the light.
|
||||
///
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn draw(
|
||||
&self,
|
||||
viewport_dimensions: [u32; 2],
|
||||
@ -170,7 +171,7 @@ impl PointLightingSystem {
|
||||
)
|
||||
.unwrap();
|
||||
builder
|
||||
.set_viewport(0, [viewport.clone()])
|
||||
.set_viewport(0, [viewport])
|
||||
.bind_pipeline_graphics(self.pipeline.clone())
|
||||
.bind_descriptor_sets(
|
||||
PipelineBindPoint::Graphics,
|
||||
|
@ -141,7 +141,7 @@ fn main() {
|
||||
.unwrap();
|
||||
let images = images
|
||||
.into_iter()
|
||||
.map(|image| ImageView::new_default(image.clone()).unwrap())
|
||||
.map(|image| ImageView::new_default(image).unwrap())
|
||||
.collect::<Vec<_>>();
|
||||
(swapchain, images)
|
||||
};
|
||||
@ -186,7 +186,7 @@ fn main() {
|
||||
};
|
||||
let new_images = new_images
|
||||
.into_iter()
|
||||
.map(|image| ImageView::new_default(image.clone()).unwrap())
|
||||
.map(|image| ImageView::new_default(image).unwrap())
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
swapchain = new_swapchain;
|
||||
|
@ -14,7 +14,7 @@
|
||||
// offset into the buffer to read object data from, without having to
|
||||
// rebind descriptor sets.
|
||||
|
||||
use std::mem::size_of;
|
||||
use std::{iter::repeat, mem::size_of};
|
||||
use vulkano::{
|
||||
buffer::{BufferUsage, CpuAccessibleBuffer},
|
||||
command_buffer::{AutoCommandBufferBuilder, CommandBufferUsage},
|
||||
@ -139,16 +139,14 @@ fn main() {
|
||||
let align = (size_of::<u32>() + min_dynamic_align - 1) & !(min_dynamic_align - 1);
|
||||
let aligned_data = {
|
||||
let mut aligned_data = Vec::with_capacity(align * data.len());
|
||||
for i in 0..data.len() {
|
||||
let bytes = data[i].to_ne_bytes();
|
||||
for elem in data {
|
||||
let bytes = elem.to_ne_bytes();
|
||||
// Fill up the buffer with data
|
||||
for bi in 0..bytes.len() {
|
||||
aligned_data.push(bytes[bi]);
|
||||
for b in bytes {
|
||||
aligned_data.push(b);
|
||||
}
|
||||
// Zero out any padding needed for alignment
|
||||
for _ in 0..align - bytes.len() {
|
||||
aligned_data.push(0);
|
||||
}
|
||||
aligned_data.extend(repeat(0).take(align - bytes.len()));
|
||||
}
|
||||
aligned_data
|
||||
};
|
||||
@ -173,7 +171,7 @@ fn main() {
|
||||
let set = PersistentDescriptorSet::new(
|
||||
layout.clone(),
|
||||
[
|
||||
WriteDescriptorSet::buffer(0, input_buffer.clone()),
|
||||
WriteDescriptorSet::buffer(0, input_buffer),
|
||||
WriteDescriptorSet::buffer(1, output_buffer.clone()),
|
||||
],
|
||||
)
|
||||
@ -186,6 +184,8 @@ fn main() {
|
||||
CommandBufferUsage::OneTimeSubmit,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
#[allow(clippy::erasing_op, clippy::identity_op)]
|
||||
builder
|
||||
.bind_pipeline_compute(pipeline.clone())
|
||||
.bind_descriptor_sets(
|
||||
@ -208,14 +208,14 @@ fn main() {
|
||||
PipelineBindPoint::Compute,
|
||||
pipeline.layout().clone(),
|
||||
0,
|
||||
set.clone().offsets([2 * align as u32]),
|
||||
set.offsets([2 * align as u32]),
|
||||
)
|
||||
.dispatch([12, 1, 1])
|
||||
.unwrap();
|
||||
let command_buffer = builder.build().unwrap();
|
||||
|
||||
let future = sync::now(device.clone())
|
||||
.then_execute(queue.clone(), command_buffer)
|
||||
let future = sync::now(device)
|
||||
.then_execute(queue, command_buffer)
|
||||
.unwrap()
|
||||
.then_signal_fence_and_flush()
|
||||
.unwrap();
|
||||
|
@ -201,11 +201,9 @@ fn main() {
|
||||
let view = ImageView::new_default(image.clone()).unwrap();
|
||||
|
||||
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
||||
let set = PersistentDescriptorSet::new(
|
||||
layout.clone(),
|
||||
[WriteDescriptorSet::image_view(0, view.clone())],
|
||||
)
|
||||
.unwrap();
|
||||
let set =
|
||||
PersistentDescriptorSet::new(layout.clone(), [WriteDescriptorSet::image_view(0, view)])
|
||||
.unwrap();
|
||||
|
||||
let buf = CpuAccessibleBuffer::from_iter(
|
||||
device.clone(),
|
||||
@ -227,7 +225,7 @@ fn main() {
|
||||
PipelineBindPoint::Compute,
|
||||
pipeline.layout().clone(),
|
||||
0,
|
||||
set.clone(),
|
||||
set,
|
||||
)
|
||||
.dispatch([
|
||||
1024 / local_size_x, // Note that dispatch dimensions must be
|
||||
@ -235,15 +233,12 @@ fn main() {
|
||||
1,
|
||||
])
|
||||
.unwrap()
|
||||
.copy_image_to_buffer(CopyImageToBufferInfo::image_buffer(
|
||||
image.clone(),
|
||||
buf.clone(),
|
||||
))
|
||||
.copy_image_to_buffer(CopyImageToBufferInfo::image_buffer(image, buf.clone()))
|
||||
.unwrap();
|
||||
let command_buffer = builder.build().unwrap();
|
||||
|
||||
let future = sync::now(device.clone())
|
||||
.then_execute(queue.clone(), command_buffer)
|
||||
let future = sync::now(device)
|
||||
.then_execute(queue, command_buffer)
|
||||
.unwrap()
|
||||
.then_signal_fence_and_flush()
|
||||
.unwrap();
|
||||
@ -255,7 +250,7 @@ fn main() {
|
||||
let buffer_content = buf.read().unwrap();
|
||||
let path = Path::new("mandelbrot.png");
|
||||
let file = File::create(path).unwrap();
|
||||
let ref mut w = BufWriter::new(file);
|
||||
let w = &mut BufWriter::new(file);
|
||||
let mut encoder = png::Encoder::new(w, 1024, 1024);
|
||||
encoder.set_color(png::ColorType::Rgba);
|
||||
encoder.set_depth(png::BitDepth::Eight);
|
||||
|
@ -212,9 +212,7 @@ mod linux {
|
||||
let set = PersistentDescriptorSet::new(
|
||||
layout.clone(),
|
||||
[WriteDescriptorSet::image_view_sampler(
|
||||
0,
|
||||
image_view,
|
||||
sampler.clone(),
|
||||
0, image_view, sampler,
|
||||
)],
|
||||
)
|
||||
.unwrap();
|
||||
@ -363,6 +361,7 @@ mod linux {
|
||||
}
|
||||
impl_vertex!(Vertex, position);
|
||||
|
||||
#[allow(clippy::type_complexity)]
|
||||
fn vk_setup(
|
||||
display: glium::HeadlessRenderer,
|
||||
) -> (
|
||||
|
@ -319,11 +319,7 @@ fn main() {
|
||||
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
||||
let set = PersistentDescriptorSet::new(
|
||||
layout.clone(),
|
||||
[WriteDescriptorSet::image_view_sampler(
|
||||
0,
|
||||
texture.clone(),
|
||||
sampler.clone(),
|
||||
)],
|
||||
[WriteDescriptorSet::image_view_sampler(0, texture, sampler)],
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
|
@ -239,11 +239,7 @@ fn main() {
|
||||
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
||||
let set = PersistentDescriptorSet::new(
|
||||
layout.clone(),
|
||||
[WriteDescriptorSet::image_view_sampler(
|
||||
0,
|
||||
texture.clone(),
|
||||
sampler.clone(),
|
||||
)],
|
||||
[WriteDescriptorSet::image_view_sampler(0, texture, sampler)],
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
|
@ -250,11 +250,9 @@ fn main() {
|
||||
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
||||
|
||||
// Use `image_view` instead of `image_view_sampler`, since the sampler is already in the layout.
|
||||
let set = PersistentDescriptorSet::new(
|
||||
layout.clone(),
|
||||
[WriteDescriptorSet::image_view(0, texture.clone())],
|
||||
)
|
||||
.unwrap();
|
||||
let set =
|
||||
PersistentDescriptorSet::new(layout.clone(), [WriteDescriptorSet::image_view(0, texture)])
|
||||
.unwrap();
|
||||
|
||||
let mut viewport = Viewport {
|
||||
origin: [0.0, 0.0],
|
||||
|
@ -385,7 +385,7 @@ fn main() {
|
||||
PipelineBindPoint::Compute,
|
||||
compute_pipeline.layout().clone(),
|
||||
0,
|
||||
cs_desciptor_set.clone(),
|
||||
cs_desciptor_set,
|
||||
)
|
||||
.dispatch([1, 1, 1])
|
||||
.unwrap()
|
||||
@ -401,8 +401,8 @@ fn main() {
|
||||
// contain the arguments when the draw is executed on the GPU
|
||||
.set_viewport(0, [viewport.clone()])
|
||||
.bind_pipeline_graphics(render_pipeline.clone())
|
||||
.bind_vertex_buffers(0, vertices.clone())
|
||||
.draw_indirect(indirect_buffer.clone())
|
||||
.bind_vertex_buffers(0, vertices)
|
||||
.draw_indirect(indirect_buffer)
|
||||
.unwrap()
|
||||
.end_render_pass()
|
||||
.unwrap();
|
||||
|
@ -329,9 +329,8 @@ 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) {
|
||||
match mouse_btn {
|
||||
MouseButton::Right => self.toggle_c = state_is_pressed(state),
|
||||
_ => (),
|
||||
};
|
||||
if mouse_btn == MouseButton::Right {
|
||||
self.toggle_c = state_is_pressed(state)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ impl FractalComputePipeline {
|
||||
let set = PersistentDescriptorSet::new(
|
||||
desc_layout.clone(),
|
||||
[
|
||||
WriteDescriptorSet::image_view(0, image.clone()),
|
||||
WriteDescriptorSet::image_view(0, image),
|
||||
WriteDescriptorSet::buffer(1, self.palette.clone()),
|
||||
],
|
||||
)
|
||||
|
@ -144,7 +144,7 @@ fn compute_then_render(
|
||||
// Start frame
|
||||
let before_pipeline_future = match renderer.acquire() {
|
||||
Err(e) => {
|
||||
println!("{}", e.to_string());
|
||||
println!("{}", e);
|
||||
return;
|
||||
}
|
||||
Ok(future) => future,
|
||||
|
@ -214,7 +214,7 @@ fn main() {
|
||||
let framebuffer = Framebuffer::new(
|
||||
render_pass.clone(),
|
||||
FramebufferCreateInfo {
|
||||
attachments: vec![intermediary.clone(), view.clone()],
|
||||
attachments: vec![intermediary, view],
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
@ -281,7 +281,7 @@ fn main() {
|
||||
CpuAccessibleBuffer::from_iter(device.clone(), BufferUsage::all(), false, vertices)
|
||||
.unwrap();
|
||||
|
||||
let subpass = Subpass::from(render_pass.clone(), 0).unwrap();
|
||||
let subpass = Subpass::from(render_pass, 0).unwrap();
|
||||
let pipeline = GraphicsPipeline::start()
|
||||
.vertex_input_state(BuffersDefinition::new().vertex::<Vertex>())
|
||||
.vertex_shader(vs.entry_point("main").unwrap(), ())
|
||||
@ -310,7 +310,7 @@ fn main() {
|
||||
.unwrap();
|
||||
|
||||
let mut builder = AutoCommandBufferBuilder::primary(
|
||||
device.clone(),
|
||||
device,
|
||||
queue.family(),
|
||||
CommandBufferUsage::OneTimeSubmit,
|
||||
)
|
||||
@ -319,26 +319,23 @@ fn main() {
|
||||
.begin_render_pass(
|
||||
RenderPassBeginInfo {
|
||||
clear_values: vec![Some([0.0, 0.0, 1.0, 1.0].into()), None],
|
||||
..RenderPassBeginInfo::framebuffer(framebuffer.clone())
|
||||
..RenderPassBeginInfo::framebuffer(framebuffer)
|
||||
},
|
||||
SubpassContents::Inline,
|
||||
)
|
||||
.unwrap()
|
||||
.set_viewport(0, [viewport.clone()])
|
||||
.bind_pipeline_graphics(pipeline.clone())
|
||||
.set_viewport(0, [viewport])
|
||||
.bind_pipeline_graphics(pipeline)
|
||||
.bind_vertex_buffers(0, vertex_buffer.clone())
|
||||
.draw(vertex_buffer.len() as u32, 1, 0, 0)
|
||||
.unwrap()
|
||||
.end_render_pass()
|
||||
.unwrap()
|
||||
.copy_image_to_buffer(CopyImageToBufferInfo::image_buffer(
|
||||
image.clone(),
|
||||
buf.clone(),
|
||||
))
|
||||
.copy_image_to_buffer(CopyImageToBufferInfo::image_buffer(image, buf.clone()))
|
||||
.unwrap();
|
||||
let command_buffer = builder.build().unwrap();
|
||||
|
||||
let finished = command_buffer.execute(queue.clone()).unwrap();
|
||||
let finished = command_buffer.execute(queue).unwrap();
|
||||
finished
|
||||
.then_signal_fence_and_flush()
|
||||
.unwrap()
|
||||
@ -348,7 +345,7 @@ fn main() {
|
||||
let buffer_content = buf.read().unwrap();
|
||||
let path = Path::new("triangle.png");
|
||||
let file = File::create(path).unwrap();
|
||||
let ref mut w = BufWriter::new(file);
|
||||
let w = &mut BufWriter::new(file);
|
||||
let mut encoder = png::Encoder::new(w, 1024, 1024); // Width is 2 pixels and height is 1.
|
||||
encoder.set_color(png::ColorType::Rgba);
|
||||
encoder.set_depth(png::BitDepth::Eight);
|
||||
|
@ -296,7 +296,7 @@ fn main() {
|
||||
..
|
||||
} => {
|
||||
let surface = WindowBuilder::new()
|
||||
.build_vk_surface(&event_loop, instance.clone())
|
||||
.build_vk_surface(event_loop, instance.clone())
|
||||
.unwrap();
|
||||
let window_id = surface.window().id();
|
||||
let (swapchain, images) = {
|
||||
|
@ -198,7 +198,7 @@ fn compute_then_render(
|
||||
// Start frame
|
||||
let before_pipeline_future = match window_renderer.acquire() {
|
||||
Err(e) => {
|
||||
println!("{}", e.to_string());
|
||||
println!("{}", e);
|
||||
return;
|
||||
}
|
||||
Ok(future) => future,
|
||||
|
@ -261,7 +261,7 @@ fn main() {
|
||||
},
|
||||
]))
|
||||
.fragment_shader(fs.entry_point("main").unwrap(), ())
|
||||
.render_pass(Subpass::from(render_pass.clone(), 0).unwrap())
|
||||
.render_pass(Subpass::from(render_pass, 0).unwrap())
|
||||
.build(device.clone())
|
||||
.unwrap();
|
||||
|
||||
@ -291,12 +291,12 @@ fn main() {
|
||||
.begin_render_pass(
|
||||
RenderPassBeginInfo {
|
||||
clear_values: vec![Some([0.0, 0.0, 1.0, 1.0].into())],
|
||||
..RenderPassBeginInfo::framebuffer(framebuffer.clone())
|
||||
..RenderPassBeginInfo::framebuffer(framebuffer)
|
||||
},
|
||||
SubpassContents::Inline,
|
||||
)
|
||||
.unwrap()
|
||||
.bind_pipeline_graphics(pipeline.clone())
|
||||
.bind_pipeline_graphics(pipeline)
|
||||
.bind_vertex_buffers(0, vertex_buffer.clone())
|
||||
.draw(vertex_buffer.len() as u32, 1, 0, 0)
|
||||
.unwrap()
|
||||
@ -335,7 +335,7 @@ fn main() {
|
||||
let command_buffer = builder.build().unwrap();
|
||||
|
||||
let future = sync::now(device.clone())
|
||||
.then_execute(queue.clone(), command_buffer)
|
||||
.then_execute(queue, command_buffer)
|
||||
.unwrap()
|
||||
.then_signal_fence_and_flush()
|
||||
.unwrap();
|
||||
@ -366,7 +366,7 @@ fn write_image_buffer_to_file(
|
||||
let buffer_content = buffer.read().unwrap();
|
||||
let path = Path::new(path);
|
||||
let file = File::create(path).unwrap();
|
||||
let ref mut w = BufWriter::new(file);
|
||||
let w = &mut BufWriter::new(file);
|
||||
let mut encoder = png::Encoder::new(w, width, height);
|
||||
encoder.set_color(png::ColorType::Rgba);
|
||||
encoder.set_depth(png::BitDepth::Eight);
|
||||
|
@ -145,7 +145,7 @@ fn main() {
|
||||
|
||||
if let Ok(data) = pipeline_cache.get_data() {
|
||||
if let Ok(mut file) = File::create("pipeline_cache.bin.tmp") {
|
||||
if let Ok(_) = file.write_all(&data) {
|
||||
if file.write_all(&data).is_ok() {
|
||||
let _ = rename("pipeline_cache.bin.tmp", "pipeline_cache.bin");
|
||||
} else {
|
||||
let _ = remove_file("pipeline_cache.bin.tmp");
|
||||
@ -163,7 +163,7 @@ fn main() {
|
||||
let data = {
|
||||
if let Ok(mut file) = File::open("pipeline_cache.bin") {
|
||||
let mut data = Vec::new();
|
||||
if let Ok(_) = file.read_to_end(&mut data) {
|
||||
if file.read_to_end(&mut data).is_ok() {
|
||||
Some(data)
|
||||
} else {
|
||||
None
|
||||
@ -175,9 +175,9 @@ fn main() {
|
||||
|
||||
let second_cache = if let Some(data) = data {
|
||||
// This is unsafe because there is no way to be sure that the file contains valid data.
|
||||
unsafe { PipelineCache::with_data(device.clone(), &data).unwrap() }
|
||||
unsafe { PipelineCache::with_data(device, &data).unwrap() }
|
||||
} else {
|
||||
PipelineCache::empty(device.clone()).unwrap()
|
||||
PipelineCache::empty(device).unwrap()
|
||||
};
|
||||
|
||||
// As the PipelineCache of the Vulkan implementation saves an opaque blob of data,
|
||||
|
@ -115,7 +115,7 @@ fn main() {
|
||||
.unwrap();
|
||||
|
||||
let data_buffer = {
|
||||
let data_iter = (0..65536u32).map(|n| n);
|
||||
let data_iter = 0..65536u32;
|
||||
CpuAccessibleBuffer::from_iter(device.clone(), BufferUsage::all(), false, data_iter)
|
||||
.unwrap()
|
||||
};
|
||||
@ -151,15 +151,15 @@ fn main() {
|
||||
PipelineBindPoint::Compute,
|
||||
pipeline.layout().clone(),
|
||||
0,
|
||||
set.clone(),
|
||||
set,
|
||||
)
|
||||
.push_constants(pipeline.layout().clone(), 0, push_constants)
|
||||
.dispatch([1024, 1, 1])
|
||||
.unwrap();
|
||||
let command_buffer = builder.build().unwrap();
|
||||
|
||||
let future = sync::now(device.clone())
|
||||
.then_execute(queue.clone(), command_buffer)
|
||||
let future = sync::now(device)
|
||||
.then_execute(queue, command_buffer)
|
||||
.unwrap()
|
||||
.then_signal_fence_and_flush()
|
||||
.unwrap();
|
||||
@ -168,7 +168,7 @@ fn main() {
|
||||
|
||||
let data_buffer_content = data_buffer.read().unwrap();
|
||||
for n in 0..65536u32 {
|
||||
assert_eq!(data_buffer_content[n as usize], n * 1 + 1);
|
||||
assert_eq!(data_buffer_content[n as usize], n + 1);
|
||||
}
|
||||
println!("Success");
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ fn main() {
|
||||
|
||||
let set_layouts = layout_create_infos
|
||||
.into_iter()
|
||||
.map(|desc| Ok(DescriptorSetLayout::new(device.clone(), desc.clone())?))
|
||||
.map(|desc| DescriptorSetLayout::new(device.clone(), desc))
|
||||
.collect::<Result<Vec<_>, DescriptorSetLayoutCreationError>>()
|
||||
.unwrap();
|
||||
|
||||
@ -368,8 +368,8 @@ fn main() {
|
||||
0,
|
||||
0,
|
||||
[
|
||||
(mascot_texture.clone() as _, sampler.clone()),
|
||||
(vulkano_texture.clone() as _, sampler.clone()),
|
||||
(mascot_texture as _, sampler.clone()),
|
||||
(vulkano_texture as _, sampler),
|
||||
],
|
||||
)],
|
||||
)
|
||||
|
@ -155,14 +155,14 @@ fn main() {
|
||||
PipelineBindPoint::Compute,
|
||||
pipeline.layout().clone(),
|
||||
0,
|
||||
set.clone(),
|
||||
set,
|
||||
)
|
||||
.dispatch([1024, 1, 1])
|
||||
.unwrap();
|
||||
let command_buffer = builder.build().unwrap();
|
||||
|
||||
let future = sync::now(device.clone())
|
||||
.then_execute(queue.clone(), command_buffer)
|
||||
let future = sync::now(device)
|
||||
.then_execute(queue, command_buffer)
|
||||
.unwrap()
|
||||
.then_signal_fence_and_flush()
|
||||
.unwrap();
|
||||
|
@ -115,7 +115,7 @@ fn main() {
|
||||
};
|
||||
|
||||
let data_buffer = {
|
||||
let data_iter = (0..65536u32).map(|n| n);
|
||||
let data_iter = 0..65536u32;
|
||||
CpuAccessibleBuffer::from_iter(device.clone(), BufferUsage::all(), false, data_iter)
|
||||
.unwrap()
|
||||
};
|
||||
@ -139,13 +139,13 @@ fn main() {
|
||||
PipelineBindPoint::Compute,
|
||||
pipeline.layout().clone(),
|
||||
0,
|
||||
set.clone(),
|
||||
set,
|
||||
)
|
||||
.dispatch([1024, 1, 1])
|
||||
.unwrap();
|
||||
let command_buffer = builder.build().unwrap();
|
||||
let future = sync::now(device.clone())
|
||||
.then_execute(queue.clone(), command_buffer)
|
||||
let future = sync::now(device)
|
||||
.then_execute(queue, command_buffer)
|
||||
.unwrap()
|
||||
.then_signal_fence_and_flush()
|
||||
.unwrap();
|
||||
|
@ -186,7 +186,7 @@ fn main() {
|
||||
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
||||
let set = PersistentDescriptorSet::new(
|
||||
layout.clone(),
|
||||
[WriteDescriptorSet::buffer(0, data_buffer.clone())],
|
||||
[WriteDescriptorSet::buffer(0, data_buffer)],
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@ -202,7 +202,7 @@ fn main() {
|
||||
PipelineBindPoint::Compute,
|
||||
pipeline.layout().clone(),
|
||||
0,
|
||||
set.clone(),
|
||||
set,
|
||||
)
|
||||
.push_constants(pipeline.layout().clone(), 0, parameters)
|
||||
.dispatch([1024, 1, 1])
|
||||
@ -220,7 +220,7 @@ fn main() {
|
||||
|
||||
// Preparing test data array `[0, 1, 2, 3....]`
|
||||
let data_buffer = {
|
||||
let data_iter = (0..65536u32).map(|n| n);
|
||||
let data_iter = 0..65536u32;
|
||||
CpuAccessibleBuffer::from_iter(device.clone(), BufferUsage::all(), false, data_iter)
|
||||
.unwrap()
|
||||
};
|
||||
@ -241,7 +241,7 @@ fn main() {
|
||||
// Loading the second shader, and creating a Pipeline for the shader
|
||||
let add_pipeline = ComputePipeline::new(
|
||||
device.clone(),
|
||||
shaders::load_add(device.clone())
|
||||
shaders::load_add(device)
|
||||
.unwrap()
|
||||
.entry_point("main")
|
||||
.unwrap(),
|
||||
@ -270,7 +270,7 @@ fn main() {
|
||||
// Then multiply each value by 3
|
||||
run_shader(
|
||||
mult_pipeline,
|
||||
queue.clone(),
|
||||
queue,
|
||||
data_buffer.clone(),
|
||||
shaders::ty::Parameters { value: 3 },
|
||||
);
|
||||
|
@ -398,7 +398,7 @@ fn main() {
|
||||
.input_assembly_state(InputAssemblyState::new().topology(PrimitiveTopology::PointList)) // Vertices will be rendered as a list of points.
|
||||
.viewport_state(ViewportState::viewport_fixed_scissor_irrelevant([viewport]))
|
||||
.fragment_shader(fs.entry_point("main").unwrap(), ())
|
||||
.render_pass(Subpass::from(render_pass.clone(), 0).unwrap())
|
||||
.render_pass(Subpass::from(render_pass, 0).unwrap())
|
||||
.build(device.clone())
|
||||
.unwrap();
|
||||
|
||||
@ -406,7 +406,7 @@ fn main() {
|
||||
let mut previous_fence_index = 0;
|
||||
|
||||
let start_time = SystemTime::now();
|
||||
let mut last_frame_time = start_time.clone();
|
||||
let mut last_frame_time = start_time;
|
||||
event_loop.run(move |event, _, control_flow| {
|
||||
match event {
|
||||
Event::WindowEvent {
|
||||
@ -445,8 +445,8 @@ fn main() {
|
||||
};
|
||||
|
||||
// Since we disallow resizing, assert the swapchain and surface are optimally configured.
|
||||
assert_eq!(
|
||||
suboptimal, false,
|
||||
assert!(
|
||||
!suboptimal,
|
||||
"Not handling sub-optimal swapchains in this sample code"
|
||||
);
|
||||
|
||||
|
@ -116,7 +116,7 @@ fn main() {
|
||||
.unwrap();
|
||||
|
||||
let data_buffer = {
|
||||
let data_iter = (0..65536u32).map(|n| n);
|
||||
let data_iter = 0..65536u32;
|
||||
CpuAccessibleBuffer::from_iter(device.clone(), BufferUsage::all(), false, data_iter)
|
||||
.unwrap()
|
||||
};
|
||||
@ -140,14 +140,14 @@ fn main() {
|
||||
PipelineBindPoint::Compute,
|
||||
pipeline.layout().clone(),
|
||||
0,
|
||||
set.clone(),
|
||||
set,
|
||||
)
|
||||
.dispatch([1024, 1, 1])
|
||||
.unwrap();
|
||||
let command_buffer = builder.build().unwrap();
|
||||
|
||||
let future = sync::now(device.clone())
|
||||
.then_execute(queue.clone(), command_buffer)
|
||||
let future = sync::now(device)
|
||||
.then_execute(queue, command_buffer)
|
||||
.unwrap()
|
||||
.then_signal_fence_and_flush()
|
||||
.unwrap();
|
||||
@ -156,7 +156,7 @@ fn main() {
|
||||
|
||||
let data_buffer_content = data_buffer.read().unwrap();
|
||||
for n in 0..65536u32 {
|
||||
assert_eq!(data_buffer_content[n as usize], n * 1 + 1);
|
||||
assert_eq!(data_buffer_content[n as usize], n + 1);
|
||||
}
|
||||
println!("Success");
|
||||
}
|
||||
|
@ -301,7 +301,7 @@ fn main() {
|
||||
PipelineBindPoint::Graphics,
|
||||
pipeline.layout().clone(),
|
||||
0,
|
||||
set.clone(),
|
||||
set,
|
||||
)
|
||||
.bind_vertex_buffers(0, (vertex_buffer.clone(), normals_buffer.clone()))
|
||||
.bind_index_buffer(index_buffer.clone())
|
||||
@ -390,8 +390,8 @@ fn window_size_dependent_setup(
|
||||
]))
|
||||
.fragment_shader(fs.entry_point("main").unwrap(), ())
|
||||
.depth_stencil_state(DepthStencilState::simple_depth_test())
|
||||
.render_pass(Subpass::from(render_pass.clone(), 0).unwrap())
|
||||
.build(device.clone())
|
||||
.render_pass(Subpass::from(render_pass, 0).unwrap())
|
||||
.build(device)
|
||||
.unwrap();
|
||||
|
||||
(pipeline, framebuffers)
|
||||
|
@ -240,11 +240,7 @@ fn main() {
|
||||
let layout = pipeline.layout().set_layouts().get(0).unwrap();
|
||||
let set = PersistentDescriptorSet::new(
|
||||
layout.clone(),
|
||||
[WriteDescriptorSet::image_view_sampler(
|
||||
0,
|
||||
texture.clone(),
|
||||
sampler.clone(),
|
||||
)],
|
||||
[WriteDescriptorSet::image_view_sampler(0, texture, sampler)],
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
|
@ -1,6 +1,3 @@
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use vulkano::impl_vertex;
|
||||
|
||||
// Copyright (c) 2016 The vulkano developers
|
||||
// Licensed under the Apache License, Version 2.0
|
||||
// <LICENSE-APACHE or
|
||||
@ -10,6 +7,9 @@ use vulkano::impl_vertex;
|
||||
// notice may not be copied, modified, or distributed except
|
||||
// according to those terms.
|
||||
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use vulkano::impl_vertex;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, Default, Zeroable, Pod)]
|
||||
pub struct Vertex {
|
||||
|
@ -32,6 +32,7 @@ pub(super) fn path_to_str(path: &Path) -> &str {
|
||||
)
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn include_callback(
|
||||
requested_source_path_raw: &str,
|
||||
directive_type: IncludeType,
|
||||
@ -143,6 +144,7 @@ fn include_callback(
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn compile(
|
||||
path: Option<String>,
|
||||
base_path: &impl AsRef<Path>,
|
||||
@ -197,7 +199,7 @@ pub fn compile(
|
||||
compile_options.set_generate_debug_info();
|
||||
|
||||
let content = compiler
|
||||
.compile_into_spirv(&code, ty, root_source_path, "main", Some(&compile_options))
|
||||
.compile_into_spirv(code, ty, root_source_path, "main", Some(&compile_options))
|
||||
.map_err(|e| e.to_string())?;
|
||||
|
||||
let includes = includes_tracker.borrow().clone();
|
||||
@ -703,7 +705,7 @@ mod tests {
|
||||
// Check first entrypoint
|
||||
let e1_descriptors = descriptors.get(0).expect("Could not find entrypoint1");
|
||||
let mut e1_bindings = Vec::new();
|
||||
for (loc, _reqs) in e1_descriptors {
|
||||
for loc in e1_descriptors.keys() {
|
||||
e1_bindings.push(*loc);
|
||||
}
|
||||
assert_eq!(e1_bindings.len(), 5);
|
||||
@ -716,7 +718,7 @@ mod tests {
|
||||
// Check second entrypoint
|
||||
let e2_descriptors = descriptors.get(1).expect("Could not find entrypoint2");
|
||||
let mut e2_bindings = Vec::new();
|
||||
for (loc, _reqs) in e2_descriptors {
|
||||
for loc in e2_descriptors.keys() {
|
||||
e2_bindings.push(*loc);
|
||||
}
|
||||
assert_eq!(e2_bindings.len(), 3);
|
||||
@ -767,7 +769,7 @@ mod tests {
|
||||
.unwrap();
|
||||
let spirv = Spirv::new(comp.as_binary()).unwrap();
|
||||
|
||||
for (_, _, info) in reflect::entry_points(&spirv) {
|
||||
if let Some((_, _, info)) = reflect::entry_points(&spirv).next() {
|
||||
let mut bindings = Vec::new();
|
||||
for (loc, _reqs) in info.descriptor_requirements {
|
||||
bindings.push(loc);
|
||||
|
@ -87,7 +87,7 @@ fn write_shader_execution(execution: &ShaderExecution) -> TokenStream {
|
||||
fn write_descriptor_requirements(
|
||||
descriptor_requirements: &HashMap<(u32, u32), DescriptorRequirements>,
|
||||
) -> TokenStream {
|
||||
let descriptor_requirements = descriptor_requirements.into_iter().map(|(loc, reqs)| {
|
||||
let descriptor_requirements = descriptor_requirements.iter().map(|(loc, reqs)| {
|
||||
let (set_num, binding_num) = loc;
|
||||
let DescriptorRequirements {
|
||||
descriptor_types,
|
||||
@ -106,7 +106,7 @@ fn write_descriptor_requirements(
|
||||
storage_write,
|
||||
} = reqs;
|
||||
|
||||
let descriptor_types = descriptor_types.into_iter().map(|ty| {
|
||||
let descriptor_types = descriptor_types.iter().map(|ty| {
|
||||
let ident = format_ident!("{}", format!("{:?}", ty));
|
||||
quote! { ::vulkano::descriptor_set::layout::DescriptorType::#ident }
|
||||
});
|
||||
@ -286,19 +286,20 @@ fn write_push_constant_requirements(
|
||||
fn write_specialization_constant_requirements(
|
||||
specialization_constant_requirements: &HashMap<u32, SpecializationConstantRequirements>,
|
||||
) -> TokenStream {
|
||||
let specialization_constant_requirements = specialization_constant_requirements
|
||||
.into_iter()
|
||||
.map(|(&constant_id, reqs)| {
|
||||
let SpecializationConstantRequirements { size } = reqs;
|
||||
quote! {
|
||||
(
|
||||
#constant_id,
|
||||
::vulkano::shader::SpecializationConstantRequirements {
|
||||
size: #size,
|
||||
},
|
||||
),
|
||||
}
|
||||
});
|
||||
let specialization_constant_requirements =
|
||||
specialization_constant_requirements
|
||||
.iter()
|
||||
.map(|(&constant_id, reqs)| {
|
||||
let SpecializationConstantRequirements { size } = reqs;
|
||||
quote! {
|
||||
(
|
||||
#constant_id,
|
||||
::vulkano::shader::SpecializationConstantRequirements {
|
||||
size: #size,
|
||||
},
|
||||
),
|
||||
}
|
||||
});
|
||||
|
||||
quote! {
|
||||
[
|
||||
|
@ -217,6 +217,7 @@
|
||||
|
||||
#![doc(html_logo_url = "https://raw.githubusercontent.com/vulkano-rs/vulkano/master/logo.png")]
|
||||
#![recursion_limit = "1024"]
|
||||
|
||||
#[macro_use]
|
||||
extern crate quote;
|
||||
#[macro_use]
|
||||
@ -779,7 +780,7 @@ impl Parse for MacroInput {
|
||||
})
|
||||
.collect(),
|
||||
spirv_version,
|
||||
types_meta: types_meta.unwrap_or_else(|| TypesMeta::default()),
|
||||
types_meta: types_meta.unwrap_or_default(),
|
||||
vulkan_version,
|
||||
})
|
||||
}
|
||||
@ -796,7 +797,7 @@ pub fn shader(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
|
||||
let input = parse_macro_input!(input as MacroInput);
|
||||
|
||||
let is_single = input.shaders.len() == 1;
|
||||
let root = env::var("CARGO_MANIFEST_DIR").unwrap_or(".".into());
|
||||
let root = env::var("CARGO_MANIFEST_DIR").unwrap_or_else(|_| ".".into());
|
||||
let root_path = Path::new(&root);
|
||||
|
||||
let mut shaders_code = Vec::with_capacity(input.shaders.len());
|
||||
@ -808,7 +809,8 @@ pub fn shader(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
|
||||
let full_path = root_path.join(&path);
|
||||
|
||||
let bytes = if full_path.is_file() {
|
||||
fs::read(full_path).expect(&format!("Error reading source from {:?}", path))
|
||||
fs::read(full_path)
|
||||
.unwrap_or_else(|_| panic!("Error reading source from {:?}", path))
|
||||
} else {
|
||||
panic!(
|
||||
"File {:?} was not found; note that the path must be relative to your Cargo.toml",
|
||||
@ -828,14 +830,13 @@ pub fn shader(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
|
||||
&mut types_registry,
|
||||
)
|
||||
.unwrap()
|
||||
.into()
|
||||
} else {
|
||||
let (path, full_path, source_code) = match shader_source {
|
||||
SourceKind::Src(source) => (None, None, source),
|
||||
SourceKind::Path(path) => {
|
||||
let full_path = root_path.join(&path);
|
||||
let source_code = read_file_to_string(&full_path)
|
||||
.expect(&format!("Error reading source from {:?}", path));
|
||||
.unwrap_or_else(|_| panic!("Error reading source from {:?}", path));
|
||||
|
||||
if full_path.is_file() {
|
||||
(Some(path.clone()), Some(full_path), source_code)
|
||||
@ -877,12 +878,10 @@ pub fn shader(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
|
||||
}
|
||||
};
|
||||
|
||||
let input_paths = includes.iter().map(|s| s.as_ref()).chain(
|
||||
full_path
|
||||
.as_ref()
|
||||
.map(|p| p.as_path())
|
||||
.map(codegen::path_to_str),
|
||||
);
|
||||
let input_paths = includes
|
||||
.iter()
|
||||
.map(|s| s.as_ref())
|
||||
.chain(full_path.as_deref().map(codegen::path_to_str));
|
||||
|
||||
codegen::reflect(
|
||||
prefix.as_str(),
|
||||
@ -893,7 +892,6 @@ pub fn shader(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
|
||||
&mut types_registry,
|
||||
)
|
||||
.unwrap()
|
||||
.into()
|
||||
};
|
||||
|
||||
shaders_code.push(code);
|
||||
@ -917,7 +915,7 @@ pub fn shader(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
|
||||
};
|
||||
|
||||
if input.dump {
|
||||
println!("{}", result.to_string());
|
||||
println!("{}", result);
|
||||
panic!("`shader!` rust codegen dumped") // TODO: use span from dump
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ pub(super) fn write_structs<'a>(
|
||||
|
||||
Some(if is_sized {
|
||||
let derives = write_derives(types_meta);
|
||||
let impls = write_impls(types_meta, &struct_name, &rust_members);
|
||||
let impls = write_impls(types_meta, struct_name, &rust_members);
|
||||
quote! {
|
||||
#derives
|
||||
#struct_body
|
||||
@ -414,12 +414,12 @@ pub(super) fn type_from_id(
|
||||
data: i8,
|
||||
after: u8,
|
||||
}
|
||||
return (
|
||||
(
|
||||
quote! {i8},
|
||||
Cow::from("i8"),
|
||||
Some(std::mem::size_of::<i8>()),
|
||||
mem::align_of::<Foo>(),
|
||||
);
|
||||
)
|
||||
}
|
||||
(8, 0) => {
|
||||
#[repr(C)]
|
||||
@ -427,12 +427,12 @@ pub(super) fn type_from_id(
|
||||
data: u8,
|
||||
after: u8,
|
||||
}
|
||||
return (
|
||||
(
|
||||
quote! {u8},
|
||||
Cow::from("u8"),
|
||||
Some(std::mem::size_of::<u8>()),
|
||||
mem::align_of::<Foo>(),
|
||||
);
|
||||
)
|
||||
}
|
||||
(16, 1) => {
|
||||
#[repr(C)]
|
||||
@ -440,12 +440,12 @@ pub(super) fn type_from_id(
|
||||
data: i16,
|
||||
after: u8,
|
||||
}
|
||||
return (
|
||||
(
|
||||
quote! {i16},
|
||||
Cow::from("i16"),
|
||||
Some(std::mem::size_of::<i16>()),
|
||||
mem::align_of::<Foo>(),
|
||||
);
|
||||
)
|
||||
}
|
||||
(16, 0) => {
|
||||
#[repr(C)]
|
||||
@ -453,12 +453,12 @@ pub(super) fn type_from_id(
|
||||
data: u16,
|
||||
after: u8,
|
||||
}
|
||||
return (
|
||||
(
|
||||
quote! {u16},
|
||||
Cow::from("u16"),
|
||||
Some(std::mem::size_of::<u16>()),
|
||||
mem::align_of::<Foo>(),
|
||||
);
|
||||
)
|
||||
}
|
||||
(32, 1) => {
|
||||
#[repr(C)]
|
||||
@ -466,12 +466,12 @@ pub(super) fn type_from_id(
|
||||
data: i32,
|
||||
after: u8,
|
||||
}
|
||||
return (
|
||||
(
|
||||
quote! {i32},
|
||||
Cow::from("i32"),
|
||||
Some(std::mem::size_of::<i32>()),
|
||||
mem::align_of::<Foo>(),
|
||||
);
|
||||
)
|
||||
}
|
||||
(32, 0) => {
|
||||
#[repr(C)]
|
||||
@ -479,12 +479,12 @@ pub(super) fn type_from_id(
|
||||
data: u32,
|
||||
after: u8,
|
||||
}
|
||||
return (
|
||||
(
|
||||
quote! {u32},
|
||||
Cow::from("u32"),
|
||||
Some(std::mem::size_of::<u32>()),
|
||||
mem::align_of::<Foo>(),
|
||||
);
|
||||
)
|
||||
}
|
||||
(64, 1) => {
|
||||
#[repr(C)]
|
||||
@ -492,12 +492,12 @@ pub(super) fn type_from_id(
|
||||
data: i64,
|
||||
after: u8,
|
||||
}
|
||||
return (
|
||||
(
|
||||
quote! {i64},
|
||||
Cow::from("i64"),
|
||||
Some(std::mem::size_of::<i64>()),
|
||||
mem::align_of::<Foo>(),
|
||||
);
|
||||
)
|
||||
}
|
||||
(64, 0) => {
|
||||
#[repr(C)]
|
||||
@ -505,12 +505,12 @@ pub(super) fn type_from_id(
|
||||
data: u64,
|
||||
after: u8,
|
||||
}
|
||||
return (
|
||||
(
|
||||
quote! {u64},
|
||||
Cow::from("u64"),
|
||||
Some(std::mem::size_of::<u64>()),
|
||||
mem::align_of::<Foo>(),
|
||||
);
|
||||
)
|
||||
}
|
||||
_ => panic!("No Rust equivalent for an integer of width {}", width),
|
||||
},
|
||||
@ -521,12 +521,12 @@ pub(super) fn type_from_id(
|
||||
data: f32,
|
||||
after: u8,
|
||||
}
|
||||
return (
|
||||
(
|
||||
quote! {f32},
|
||||
Cow::from("f32"),
|
||||
Some(std::mem::size_of::<f32>()),
|
||||
mem::align_of::<Foo>(),
|
||||
);
|
||||
)
|
||||
}
|
||||
64 => {
|
||||
#[repr(C)]
|
||||
@ -534,12 +534,12 @@ pub(super) fn type_from_id(
|
||||
data: f64,
|
||||
after: u8,
|
||||
}
|
||||
return (
|
||||
(
|
||||
quote! {f64},
|
||||
Cow::from("f64"),
|
||||
Some(std::mem::size_of::<f64>()),
|
||||
mem::align_of::<Foo>(),
|
||||
);
|
||||
)
|
||||
}
|
||||
_ => panic!("No Rust equivalent for a floating-point of width {}", width),
|
||||
},
|
||||
@ -552,12 +552,12 @@ pub(super) fn type_from_id(
|
||||
let (ty, item, t_size, t_align) = type_from_id(shader, spirv, component_type);
|
||||
let array_length = component_count as usize;
|
||||
let size = t_size.map(|s| s * component_count as usize);
|
||||
return (
|
||||
(
|
||||
quote! { [#ty; #array_length] },
|
||||
Cow::from(format!("[{}; {}]", item, array_length)),
|
||||
size,
|
||||
t_align,
|
||||
);
|
||||
)
|
||||
}
|
||||
&Instruction::TypeMatrix {
|
||||
column_type,
|
||||
@ -569,12 +569,12 @@ pub(super) fn type_from_id(
|
||||
let (ty, item, t_size, t_align) = type_from_id(shader, spirv, column_type);
|
||||
let array_length = column_count as usize;
|
||||
let size = t_size.map(|s| s * column_count as usize);
|
||||
return (
|
||||
(
|
||||
quote! { [#ty; #array_length] },
|
||||
Cow::from(format!("[{}; {}]", item, array_length)),
|
||||
size,
|
||||
t_align,
|
||||
);
|
||||
)
|
||||
}
|
||||
&Instruction::TypeArray {
|
||||
element_type,
|
||||
@ -611,12 +611,12 @@ pub(super) fn type_from_id(
|
||||
(e.g. increase a vec3 to a vec4)")
|
||||
}
|
||||
|
||||
return (
|
||||
(
|
||||
quote! { [#element_type; #array_length] },
|
||||
Cow::from(format!("[{}; {}]", element_type_string, array_length)),
|
||||
Some(element_size * array_length as usize),
|
||||
element_align,
|
||||
);
|
||||
)
|
||||
}
|
||||
&Instruction::TypeRuntimeArray { element_type, .. } => {
|
||||
debug_assert_eq!(mem::align_of::<[u32; 3]>(), mem::align_of::<u32>());
|
||||
@ -624,12 +624,12 @@ pub(super) fn type_from_id(
|
||||
let (element_type, element_type_string, _, element_align) =
|
||||
type_from_id(shader, spirv, element_type);
|
||||
|
||||
return (
|
||||
(
|
||||
quote! { [#element_type] },
|
||||
Cow::from(format!("[{}]", element_type_string)),
|
||||
None,
|
||||
element_align,
|
||||
);
|
||||
)
|
||||
}
|
||||
Instruction::TypeStruct { member_types, .. } => {
|
||||
// TODO: take the Offset member decorate into account?
|
||||
@ -676,13 +676,13 @@ pub(super) fn type_from_id(
|
||||
Instruction::Name { name, .. } => Some(Cow::from(name.clone())),
|
||||
_ => None,
|
||||
})
|
||||
.unwrap_or(Cow::from("__unnamed"));
|
||||
.unwrap_or_else(|| Cow::from("__unnamed"));
|
||||
let name = {
|
||||
let name = format_ident!("{}", name_string);
|
||||
quote! { #name }
|
||||
};
|
||||
|
||||
return (name, name_string, size, align);
|
||||
(name, name_string, size, align)
|
||||
}
|
||||
_ => panic!("Type #{} not found", type_id),
|
||||
}
|
||||
@ -709,18 +709,18 @@ pub(super) fn write_specialization_constants<'a>(
|
||||
let mut spec_consts = Vec::new();
|
||||
|
||||
for instruction in spirv.iter_global() {
|
||||
let (result_type_id, result_id, default_value) = match instruction {
|
||||
&Instruction::SpecConstantTrue {
|
||||
let (result_type_id, result_id, default_value) = match *instruction {
|
||||
Instruction::SpecConstantTrue {
|
||||
result_type_id,
|
||||
result_id,
|
||||
} => (result_type_id, result_id, quote! {1u32}),
|
||||
|
||||
&Instruction::SpecConstantFalse {
|
||||
Instruction::SpecConstantFalse {
|
||||
result_type_id,
|
||||
result_id,
|
||||
} => (result_type_id, result_id, quote! {0u32}),
|
||||
|
||||
&Instruction::SpecConstant {
|
||||
Instruction::SpecConstant {
|
||||
result_type_id,
|
||||
result_id,
|
||||
ref value,
|
||||
@ -730,7 +730,8 @@ pub(super) fn write_specialization_constants<'a>(
|
||||
};
|
||||
(result_type_id, result_id, def_val)
|
||||
}
|
||||
&Instruction::SpecConstantComposite {
|
||||
|
||||
Instruction::SpecConstantComposite {
|
||||
result_type_id,
|
||||
result_id,
|
||||
ref constituents,
|
||||
@ -741,6 +742,7 @@ pub(super) fn write_specialization_constants<'a>(
|
||||
};
|
||||
(result_type_id, result_id, def_val)
|
||||
}
|
||||
|
||||
_ => continue,
|
||||
};
|
||||
|
||||
|
@ -134,19 +134,18 @@ impl VulkanoContext {
|
||||
.union(&config.instance_create_info.enabled_extensions);
|
||||
|
||||
// Create instance
|
||||
let instance = Instance::new(library.clone(), config.instance_create_info)
|
||||
.expect("Failed to create instance");
|
||||
let instance =
|
||||
Instance::new(library, config.instance_create_info).expect("Failed to create instance");
|
||||
|
||||
// Create debug callback
|
||||
let _debug_utils_messenger = if let Some(dbg_create_info) = config.debug_create_info.take()
|
||||
{
|
||||
Some(unsafe {
|
||||
DebugUtilsMessenger::new(instance.clone(), dbg_create_info)
|
||||
.expect("Failed to create debug callback")
|
||||
})
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let _debug_utils_messenger =
|
||||
config
|
||||
.debug_create_info
|
||||
.take()
|
||||
.map(|dbg_create_info| unsafe {
|
||||
DebugUtilsMessenger::new(instance.clone(), dbg_create_info)
|
||||
.expect("Failed to create debug callback")
|
||||
});
|
||||
|
||||
// Get prioritized device
|
||||
let physical_device = PhysicalDevice::enumerate(&instance)
|
||||
|
@ -7,6 +7,8 @@
|
||||
// notice may not be copied, modified, or distributed except
|
||||
// according to those terms.
|
||||
|
||||
#![allow(clippy::missing_safety_doc)]
|
||||
|
||||
pub mod context;
|
||||
pub mod renderer;
|
||||
pub mod window;
|
||||
|
@ -335,7 +335,7 @@ impl VulkanoWindowRenderer {
|
||||
.collect::<Vec<usize>>();
|
||||
for i in resizable_views {
|
||||
let format = self.get_additional_image_view(i).format().unwrap();
|
||||
let usage = self.get_additional_image_view(i).usage().clone();
|
||||
let usage = *self.get_additional_image_view(i).usage();
|
||||
self.remove_additional_image_view(i);
|
||||
self.add_additional_image_view(i, format, usage);
|
||||
}
|
||||
|
@ -202,19 +202,17 @@ impl VulkanoWindows {
|
||||
&mut self,
|
||||
id: winit::window::WindowId,
|
||||
) -> Option<&mut VulkanoWindowRenderer> {
|
||||
self.windows.get_mut(&id).and_then(|v| Some(v))
|
||||
self.windows.get_mut(&id)
|
||||
}
|
||||
|
||||
/// Get a reference to the renderer by winit window id
|
||||
pub fn get_renderer(&self, id: winit::window::WindowId) -> Option<&VulkanoWindowRenderer> {
|
||||
self.windows.get(&id).and_then(|v| Some(v))
|
||||
self.windows.get(&id)
|
||||
}
|
||||
|
||||
/// Get a reference to the winit window by winit window id
|
||||
pub fn get_window(&self, id: winit::window::WindowId) -> Option<&winit::window::Window> {
|
||||
self.windows
|
||||
.get(&id)
|
||||
.and_then(|v_window| Some(v_window.window()))
|
||||
self.windows.get(&id).map(|v_window| v_window.window())
|
||||
}
|
||||
|
||||
/// Return primary window id
|
||||
@ -294,7 +292,7 @@ fn get_best_videomode(monitor: &winit::monitor::MonitorHandle) -> winit::monitor
|
||||
}
|
||||
|
||||
/// Defines the way a window is displayed.
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum WindowMode {
|
||||
/// Creates a window that uses the given size.
|
||||
Windowed,
|
||||
|
@ -1,4 +1,5 @@
|
||||
#![doc(html_logo_url = "https://raw.githubusercontent.com/vulkano-rs/vulkano/master/logo.png")]
|
||||
#![allow(clippy::missing_safety_doc)]
|
||||
|
||||
/// Create a surface either using winit or a RawWindowHandle
|
||||
/// Its possible to disable either one using features
|
||||
|
@ -17,6 +17,7 @@ use vk_parse::Extension;
|
||||
|
||||
// This is not included in vk.xml, so it's added here manually
|
||||
fn required_if_supported(name: &str) -> bool {
|
||||
#[allow(clippy::match_like_matches_macro)]
|
||||
match name {
|
||||
"VK_KHR_portability_subset" => true,
|
||||
_ => false,
|
||||
@ -172,18 +173,6 @@ fn device_extensions_output(members: &[ExtensionsMember]) -> TokenStream {
|
||||
}
|
||||
});
|
||||
|
||||
let required_if_supported_extensions_items = members.iter().map(
|
||||
|ExtensionsMember {
|
||||
name,
|
||||
required_if_supported,
|
||||
..
|
||||
}| {
|
||||
quote! {
|
||||
#name: #required_if_supported,
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
quote! {
|
||||
#common
|
||||
|
||||
@ -199,13 +188,6 @@ fn device_extensions_output(members: &[ExtensionsMember]) -> TokenStream {
|
||||
#(#check_requirements_items)*
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn required_if_supported_extensions() -> Self {
|
||||
Self {
|
||||
#(#required_if_supported_extensions_items)*
|
||||
_ne: crate::NonExhaustive(()),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -354,7 +336,7 @@ fn extensions_common_output(struct_name: Ident, members: &[ExtensionsMember]) ->
|
||||
let from_extensions_for_vec_cstring_items =
|
||||
members.iter().map(|ExtensionsMember { name, raw, .. }| {
|
||||
quote! {
|
||||
if x.#name { data.push(CString::new(&#raw[..]).unwrap()); }
|
||||
if x.#name { data.push(CString::new(#raw).unwrap()); }
|
||||
}
|
||||
});
|
||||
|
||||
@ -482,7 +464,7 @@ fn extensions_members(ty: &str, extensions: &IndexMap<&str, &Extension>) -> Vec<
|
||||
);
|
||||
let extension = extensions[vk_name];
|
||||
|
||||
match extension.ext_type.as_ref().map(|s| s.as_str()) {
|
||||
match extension.ext_type.as_deref() {
|
||||
Some("device") => &mut dependencies.device_extensions,
|
||||
Some("instance") => &mut dependencies.instance_extensions,
|
||||
_ => unreachable!(),
|
||||
@ -518,8 +500,7 @@ fn extensions_members(ty: &str, extensions: &IndexMap<&str, &Extension>) -> Vec<
|
||||
.collect(),
|
||||
status: ext
|
||||
.promotedto
|
||||
.as_ref()
|
||||
.map(|s| s.as_str())
|
||||
.as_deref()
|
||||
.and_then(|pr| {
|
||||
if let Some(version) = pr.strip_prefix("VK_VERSION_") {
|
||||
let (major, minor) = version.split_once('_').unwrap();
|
||||
@ -541,35 +522,28 @@ fn extensions_members(ty: &str, extensions: &IndexMap<&str, &Extension>) -> Vec<
|
||||
}
|
||||
})
|
||||
.or_else(|| {
|
||||
ext.deprecatedby
|
||||
.as_ref()
|
||||
.map(|s| s.as_str())
|
||||
.and_then(|depr| {
|
||||
if depr.is_empty() {
|
||||
Some(ExtensionStatus::Deprecated(None))
|
||||
} else if let Some(version) = depr.strip_prefix("VK_VERSION_") {
|
||||
let (major, minor) = version.split_once('_').unwrap();
|
||||
Some(ExtensionStatus::Deprecated(Some(Replacement::Core((
|
||||
major.parse().unwrap(),
|
||||
minor.parse().unwrap(),
|
||||
)))))
|
||||
} else {
|
||||
let member = depr.strip_prefix("VK_").unwrap().to_snake_case();
|
||||
match extensions[depr].ext_type.as_ref().unwrap().as_str() {
|
||||
"device" => Some(ExtensionStatus::Deprecated(Some(
|
||||
Replacement::DeviceExtension(format_ident!(
|
||||
"{}", member
|
||||
)),
|
||||
))),
|
||||
"instance" => Some(ExtensionStatus::Deprecated(Some(
|
||||
Replacement::InstanceExtension(format_ident!(
|
||||
"{}", member
|
||||
)),
|
||||
))),
|
||||
_ => unreachable!(),
|
||||
}
|
||||
ext.deprecatedby.as_deref().and_then(|depr| {
|
||||
if depr.is_empty() {
|
||||
Some(ExtensionStatus::Deprecated(None))
|
||||
} else if let Some(version) = depr.strip_prefix("VK_VERSION_") {
|
||||
let (major, minor) = version.split_once('_').unwrap();
|
||||
Some(ExtensionStatus::Deprecated(Some(Replacement::Core((
|
||||
major.parse().unwrap(),
|
||||
minor.parse().unwrap(),
|
||||
)))))
|
||||
} else {
|
||||
let member = depr.strip_prefix("VK_").unwrap().to_snake_case();
|
||||
match extensions[depr].ext_type.as_ref().unwrap().as_str() {
|
||||
"device" => Some(ExtensionStatus::Deprecated(Some(
|
||||
Replacement::DeviceExtension(format_ident!("{}", member)),
|
||||
))),
|
||||
"instance" => Some(ExtensionStatus::Deprecated(Some(
|
||||
Replacement::InstanceExtension(format_ident!("{}", member)),
|
||||
))),
|
||||
_ => unreachable!(),
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}),
|
||||
};
|
||||
make_doc(&mut member);
|
||||
|
@ -203,18 +203,22 @@ fn features_output(members: &[FeaturesMember]) -> TokenStream {
|
||||
quote! { self.#ffi_member.as_mut().map(|s| &mut s #ffi_member_field .#ffi_name) }
|
||||
});
|
||||
quote! {
|
||||
[
|
||||
if let Some(f) = [
|
||||
#(#ffi_members),*
|
||||
].into_iter().flatten().next().map(|f| *f = features.#name as ash::vk::Bool32);
|
||||
].into_iter().flatten().next() {
|
||||
*f = features.#name as ash::vk::Bool32;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let ffi_members = ffi_members.iter().map(|(ffi_member, ffi_member_field)| {
|
||||
quote! { &mut self.#ffi_member #ffi_member_field .#ffi_name }
|
||||
});
|
||||
quote! {
|
||||
[
|
||||
if let Some(f) = [
|
||||
#(#ffi_members),*
|
||||
].into_iter().next().map(|f| *f = features.#name as ash::vk::Bool32);
|
||||
].into_iter().next() {
|
||||
*f = features.#name as ash::vk::Bool32;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -378,8 +382,8 @@ fn features_members(types: &HashMap<&str, (&Type, Vec<&str>)>) -> Vec<FeaturesMe
|
||||
std::iter::once(&types["VkPhysicalDeviceFeatures"])
|
||||
.chain(sorted_structs(types).into_iter())
|
||||
.filter(|(ty, _)| {
|
||||
ty.name.as_ref().map(|s| s.as_str()) == Some("VkPhysicalDeviceFeatures")
|
||||
|| ty.structextends.as_ref().map(|s| s.as_str())
|
||||
ty.name.as_deref() == Some("VkPhysicalDeviceFeatures")
|
||||
|| ty.structextends.as_deref()
|
||||
== Some("VkPhysicalDeviceFeatures2,VkDeviceCreateInfo")
|
||||
})
|
||||
.for_each(|(ty, _)| {
|
||||
@ -411,11 +415,11 @@ fn features_members(types: &HashMap<&str, (&Type, Vec<&str>)>) -> Vec<FeaturesMe
|
||||
ffi_name: format_ident!("{}", name),
|
||||
ffi_members: vec![ty_name.clone()],
|
||||
requires_features: requires_features
|
||||
.into_iter()
|
||||
.iter()
|
||||
.map(|&s| format_ident!("{}", s.to_snake_case()))
|
||||
.collect(),
|
||||
conflicts_features: conflicts_features
|
||||
.into_iter()
|
||||
.iter()
|
||||
.map(|&s| format_ident!("{}", s.to_snake_case()))
|
||||
.collect(),
|
||||
required_by_extensions: required_by_extensions
|
||||
@ -558,7 +562,7 @@ fn features_ffi_output(members: &[FeaturesFfiMember]) -> TokenStream {
|
||||
&mut self,
|
||||
api_version: Version,
|
||||
device_extensions: &DeviceExtensions,
|
||||
instance_extensions: &InstanceExtensions,
|
||||
_instance_extensions: &InstanceExtensions,
|
||||
) {
|
||||
self.features_vulkan10 = Default::default();
|
||||
let head = &mut self.features_vulkan10;
|
||||
@ -646,8 +650,7 @@ fn sorted_structs<'a>(
|
||||
let mut structs: Vec<_> = types
|
||||
.values()
|
||||
.filter(|(ty, _)| {
|
||||
ty.structextends.as_ref().map(|s| s.as_str())
|
||||
== Some("VkPhysicalDeviceFeatures2,VkDeviceCreateInfo")
|
||||
ty.structextends.as_deref() == Some("VkPhysicalDeviceFeatures2,VkDeviceCreateInfo")
|
||||
})
|
||||
.collect();
|
||||
let regex = Regex::new(r"^VkPhysicalDeviceVulkan\d+Features$").unwrap();
|
||||
@ -661,17 +664,9 @@ fn sorted_structs<'a>(
|
||||
{
|
||||
let (major, minor) = version.split_once('_').unwrap();
|
||||
major.parse::<i32>().unwrap() << 22 | minor.parse::<i32>().unwrap() << 12
|
||||
} else if provided_by
|
||||
.iter()
|
||||
.find(|s| s.starts_with("VK_KHR_"))
|
||||
.is_some()
|
||||
{
|
||||
} else if provided_by.iter().any(|s| s.starts_with("VK_KHR_")) {
|
||||
i32::MAX - 2
|
||||
} else if provided_by
|
||||
.iter()
|
||||
.find(|s| s.starts_with("VK_EXT_"))
|
||||
.is_some()
|
||||
{
|
||||
} else if provided_by.iter().any(|s| s.starts_with("VK_EXT_")) {
|
||||
i32::MAX - 1
|
||||
} else {
|
||||
i32::MAX
|
||||
|
@ -90,7 +90,7 @@ fn fns_output(extension_members: &[FnsMember], fns_level: &str, doc: &str) -> To
|
||||
|
||||
impl std::fmt::Debug for #struct_name {
|
||||
#[inline]
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
|
||||
fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -475,8 +475,8 @@ fn formats_members(formats: &[&Format]) -> Vec<FormatMember> {
|
||||
let name = format_ident!("{}", parts.join("_"));
|
||||
|
||||
let mut member = FormatMember {
|
||||
name: name.clone(),
|
||||
ffi_name: ffi_name.clone(),
|
||||
name,
|
||||
ffi_name,
|
||||
|
||||
aspect_color: false,
|
||||
aspect_depth: false,
|
||||
@ -489,13 +489,13 @@ fn formats_members(formats: &[&Format]) -> Vec<FormatMember> {
|
||||
block_size: None,
|
||||
compatibility: format_ident!(
|
||||
"Class_{}",
|
||||
format.class.replace("-", "").replace(" ", "_")
|
||||
format.class.replace('-', "").replace(' ', "_")
|
||||
),
|
||||
components: [0u8; 4],
|
||||
compression: format
|
||||
.compressed
|
||||
.as_ref()
|
||||
.map(|c| format_ident!("{}", c.replace(" ", "_"))),
|
||||
.map(|c| format_ident!("{}", c.replace(' ', "_"))),
|
||||
planes: vec![],
|
||||
rust_type: None,
|
||||
texels_per_block: format.texelsPerBlock,
|
||||
@ -585,7 +585,7 @@ fn formats_members(formats: &[&Format]) -> Vec<FormatMember> {
|
||||
captures.get(3).unwrap().as_str().parse().unwrap(),
|
||||
];
|
||||
} else {
|
||||
match format.chroma.as_ref().map(|s| s.as_str()) {
|
||||
match format.chroma.as_deref() {
|
||||
Some("420") => member.block_extent = [2, 2, 1],
|
||||
Some("422") => member.block_extent = [2, 1, 1],
|
||||
_ => (),
|
||||
|
@ -63,7 +63,7 @@ fn write_file(file: impl AsRef<Path>, source: impl AsRef<str>, content: impl Dis
|
||||
// It should not be edited manually. Changes should be made by editing autogen.\n\
|
||||
\n\n{}",
|
||||
source.as_ref(),
|
||||
content.to_string(),
|
||||
content,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@ -98,15 +98,15 @@ pub struct VkRegistryData<'r> {
|
||||
|
||||
impl<'r> VkRegistryData<'r> {
|
||||
fn new(registry: &'r Registry) -> Self {
|
||||
let aliases = Self::get_aliases(®istry);
|
||||
let extensions = Self::get_extensions(®istry);
|
||||
let features = Self::get_features(®istry);
|
||||
let formats = Self::get_formats(®istry);
|
||||
let aliases = Self::get_aliases(registry);
|
||||
let extensions = Self::get_extensions(registry);
|
||||
let features = Self::get_features(registry);
|
||||
let formats = Self::get_formats(registry);
|
||||
let spirv_capabilities = Self::get_spirv_capabilities(registry);
|
||||
let spirv_extensions = Self::get_spirv_extensions(registry);
|
||||
let errors = Self::get_errors(®istry, &features, &extensions);
|
||||
let types = Self::get_types(®istry, &aliases, &features, &extensions);
|
||||
let header_version = Self::get_header_version(®istry);
|
||||
let errors = Self::get_errors(registry, &features, &extensions);
|
||||
let types = Self::get_types(registry, &aliases, &features, &extensions);
|
||||
let header_version = Self::get_header_version(registry);
|
||||
|
||||
VkRegistryData {
|
||||
header_version,
|
||||
@ -162,7 +162,7 @@ impl<'r> VkRegistryData<'r> {
|
||||
if let RegistryChild::Types(types) = child {
|
||||
return Some(types.children.iter().filter_map(|ty| {
|
||||
if let TypesChild::Type(ty) = ty {
|
||||
if let Some(alias) = ty.alias.as_ref().map(|s| s.as_str()) {
|
||||
if let Some(alias) = ty.alias.as_deref() {
|
||||
return Some((ty.name.as_ref().unwrap().as_str(), alias));
|
||||
}
|
||||
}
|
||||
@ -191,7 +191,7 @@ impl<'r> VkRegistryData<'r> {
|
||||
}) if name == "VkResult" => Some(children.iter().filter_map(|en| {
|
||||
if let EnumsChild::Enum(en) = en {
|
||||
if let EnumSpec::Value { value, .. } = &en.spec {
|
||||
if value.starts_with("-") {
|
||||
if value.starts_with('-') {
|
||||
return Some(en.name.as_str());
|
||||
}
|
||||
}
|
||||
@ -238,13 +238,11 @@ impl<'r> VkRegistryData<'r> {
|
||||
.iter()
|
||||
.filter_map(|child| {
|
||||
if let RegistryChild::Extensions(ext) = child {
|
||||
return Some(ext.children.iter().filter_map(|ext| {
|
||||
if ext.supported.as_ref().map(|s| s.as_str()) == Some("vulkan")
|
||||
&& ext.obsoletedby.is_none()
|
||||
{
|
||||
return Some(ext);
|
||||
return Some(ext.children.iter().filter(|ext| {
|
||||
if ext.supported.as_deref() == Some("vulkan") && ext.obsoletedby.is_none() {
|
||||
return true;
|
||||
}
|
||||
None
|
||||
false
|
||||
}));
|
||||
}
|
||||
None
|
||||
@ -281,7 +279,7 @@ impl<'r> VkRegistryData<'r> {
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn get_formats<'a>(registry: &'a Registry) -> Vec<&'a Format> {
|
||||
fn get_formats(registry: &Registry) -> Vec<&Format> {
|
||||
registry
|
||||
.0
|
||||
.iter()
|
||||
@ -295,7 +293,7 @@ impl<'r> VkRegistryData<'r> {
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn get_spirv_capabilities<'a>(registry: &'a Registry) -> Vec<&'a SpirvExtOrCap> {
|
||||
fn get_spirv_capabilities(registry: &Registry) -> Vec<&SpirvExtOrCap> {
|
||||
registry
|
||||
.0
|
||||
.iter()
|
||||
@ -309,7 +307,7 @@ impl<'r> VkRegistryData<'r> {
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn get_spirv_extensions<'a>(registry: &'a Registry) -> Vec<&'a SpirvExtOrCap> {
|
||||
fn get_spirv_extensions(registry: &Registry) -> Vec<&SpirvExtOrCap> {
|
||||
registry
|
||||
.0
|
||||
.iter()
|
||||
|
@ -92,7 +92,7 @@ fn properties_output(members: &[PropertiesMember]) -> TokenStream {
|
||||
quote! {
|
||||
#name: [
|
||||
#(#ffi_members),*
|
||||
].into_iter().flatten().next().and_then(|x| <#ty>::from_vulkan(x)),
|
||||
].into_iter().flatten().next().and_then(<#ty>::from_vulkan),
|
||||
}
|
||||
} else {
|
||||
let ffi_members = ffi_members.iter().map(|(ffi_member, ffi_member_field)| {
|
||||
@ -102,7 +102,7 @@ fn properties_output(members: &[PropertiesMember]) -> TokenStream {
|
||||
quote! {
|
||||
#name: [
|
||||
#(#ffi_members),*
|
||||
].into_iter().next().and_then(|x| <#ty>::from_vulkan(x)).unwrap(),
|
||||
].into_iter().next().and_then(<#ty>::from_vulkan).unwrap(),
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -151,11 +151,11 @@ fn properties_members(types: &HashMap<&str, (&Type, Vec<&str>)>) -> Vec<Properti
|
||||
.into_iter()
|
||||
.chain(sorted_structs(types).into_iter())
|
||||
.filter(|(ty, _)| {
|
||||
let name = ty.name.as_ref().map(|s| s.as_str());
|
||||
let name = ty.name.as_deref();
|
||||
name == Some("VkPhysicalDeviceProperties")
|
||||
|| name == Some("VkPhysicalDeviceLimits")
|
||||
|| name == Some("VkPhysicalDeviceSparseProperties")
|
||||
|| ty.structextends.as_ref().map(|s| s.as_str()) == Some("VkPhysicalDeviceProperties2")
|
||||
|| ty.structextends.as_deref() == Some("VkPhysicalDeviceProperties2")
|
||||
})
|
||||
.for_each(|(ty, _)| {
|
||||
let vulkan_ty_name = ty.name.as_ref().unwrap();
|
||||
@ -287,10 +287,6 @@ fn properties_ffi_output(members: &[PropertiesFfiMember]) -> TokenStream {
|
||||
#(#make_chain_items)*
|
||||
}
|
||||
|
||||
pub(crate) fn head_as_ref(&self) -> &ash::vk::PhysicalDeviceProperties2KHR {
|
||||
&self.properties_vulkan10
|
||||
}
|
||||
|
||||
pub(crate) fn head_as_mut(&mut self) -> &mut ash::vk::PhysicalDeviceProperties2KHR {
|
||||
&mut self.properties_vulkan10
|
||||
}
|
||||
@ -367,9 +363,7 @@ fn sorted_structs<'a>(
|
||||
) -> Vec<&'a (&'a Type, Vec<&'a str>)> {
|
||||
let mut structs: Vec<_> = types
|
||||
.values()
|
||||
.filter(|(ty, _)| {
|
||||
ty.structextends.as_ref().map(|s| s.as_str()) == Some("VkPhysicalDeviceProperties2")
|
||||
})
|
||||
.filter(|(ty, _)| ty.structextends.as_deref() == Some("VkPhysicalDeviceProperties2"))
|
||||
.collect();
|
||||
let regex = Regex::new(r"^VkPhysicalDeviceVulkan\d+Properties$").unwrap();
|
||||
structs.sort_unstable_by_key(|&(ty, provided_by)| {
|
||||
@ -382,17 +376,9 @@ fn sorted_structs<'a>(
|
||||
{
|
||||
let (major, minor) = version.split_once('_').unwrap();
|
||||
major.parse::<i32>().unwrap() << 22 | minor.parse::<i32>().unwrap() << 12
|
||||
} else if provided_by
|
||||
.iter()
|
||||
.find(|s| s.starts_with("VK_KHR_"))
|
||||
.is_some()
|
||||
{
|
||||
} else if provided_by.iter().any(|s| s.starts_with("VK_KHR_")) {
|
||||
i32::MAX - 2
|
||||
} else if provided_by
|
||||
.iter()
|
||||
.find(|s| s.starts_with("VK_EXT_"))
|
||||
.is_some()
|
||||
{
|
||||
} else if provided_by.iter().any(|s| s.starts_with("VK_EXT_")) {
|
||||
i32::MAX - 1
|
||||
} else {
|
||||
i32::MAX
|
||||
|
@ -221,13 +221,14 @@ fn instruction_output(members: &[InstructionMember], spec_constant: bool) -> Tok
|
||||
};
|
||||
|
||||
quote! {
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
#[doc=#doc]
|
||||
pub enum #enum_name {
|
||||
#(#struct_items)*
|
||||
}
|
||||
|
||||
impl #enum_name {
|
||||
#[allow(dead_code)]
|
||||
fn parse(reader: &mut InstructionReader) -> Result<Self, ParseError> {
|
||||
let opcode = (reader.next_u32()? & 0xffff) as u16;
|
||||
|
||||
@ -264,7 +265,7 @@ fn instruction_members(grammar: &SpirvGrammar) -> Vec<InstructionMember> {
|
||||
has_result_type_id = true;
|
||||
format_ident!("result_type_id")
|
||||
} else {
|
||||
to_member_name(&operand.kind, operand.name.as_ref().map(|x| x.as_str()))
|
||||
to_member_name(&operand.kind, operand.name.as_deref())
|
||||
};
|
||||
|
||||
*operand_names.entry(name.clone()).or_insert(0) += 1;
|
||||
@ -293,11 +294,7 @@ fn instruction_members(grammar: &SpirvGrammar) -> Vec<InstructionMember> {
|
||||
_ => parse.clone(),
|
||||
};
|
||||
|
||||
OperandMember {
|
||||
name,
|
||||
ty,
|
||||
parse: parse.clone(),
|
||||
}
|
||||
OperandMember { name, ty, parse }
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
@ -387,13 +384,14 @@ fn bit_enum_output(enums: &[(Ident, Vec<KindEnumMember>)]) -> TokenStream {
|
||||
);
|
||||
|
||||
quote! {
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub struct #name {
|
||||
#(#members_items)*
|
||||
}
|
||||
|
||||
impl #name {
|
||||
#[allow(dead_code)]
|
||||
fn parse(reader: &mut InstructionReader) -> Result<#name, ParseError> {
|
||||
let value = reader.next_u32()?;
|
||||
|
||||
@ -453,10 +451,7 @@ fn bit_enum_members(grammar: &SpirvGrammar) -> Vec<(Ident, Vec<KindEnumMember>)>
|
||||
.parameters
|
||||
.iter()
|
||||
.map(|param| {
|
||||
let name = to_member_name(
|
||||
¶m.kind,
|
||||
param.name.as_ref().map(|x| x.as_str()),
|
||||
);
|
||||
let name = to_member_name(¶m.kind, param.name.as_deref());
|
||||
let (ty, parse) = parameter_kinds[param.kind.as_str()].clone();
|
||||
|
||||
OperandMember { name, ty, parse }
|
||||
@ -529,7 +524,7 @@ fn value_enum_output(enums: &[(Ident, Vec<KindEnumMember>)]) -> TokenStream {
|
||||
|
||||
let derives = match name_string.as_str() {
|
||||
"ExecutionModel" => quote! { #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)] },
|
||||
_ => quote! { #[derive(Clone, Debug, PartialEq)] },
|
||||
_ => quote! { #[derive(Clone, Debug, PartialEq, Eq)] },
|
||||
};
|
||||
|
||||
quote! {
|
||||
@ -540,6 +535,7 @@ fn value_enum_output(enums: &[(Ident, Vec<KindEnumMember>)]) -> TokenStream {
|
||||
}
|
||||
|
||||
impl #name {
|
||||
#[allow(dead_code)]
|
||||
fn parse(reader: &mut InstructionReader) -> Result<#name, ParseError> {
|
||||
Ok(match reader.next_u32()? {
|
||||
#(#parse_items)*
|
||||
@ -586,10 +582,7 @@ fn value_enum_members(grammar: &SpirvGrammar) -> Vec<(Ident, Vec<KindEnumMember>
|
||||
.parameters
|
||||
.iter()
|
||||
.map(|param| {
|
||||
let name = to_member_name(
|
||||
¶m.kind,
|
||||
param.name.as_ref().map(|x| x.as_str()),
|
||||
);
|
||||
let name = to_member_name(¶m.kind, param.name.as_deref());
|
||||
let (ty, parse) = parameter_kinds[param.kind.as_str()].clone();
|
||||
|
||||
OperandMember { name, ty, parse }
|
||||
|
@ -41,7 +41,7 @@ use std::{
|
||||
mem::size_of,
|
||||
ops::{Deref, DerefMut, Range},
|
||||
ptr,
|
||||
sync::{atomic::AtomicUsize, Arc},
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
/// Buffer whose content is accessible by the CPU.
|
||||
@ -68,18 +68,6 @@ where
|
||||
marker: PhantomData<Box<T>>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
enum CurrentGpuAccess {
|
||||
NonExclusive {
|
||||
// Number of non-exclusive GPU accesses. Can be 0.
|
||||
num: AtomicUsize,
|
||||
},
|
||||
Exclusive {
|
||||
// Number of exclusive locks. Cannot be 0. If 0 is reached, we must jump to `NonExclusive`.
|
||||
num: usize,
|
||||
},
|
||||
}
|
||||
|
||||
impl<T> CpuAccessibleBuffer<T>
|
||||
where
|
||||
T: BufferContents,
|
||||
@ -344,13 +332,12 @@ where
|
||||
mapped_memory
|
||||
.invalidate_range(memory_range.clone())
|
||||
.unwrap();
|
||||
mapped_memory.read(memory_range.clone()).unwrap()
|
||||
mapped_memory.read(memory_range).unwrap()
|
||||
};
|
||||
|
||||
Ok(ReadLock {
|
||||
inner: self,
|
||||
buffer_range,
|
||||
memory_range,
|
||||
data: T::from_bytes(bytes).unwrap(),
|
||||
})
|
||||
}
|
||||
@ -483,7 +470,6 @@ where
|
||||
{
|
||||
inner: &'a CpuAccessibleBuffer<T, A>,
|
||||
buffer_range: Range<DeviceSize>,
|
||||
memory_range: Range<DeviceSize>,
|
||||
data: &'a T,
|
||||
}
|
||||
|
||||
@ -635,7 +621,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn create_empty_buffer() {
|
||||
let (device, queue) = gfx_dev_and_queue!();
|
||||
let (device, _queue) = gfx_dev_and_queue!();
|
||||
|
||||
const EMPTY: [i32; 0] = [];
|
||||
|
||||
|
@ -202,7 +202,7 @@ where
|
||||
device,
|
||||
pool,
|
||||
current_buffer: Mutex::new(None),
|
||||
usage: usage.clone(),
|
||||
usage,
|
||||
marker: PhantomData,
|
||||
}
|
||||
}
|
||||
@ -345,7 +345,7 @@ where
|
||||
I: IntoIterator<Item = T>,
|
||||
I::IntoIter: ExactSizeIterator,
|
||||
{
|
||||
self.chunk_impl(data.into_iter()).map(|ok| Arc::new(ok))
|
||||
self.chunk_impl(data.into_iter()).map(Arc::new)
|
||||
}
|
||||
|
||||
fn chunk_impl(
|
||||
@ -435,7 +435,7 @@ where
|
||||
memory: mem,
|
||||
chunks_in_use: Mutex::new(vec![]),
|
||||
next_index: AtomicU64::new(0),
|
||||
capacity: capacity,
|
||||
capacity,
|
||||
}));
|
||||
|
||||
Ok(())
|
||||
@ -612,7 +612,7 @@ where
|
||||
device: self.device.clone(),
|
||||
pool: self.pool.clone(),
|
||||
current_buffer: Mutex::new(buf.clone()),
|
||||
usage: self.usage.clone(),
|
||||
usage: self.usage,
|
||||
marker: PhantomData,
|
||||
}
|
||||
}
|
||||
|
@ -140,13 +140,6 @@ where
|
||||
marker: PhantomData<Box<T>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
enum GpuAccess {
|
||||
None,
|
||||
NonExclusive { num: u32 },
|
||||
Exclusive { num: u32 },
|
||||
}
|
||||
|
||||
impl<T> DeviceLocalBuffer<T>
|
||||
where
|
||||
T: BufferContents,
|
||||
@ -408,7 +401,7 @@ where
|
||||
let (buffer, mem_reqs) = Self::build_buffer(&device, size, usage, &queue_families)?;
|
||||
|
||||
let memory = alloc_dedicated_with_exportable_fd(
|
||||
device.clone(),
|
||||
device,
|
||||
&mem_reqs,
|
||||
AllocLayout::Linear,
|
||||
MappingRequirement::DoNotMap,
|
||||
@ -627,7 +620,7 @@ mod tests {
|
||||
CpuAccessibleBuffer::from_data(device.clone(), BufferUsage::all(), false, 0).unwrap();
|
||||
|
||||
let mut cbb = AutoCommandBufferBuilder::primary(
|
||||
device.clone(),
|
||||
device,
|
||||
queue.family(),
|
||||
CommandBufferUsage::MultipleSubmit,
|
||||
)
|
||||
@ -637,7 +630,7 @@ mod tests {
|
||||
let _ = cbb
|
||||
.build()
|
||||
.unwrap()
|
||||
.execute(queue.clone())
|
||||
.execute(queue)
|
||||
.unwrap()
|
||||
.then_signal_fence_and_flush()
|
||||
.unwrap();
|
||||
@ -666,7 +659,7 @@ mod tests {
|
||||
.unwrap();
|
||||
|
||||
let mut cbb = AutoCommandBufferBuilder::primary(
|
||||
device.clone(),
|
||||
device,
|
||||
queue.family(),
|
||||
CommandBufferUsage::MultipleSubmit,
|
||||
)
|
||||
@ -676,7 +669,7 @@ mod tests {
|
||||
let _ = cbb
|
||||
.build()
|
||||
.unwrap()
|
||||
.execute(queue.clone())
|
||||
.execute(queue)
|
||||
.unwrap()
|
||||
.then_signal_fence_and_flush()
|
||||
.unwrap();
|
||||
|
@ -74,7 +74,7 @@ impl<T: ?Sized, B> BufferSlice<T, B> {
|
||||
marker: PhantomData,
|
||||
resource: r,
|
||||
offset: 0,
|
||||
size: size,
|
||||
size,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -502,7 +502,7 @@ impl fmt::Display for BufferCreationError {
|
||||
fmt,
|
||||
"the specified size exceeded the value of the `max_buffer_size` limit"
|
||||
),
|
||||
Self::SharingInvalidQueueFamilyId { id } => {
|
||||
Self::SharingInvalidQueueFamilyId { .. } => {
|
||||
write!(fmt, "the sharing mode was set to `Concurrent`, but one of the specified queue family ids was not valid")
|
||||
}
|
||||
}
|
||||
|
@ -475,20 +475,17 @@ mod tests {
|
||||
#[test]
|
||||
fn create_uniform() {
|
||||
// `VK_FORMAT_R8G8B8A8_UNORM` guaranteed to be a supported format
|
||||
let (device, queue) = gfx_dev_and_queue!();
|
||||
let (_device, queue) = gfx_dev_and_queue!();
|
||||
|
||||
let usage = BufferUsage {
|
||||
uniform_texel_buffer: true,
|
||||
..BufferUsage::none()
|
||||
};
|
||||
|
||||
let (buffer, _) = DeviceLocalBuffer::<[[u8; 4]]>::from_iter(
|
||||
(0..128).map(|_| [0; 4]),
|
||||
usage,
|
||||
queue.clone(),
|
||||
)
|
||||
.unwrap();
|
||||
let view = BufferView::new(
|
||||
let (buffer, _) =
|
||||
DeviceLocalBuffer::<[[u8; 4]]>::from_iter((0..128).map(|_| [0; 4]), usage, queue)
|
||||
.unwrap();
|
||||
BufferView::new(
|
||||
buffer,
|
||||
BufferViewCreateInfo {
|
||||
format: Some(Format::R8G8B8A8_UNORM),
|
||||
@ -501,19 +498,16 @@ mod tests {
|
||||
#[test]
|
||||
fn create_storage() {
|
||||
// `VK_FORMAT_R8G8B8A8_UNORM` guaranteed to be a supported format
|
||||
let (device, queue) = gfx_dev_and_queue!();
|
||||
let (_device, queue) = gfx_dev_and_queue!();
|
||||
|
||||
let usage = BufferUsage {
|
||||
storage_texel_buffer: true,
|
||||
..BufferUsage::none()
|
||||
};
|
||||
|
||||
let (buffer, _) = DeviceLocalBuffer::<[[u8; 4]]>::from_iter(
|
||||
(0..128).map(|_| [0; 4]),
|
||||
usage,
|
||||
queue.clone(),
|
||||
)
|
||||
.unwrap();
|
||||
let (buffer, _) =
|
||||
DeviceLocalBuffer::<[[u8; 4]]>::from_iter((0..128).map(|_| [0; 4]), usage, queue)
|
||||
.unwrap();
|
||||
BufferView::new(
|
||||
buffer,
|
||||
BufferViewCreateInfo {
|
||||
@ -527,7 +521,7 @@ mod tests {
|
||||
#[test]
|
||||
fn create_storage_atomic() {
|
||||
// `VK_FORMAT_R32_UINT` guaranteed to be a supported format for atomics
|
||||
let (device, queue) = gfx_dev_and_queue!();
|
||||
let (_device, queue) = gfx_dev_and_queue!();
|
||||
|
||||
let usage = BufferUsage {
|
||||
storage_texel_buffer: true,
|
||||
@ -535,8 +529,7 @@ mod tests {
|
||||
};
|
||||
|
||||
let (buffer, _) =
|
||||
DeviceLocalBuffer::<[u32]>::from_iter((0..128).map(|_| 0), usage, queue.clone())
|
||||
.unwrap();
|
||||
DeviceLocalBuffer::<[u32]>::from_iter((0..128).map(|_| 0), usage, queue).unwrap();
|
||||
BufferView::new(
|
||||
buffer,
|
||||
BufferViewCreateInfo {
|
||||
@ -550,12 +543,12 @@ mod tests {
|
||||
#[test]
|
||||
fn wrong_usage() {
|
||||
// `VK_FORMAT_R8G8B8A8_UNORM` guaranteed to be a supported format
|
||||
let (device, queue) = gfx_dev_and_queue!();
|
||||
let (_device, queue) = gfx_dev_and_queue!();
|
||||
|
||||
let (buffer, _) = DeviceLocalBuffer::<[[u8; 4]]>::from_iter(
|
||||
(0..128).map(|_| [0; 4]),
|
||||
BufferUsage::none(),
|
||||
queue.clone(),
|
||||
queue,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@ -573,7 +566,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn unsupported_format() {
|
||||
let (device, queue) = gfx_dev_and_queue!();
|
||||
let (_device, queue) = gfx_dev_and_queue!();
|
||||
|
||||
let usage = BufferUsage {
|
||||
uniform_texel_buffer: true,
|
||||
@ -581,12 +574,9 @@ mod tests {
|
||||
..BufferUsage::none()
|
||||
};
|
||||
|
||||
let (buffer, _) = DeviceLocalBuffer::<[[f64; 4]]>::from_iter(
|
||||
(0..128).map(|_| [0.0; 4]),
|
||||
usage,
|
||||
queue.clone(),
|
||||
)
|
||||
.unwrap();
|
||||
let (buffer, _) =
|
||||
DeviceLocalBuffer::<[[f64; 4]]>::from_iter((0..128).map(|_| [0.0; 4]), usage, queue)
|
||||
.unwrap();
|
||||
|
||||
// TODO: what if R64G64B64A64_SFLOAT is supported?
|
||||
match BufferView::new(
|
||||
|
@ -164,7 +164,7 @@ impl AutoCommandBufferBuilder<SecondaryAutoCommandBuffer, StandardCommandPoolBui
|
||||
CommandBufferBeginError,
|
||||
> {
|
||||
unsafe {
|
||||
Ok(AutoCommandBufferBuilder::begin(
|
||||
AutoCommandBufferBuilder::begin(
|
||||
device,
|
||||
queue_family,
|
||||
CommandBufferLevel::Secondary,
|
||||
@ -173,7 +173,7 @@ impl AutoCommandBufferBuilder<SecondaryAutoCommandBuffer, StandardCommandPoolBui
|
||||
inheritance_info: Some(inheritance_info),
|
||||
_ne: crate::NonExhaustive(()),
|
||||
},
|
||||
)?)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -203,8 +203,8 @@ impl<L> AutoCommandBufferBuilder<L, StandardCommandPoolBuilder> {
|
||||
if let Some(inheritance_info) = &inheritance_info {
|
||||
let &CommandBufferInheritanceInfo {
|
||||
ref render_pass,
|
||||
occlusion_query,
|
||||
query_statistics_flags,
|
||||
occlusion_query: _,
|
||||
query_statistics_flags: _,
|
||||
_ne: _,
|
||||
} = inheritance_info;
|
||||
|
||||
@ -257,7 +257,7 @@ impl<L> AutoCommandBufferBuilder<L, StandardCommandPoolBuilder> {
|
||||
|
||||
fn validate_begin(
|
||||
device: &Device,
|
||||
queue_family: &QueueFamily,
|
||||
_queue_family: &QueueFamily,
|
||||
level: CommandBufferLevel,
|
||||
begin_info: &CommandBufferBeginInfo,
|
||||
) -> Result<(), CommandBufferBeginError> {
|
||||
@ -265,7 +265,7 @@ impl<L> AutoCommandBufferBuilder<L, StandardCommandPoolBuilder> {
|
||||
let properties = physical_device.properties();
|
||||
|
||||
let &CommandBufferBeginInfo {
|
||||
usage,
|
||||
usage: _,
|
||||
ref inheritance_info,
|
||||
_ne: _,
|
||||
} = &begin_info;
|
||||
@ -317,7 +317,7 @@ impl<L> AutoCommandBufferBuilder<L, StandardCommandPoolBuilder> {
|
||||
ref color_attachment_formats,
|
||||
depth_attachment_format,
|
||||
stencil_attachment_format,
|
||||
rasterization_samples,
|
||||
rasterization_samples: _, // TODO: ?
|
||||
} = rendering_info;
|
||||
|
||||
// VUID-VkCommandBufferInheritanceRenderingInfo-multiview-06008
|
||||
@ -563,7 +563,7 @@ where
|
||||
|
||||
Ok(PrimaryAutoCommandBuffer {
|
||||
inner: self.inner.build()?,
|
||||
pool_alloc: self.pool_builder_alloc.into_alloc(),
|
||||
_pool_alloc: self.pool_builder_alloc.into_alloc(),
|
||||
submit_state,
|
||||
})
|
||||
}
|
||||
@ -592,7 +592,7 @@ where
|
||||
|
||||
Ok(SecondaryAutoCommandBuffer {
|
||||
inner: self.inner.build()?,
|
||||
pool_alloc: self.pool_builder_alloc.into_alloc(),
|
||||
_pool_alloc: self.pool_builder_alloc.into_alloc(),
|
||||
inheritance_info: self.inheritance_info.unwrap(),
|
||||
submit_state,
|
||||
})
|
||||
@ -641,13 +641,13 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
// Render passes must be compatible.
|
||||
if !pipeline_subpass
|
||||
.render_pass()
|
||||
.is_compatible_with(&state.subpass.render_pass())
|
||||
.is_compatible_with(state.subpass.render_pass())
|
||||
{
|
||||
return Err(AutoCommandBufferBuilderContextError::IncompatibleRenderPass);
|
||||
}
|
||||
}
|
||||
RenderPassStateType::BeginRendering(state) => {
|
||||
let pipeline_rendering_info = match pipeline.render_pass() {
|
||||
RenderPassStateType::BeginRendering(_state) => {
|
||||
let _pipeline_rendering_info = match pipeline.render_pass() {
|
||||
PipelineRenderPassType::BeginRenderPass(_) => todo!(),
|
||||
PipelineRenderPassType::BeginRendering(rendering_info) => rendering_info,
|
||||
};
|
||||
@ -677,7 +677,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
// Render passes must be compatible.
|
||||
if !pipeline_subpass
|
||||
.render_pass()
|
||||
.is_compatible_with(&info.subpass.render_pass())
|
||||
.is_compatible_with(info.subpass.render_pass())
|
||||
{
|
||||
return Err(
|
||||
AutoCommandBufferBuilderContextError::IncompatibleRenderPass,
|
||||
@ -685,7 +685,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
}
|
||||
}
|
||||
CommandBufferInheritanceRenderPassType::BeginRendering(_) => {
|
||||
let pipeline_rendering_info = match pipeline.render_pass() {
|
||||
let _pipeline_rendering_info = match pipeline.render_pass() {
|
||||
PipelineRenderPassType::BeginRenderPass(_) => todo!(),
|
||||
PipelineRenderPassType::BeginRendering(rendering_info) => {
|
||||
rendering_info
|
||||
@ -725,7 +725,7 @@ unsafe impl<L, P> DeviceOwned for AutoCommandBufferBuilder<L, P> {
|
||||
|
||||
pub struct PrimaryAutoCommandBuffer<P = StandardCommandPoolAlloc> {
|
||||
inner: SyncCommandBuffer,
|
||||
pool_alloc: P, // Safety: must be dropped after `inner`
|
||||
_pool_alloc: P, // Safety: must be dropped after `inner`
|
||||
|
||||
// Tracks usage of the command buffer on the GPU.
|
||||
submit_state: SubmitState,
|
||||
@ -839,7 +839,7 @@ where
|
||||
|
||||
pub struct SecondaryAutoCommandBuffer<P = StandardCommandPoolAlloc> {
|
||||
inner: SyncCommandBuffer,
|
||||
pool_alloc: P, // Safety: must be dropped after `inner`
|
||||
_pool_alloc: P, // Safety: must be dropped after `inner`
|
||||
inheritance_info: CommandBufferInheritanceInfo,
|
||||
|
||||
// Tracks usage of the command buffer on the GPU.
|
||||
@ -1216,7 +1216,7 @@ mod tests {
|
||||
.unwrap();
|
||||
|
||||
let mut cbb = AutoCommandBufferBuilder::primary(
|
||||
device.clone(),
|
||||
device,
|
||||
queue.family(),
|
||||
CommandBufferUsage::OneTimeSubmit,
|
||||
)
|
||||
@ -1230,14 +1230,14 @@ mod tests {
|
||||
..Default::default()
|
||||
}]
|
||||
.into(),
|
||||
..CopyBufferInfoTyped::buffers(source.clone(), destination.clone())
|
||||
..CopyBufferInfoTyped::buffers(source, destination.clone())
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
let cb = cbb.build().unwrap();
|
||||
|
||||
let future = cb
|
||||
.execute(queue.clone())
|
||||
.execute(queue)
|
||||
.unwrap()
|
||||
.then_signal_fence_and_flush()
|
||||
.unwrap();
|
||||
@ -1296,7 +1296,7 @@ mod tests {
|
||||
let cb1 = builder.build().unwrap();
|
||||
|
||||
let mut builder = AutoCommandBufferBuilder::primary(
|
||||
device.clone(),
|
||||
device,
|
||||
queue.family(),
|
||||
CommandBufferUsage::SimultaneousUse,
|
||||
)
|
||||
@ -1316,7 +1316,7 @@ mod tests {
|
||||
std::mem::drop(cb1);
|
||||
|
||||
// Now that the first cb is dropped, we should be able to record.
|
||||
builder.execute_commands(secondary.clone()).unwrap();
|
||||
builder.execute_commands(secondary).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1333,7 +1333,7 @@ mod tests {
|
||||
.unwrap();
|
||||
|
||||
let mut builder = AutoCommandBufferBuilder::primary(
|
||||
device.clone(),
|
||||
device,
|
||||
queue.family(),
|
||||
CommandBufferUsage::OneTimeSubmit,
|
||||
)
|
||||
@ -1355,7 +1355,7 @@ mod tests {
|
||||
let cb = builder.build().unwrap();
|
||||
|
||||
let future = cb
|
||||
.execute(queue.clone())
|
||||
.execute(queue)
|
||||
.unwrap()
|
||||
.then_signal_fence_and_flush()
|
||||
.unwrap();
|
||||
@ -1379,7 +1379,7 @@ mod tests {
|
||||
.unwrap();
|
||||
|
||||
let mut builder = AutoCommandBufferBuilder::primary(
|
||||
device.clone(),
|
||||
device,
|
||||
queue.family(),
|
||||
CommandBufferUsage::OneTimeSubmit,
|
||||
)
|
||||
@ -1394,7 +1394,7 @@ mod tests {
|
||||
..Default::default()
|
||||
}]
|
||||
.into(),
|
||||
..CopyBufferInfoTyped::buffers(source.clone(), source.clone())
|
||||
..CopyBufferInfoTyped::buffers(source.clone(), source)
|
||||
}),
|
||||
Err(CopyError::OverlappingRegions {
|
||||
src_region_index: 0,
|
||||
|
@ -658,7 +658,7 @@ impl SyncCommandBufferBuilder {
|
||||
let set_resources = match state
|
||||
.descriptor_sets
|
||||
.entry(set_num)
|
||||
.or_insert(SetOrPush::Push(DescriptorSetResources::new(layout, 0)))
|
||||
.or_insert_with(|| SetOrPush::Push(DescriptorSetResources::new(layout, 0)))
|
||||
{
|
||||
SetOrPush::Push(set_resources) => set_resources,
|
||||
_ => unreachable!(),
|
||||
@ -720,8 +720,7 @@ impl<'b> SyncCommandBufferBuilderBindDescriptorSets<'b> {
|
||||
let dynamic_offsets = self
|
||||
.descriptor_sets
|
||||
.iter()
|
||||
.map(|x| x.as_ref().1.iter().copied())
|
||||
.flatten();
|
||||
.flat_map(|x| x.as_ref().1.iter().copied());
|
||||
|
||||
out.bind_descriptor_sets(
|
||||
self.pipeline_bind_point,
|
||||
@ -775,7 +774,7 @@ impl<'a> SyncCommandBufferBuilderBindVertexBuffer<'a> {
|
||||
struct Cmd {
|
||||
first_set: u32,
|
||||
inner: Mutex<Option<UnsafeCommandBufferBuilderBindVertexBuffer>>,
|
||||
buffers: SmallVec<[Arc<dyn BufferAccess>; 4]>,
|
||||
_buffers: SmallVec<[Arc<dyn BufferAccess>; 4]>,
|
||||
}
|
||||
|
||||
impl Command for Cmd {
|
||||
@ -798,7 +797,7 @@ impl<'a> SyncCommandBufferBuilderBindVertexBuffer<'a> {
|
||||
self.builder.commands.push(Box::new(Cmd {
|
||||
first_set,
|
||||
inner: Mutex::new(Some(self.inner)),
|
||||
buffers: self.buffers,
|
||||
_buffers: self.buffers,
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
|
||||
fn validate_begin_debug_utils_label(
|
||||
&self,
|
||||
label_info: &mut DebugUtilsLabel,
|
||||
_label_info: &mut DebugUtilsLabel,
|
||||
) -> Result<(), DebugUtilsError> {
|
||||
if !self
|
||||
.device()
|
||||
@ -123,7 +123,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
|
||||
fn validate_insert_debug_utils_label(
|
||||
&self,
|
||||
label_info: &mut DebugUtilsLabel,
|
||||
_label_info: &mut DebugUtilsLabel,
|
||||
) -> Result<(), DebugUtilsError> {
|
||||
if !self
|
||||
.device()
|
||||
|
@ -59,7 +59,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
|
||||
fn validate_set_blend_constants(
|
||||
&self,
|
||||
constants: [f32; 4],
|
||||
_constants: [f32; 4],
|
||||
) -> Result<(), SetDynamicStateError> {
|
||||
if self.has_fixed_state(DynamicState::BlendConstants) {
|
||||
return Err(SetDynamicStateError::PipelineHasFixedState);
|
||||
@ -162,7 +162,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
self
|
||||
}
|
||||
|
||||
fn validate_set_cull_mode(&self, cull_mode: CullMode) -> Result<(), SetDynamicStateError> {
|
||||
fn validate_set_cull_mode(&self, _cull_mode: CullMode) -> Result<(), SetDynamicStateError> {
|
||||
if self.has_fixed_state(DynamicState::CullMode) {
|
||||
return Err(SetDynamicStateError::PipelineHasFixedState);
|
||||
}
|
||||
@ -213,9 +213,9 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
|
||||
fn validate_set_depth_bias(
|
||||
&self,
|
||||
constant_factor: f32,
|
||||
_constant_factor: f32,
|
||||
clamp: f32,
|
||||
slope_factor: f32,
|
||||
_slope_factor: f32,
|
||||
) -> Result<(), SetDynamicStateError> {
|
||||
if self.has_fixed_state(DynamicState::DepthBias) {
|
||||
return Err(SetDynamicStateError::PipelineHasFixedState);
|
||||
@ -257,7 +257,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
self
|
||||
}
|
||||
|
||||
fn validate_set_depth_bias_enable(&self, enable: bool) -> Result<(), SetDynamicStateError> {
|
||||
fn validate_set_depth_bias_enable(&self, _enable: bool) -> Result<(), SetDynamicStateError> {
|
||||
if self.has_fixed_state(DynamicState::DepthBiasEnable) {
|
||||
return Err(SetDynamicStateError::PipelineHasFixedState);
|
||||
}
|
||||
@ -352,7 +352,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
|
||||
fn validate_set_depth_bounds_test_enable(
|
||||
&self,
|
||||
enable: bool,
|
||||
_enable: bool,
|
||||
) -> Result<(), SetDynamicStateError> {
|
||||
if self.has_fixed_state(DynamicState::DepthBoundsTestEnable) {
|
||||
return Err(SetDynamicStateError::PipelineHasFixedState);
|
||||
@ -398,7 +398,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
|
||||
fn validate_set_depth_compare_op(
|
||||
&self,
|
||||
compare_op: CompareOp,
|
||||
_compare_op: CompareOp,
|
||||
) -> Result<(), SetDynamicStateError> {
|
||||
if self.has_fixed_state(DynamicState::DepthCompareOp) {
|
||||
return Err(SetDynamicStateError::PipelineHasFixedState);
|
||||
@ -442,7 +442,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
self
|
||||
}
|
||||
|
||||
fn validate_set_depth_test_enable(&self, enable: bool) -> Result<(), SetDynamicStateError> {
|
||||
fn validate_set_depth_test_enable(&self, _enable: bool) -> Result<(), SetDynamicStateError> {
|
||||
if self.has_fixed_state(DynamicState::DepthTestEnable) {
|
||||
return Err(SetDynamicStateError::PipelineHasFixedState);
|
||||
}
|
||||
@ -485,7 +485,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
self
|
||||
}
|
||||
|
||||
fn validate_set_depth_write_enable(&self, enable: bool) -> Result<(), SetDynamicStateError> {
|
||||
fn validate_set_depth_write_enable(&self, _enable: bool) -> Result<(), SetDynamicStateError> {
|
||||
if self.has_fixed_state(DynamicState::DepthWriteEnable) {
|
||||
return Err(SetDynamicStateError::PipelineHasFixedState);
|
||||
}
|
||||
@ -600,7 +600,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
self
|
||||
}
|
||||
|
||||
fn validate_set_front_face(&self, face: FrontFace) -> Result<(), SetDynamicStateError> {
|
||||
fn validate_set_front_face(&self, _face: FrontFace) -> Result<(), SetDynamicStateError> {
|
||||
if self.has_fixed_state(DynamicState::FrontFace) {
|
||||
return Err(SetDynamicStateError::PipelineHasFixedState);
|
||||
}
|
||||
@ -646,7 +646,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
fn validate_set_line_stipple(
|
||||
&self,
|
||||
factor: u32,
|
||||
pattern: u16,
|
||||
_pattern: u16,
|
||||
) -> Result<(), SetDynamicStateError> {
|
||||
if self.has_fixed_state(DynamicState::LineStipple) {
|
||||
return Err(SetDynamicStateError::PipelineHasFixedState);
|
||||
@ -731,7 +731,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
self
|
||||
}
|
||||
|
||||
fn validate_set_logic_op(&self, logic_op: LogicOp) -> Result<(), SetDynamicStateError> {
|
||||
fn validate_set_logic_op(&self, _logic_op: LogicOp) -> Result<(), SetDynamicStateError> {
|
||||
if self.has_fixed_state(DynamicState::LogicOp) {
|
||||
return Err(SetDynamicStateError::PipelineHasFixedState);
|
||||
}
|
||||
@ -848,7 +848,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
|
||||
fn validate_set_primitive_restart_enable(
|
||||
&self,
|
||||
enable: bool,
|
||||
_enable: bool,
|
||||
) -> Result<(), SetDynamicStateError> {
|
||||
if self.has_fixed_state(DynamicState::PrimitiveRestartEnable) {
|
||||
return Err(SetDynamicStateError::PipelineHasFixedState);
|
||||
@ -970,7 +970,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
|
||||
fn validate_set_rasterizer_discard_enable(
|
||||
&self,
|
||||
enable: bool,
|
||||
_enable: bool,
|
||||
) -> Result<(), SetDynamicStateError> {
|
||||
if self.has_fixed_state(DynamicState::RasterizerDiscardEnable) {
|
||||
return Err(SetDynamicStateError::PipelineHasFixedState);
|
||||
@ -1156,8 +1156,8 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
|
||||
fn validate_set_stencil_compare_mask(
|
||||
&self,
|
||||
faces: StencilFaces,
|
||||
compare_mask: u32,
|
||||
_faces: StencilFaces,
|
||||
_compare_mask: u32,
|
||||
) -> Result<(), SetDynamicStateError> {
|
||||
if self.has_fixed_state(DynamicState::StencilCompareMask) {
|
||||
return Err(SetDynamicStateError::PipelineHasFixedState);
|
||||
@ -1202,11 +1202,11 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
|
||||
fn validate_set_stencil_op(
|
||||
&self,
|
||||
faces: StencilFaces,
|
||||
fail_op: StencilOp,
|
||||
pass_op: StencilOp,
|
||||
depth_fail_op: StencilOp,
|
||||
compare_op: CompareOp,
|
||||
_faces: StencilFaces,
|
||||
_fail_op: StencilOp,
|
||||
_pass_op: StencilOp,
|
||||
_depth_fail_op: StencilOp,
|
||||
_compare_op: CompareOp,
|
||||
) -> Result<(), SetDynamicStateError> {
|
||||
if self.has_fixed_state(DynamicState::StencilOp) {
|
||||
return Err(SetDynamicStateError::PipelineHasFixedState);
|
||||
@ -1249,8 +1249,8 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
|
||||
fn validate_set_stencil_reference(
|
||||
&self,
|
||||
faces: StencilFaces,
|
||||
reference: u32,
|
||||
_faces: StencilFaces,
|
||||
_reference: u32,
|
||||
) -> Result<(), SetDynamicStateError> {
|
||||
if self.has_fixed_state(DynamicState::StencilReference) {
|
||||
return Err(SetDynamicStateError::PipelineHasFixedState);
|
||||
@ -1284,7 +1284,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
self
|
||||
}
|
||||
|
||||
fn validate_set_stencil_test_enable(&self, enable: bool) -> Result<(), SetDynamicStateError> {
|
||||
fn validate_set_stencil_test_enable(&self, _enable: bool) -> Result<(), SetDynamicStateError> {
|
||||
if self.has_fixed_state(DynamicState::StencilTestEnable) {
|
||||
return Err(SetDynamicStateError::PipelineHasFixedState);
|
||||
}
|
||||
@ -1326,8 +1326,8 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
|
||||
fn validate_set_stencil_write_mask(
|
||||
&self,
|
||||
faces: StencilFaces,
|
||||
write_mask: u32,
|
||||
_faces: StencilFaces,
|
||||
_write_mask: u32,
|
||||
) -> Result<(), SetDynamicStateError> {
|
||||
if self.has_fixed_state(DynamicState::StencilWriteMask) {
|
||||
return Err(SetDynamicStateError::PipelineHasFixedState);
|
||||
@ -1743,9 +1743,7 @@ impl SyncCommandBufferBuilder {
|
||||
|
||||
for (num, rectangle) in rectangles.iter().enumerate() {
|
||||
let num = num as u32 + first_rectangle;
|
||||
self.current_state
|
||||
.discard_rectangle
|
||||
.insert(num, rectangle.clone());
|
||||
self.current_state.discard_rectangle.insert(num, *rectangle);
|
||||
}
|
||||
|
||||
self.commands.push(Box::new(Cmd {
|
||||
@ -2130,7 +2128,7 @@ impl SyncCommandBufferBuilder {
|
||||
|
||||
for (num, scissor) in scissors.iter().enumerate() {
|
||||
let num = num as u32 + first_scissor;
|
||||
self.current_state.scissor.insert(num, scissor.clone());
|
||||
self.current_state.scissor.insert(num, *scissor);
|
||||
}
|
||||
|
||||
self.commands.push(Box::new(Cmd {
|
||||
@ -2379,7 +2377,7 @@ impl UnsafeCommandBufferBuilder {
|
||||
|
||||
let rectangles = rectangles
|
||||
.into_iter()
|
||||
.map(|v| v.clone().into())
|
||||
.map(|v| v.into())
|
||||
.collect::<SmallVec<[_; 2]>>();
|
||||
if rectangles.is_empty() {
|
||||
return;
|
||||
@ -2577,7 +2575,7 @@ impl UnsafeCommandBufferBuilder {
|
||||
) {
|
||||
let scissors = scissors
|
||||
.into_iter()
|
||||
.map(|v| ash::vk::Rect2D::from(v.clone()))
|
||||
.map(ash::vk::Rect2D::from)
|
||||
.collect::<SmallVec<[_; 2]>>();
|
||||
if scissors.is_empty() {
|
||||
return;
|
||||
@ -2599,7 +2597,7 @@ impl UnsafeCommandBufferBuilder {
|
||||
pub unsafe fn set_scissor_with_count(&mut self, scissors: impl IntoIterator<Item = Scissor>) {
|
||||
let scissors = scissors
|
||||
.into_iter()
|
||||
.map(|v| ash::vk::Rect2D::from(v.clone()))
|
||||
.map(ash::vk::Rect2D::from)
|
||||
.collect::<SmallVec<[_; 2]>>();
|
||||
if scissors.is_empty() {
|
||||
return;
|
||||
@ -2635,7 +2633,7 @@ impl UnsafeCommandBufferBuilder {
|
||||
) {
|
||||
let viewports = viewports
|
||||
.into_iter()
|
||||
.map(|v| v.clone().into())
|
||||
.map(|v| v.into())
|
||||
.collect::<SmallVec<[_; 2]>>();
|
||||
if viewports.is_empty() {
|
||||
return;
|
||||
@ -2660,7 +2658,7 @@ impl UnsafeCommandBufferBuilder {
|
||||
) {
|
||||
let viewports = viewports
|
||||
.into_iter()
|
||||
.map(|v| v.clone().into())
|
||||
.map(|v| v.into())
|
||||
.collect::<SmallVec<[_; 2]>>();
|
||||
if viewports.is_empty() {
|
||||
return;
|
||||
@ -2687,6 +2685,7 @@ impl UnsafeCommandBufferBuilder {
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
#[allow(dead_code)]
|
||||
enum SetDynamicStateError {
|
||||
ExtensionNotEnabled {
|
||||
extension: &'static str,
|
||||
|
@ -599,7 +599,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
let &mut ClearColorImageInfo {
|
||||
ref image,
|
||||
image_layout,
|
||||
clear_value,
|
||||
clear_value: _,
|
||||
ref regions,
|
||||
_ne: _,
|
||||
} = clear_info;
|
||||
@ -1070,7 +1070,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
assert!(extent[0] != 0 && extent[1] != 0 && extent[2] != 0);
|
||||
|
||||
let check_offset_extent = |resource: CopyErrorResource,
|
||||
image_type: ImageType,
|
||||
_image_type: ImageType,
|
||||
subresource_extent: [u32; 3],
|
||||
offset: [u32; 3]|
|
||||
-> Result<_, CopyError> {
|
||||
@ -1153,7 +1153,7 @@ impl SyncCommandBufferBuilder {
|
||||
ref dst_image,
|
||||
dst_image_layout,
|
||||
ref regions,
|
||||
filter,
|
||||
filter: _,
|
||||
_ne: _,
|
||||
} = &blit_image_info;
|
||||
|
||||
@ -1162,9 +1162,9 @@ impl SyncCommandBufferBuilder {
|
||||
.flat_map(|region| {
|
||||
let &ImageBlit {
|
||||
ref src_subresource,
|
||||
src_offsets,
|
||||
src_offsets: _,
|
||||
ref dst_subresource,
|
||||
dst_offsets,
|
||||
dst_offsets: _,
|
||||
_ne: _,
|
||||
} = region;
|
||||
|
||||
@ -1251,7 +1251,7 @@ impl SyncCommandBufferBuilder {
|
||||
let &ClearColorImageInfo {
|
||||
ref image,
|
||||
image_layout,
|
||||
clear_value,
|
||||
clear_value: _,
|
||||
ref regions,
|
||||
_ne: _,
|
||||
} = &clear_info;
|
||||
@ -1321,7 +1321,7 @@ impl SyncCommandBufferBuilder {
|
||||
let &ClearDepthStencilImageInfo {
|
||||
ref image,
|
||||
image_layout,
|
||||
clear_value,
|
||||
clear_value: _,
|
||||
ref regions,
|
||||
_ne: _,
|
||||
} = &clear_info;
|
||||
@ -1403,10 +1403,10 @@ impl SyncCommandBufferBuilder {
|
||||
.flat_map(|region| {
|
||||
let &ImageResolve {
|
||||
ref src_subresource,
|
||||
src_offset,
|
||||
src_offset: _,
|
||||
ref dst_subresource,
|
||||
dst_offset,
|
||||
extent,
|
||||
dst_offset: _,
|
||||
extent: _,
|
||||
_ne: _,
|
||||
} = region;
|
||||
|
||||
|
@ -391,7 +391,7 @@ fn check_descriptor_sets_validity<'a, P: Pipeline>(
|
||||
let layout_binding =
|
||||
&pipeline.layout().set_layouts()[set_num as usize].bindings()[&binding_num];
|
||||
|
||||
let check_buffer = |index: u32, buffer: &Arc<dyn BufferAccess>| Ok(());
|
||||
let check_buffer = |_index: u32, _buffer: &Arc<dyn BufferAccess>| Ok(());
|
||||
|
||||
let check_buffer_view = |index: u32, buffer_view: &Arc<dyn BufferViewAbstract>| {
|
||||
if layout_binding.descriptor_type == DescriptorType::StorageTexelBuffer {
|
||||
@ -804,12 +804,7 @@ impl fmt::Display for InvalidDescriptorResource {
|
||||
Self::Missing => {
|
||||
write!(fmt, "no resource was bound")
|
||||
}
|
||||
Self::SamplerImageViewIncompatible {
|
||||
image_view_set_num,
|
||||
image_view_binding_num,
|
||||
image_view_index,
|
||||
..
|
||||
} => {
|
||||
Self::SamplerImageViewIncompatible { .. } => {
|
||||
write!(
|
||||
fmt,
|
||||
"the bound sampler samples an image view that is not compatible with it"
|
||||
@ -1331,8 +1326,7 @@ fn check_index_buffer(
|
||||
return Err(CheckIndexBufferError::TooManyIndices {
|
||||
index_count,
|
||||
max_index_count,
|
||||
}
|
||||
.into());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -1432,10 +1426,7 @@ impl fmt::Display for CheckIndirectBufferError {
|
||||
CheckIndirectBufferError::BufferMissingUsage => {
|
||||
"the indirect buffer usage must be enabled on the indirect buffer"
|
||||
}
|
||||
CheckIndirectBufferError::MaxDrawIndirectCountLimitExceeded {
|
||||
limit,
|
||||
requested,
|
||||
} => {
|
||||
CheckIndirectBufferError::MaxDrawIndirectCountLimitExceeded { .. } => {
|
||||
"the maximum number of indirect draws has been exceeded"
|
||||
}
|
||||
}
|
||||
@ -1511,8 +1502,7 @@ fn check_vertex_buffers(
|
||||
return Err(CheckVertexBufferError::TooManyInstances {
|
||||
instance_count,
|
||||
max_instance_count,
|
||||
}
|
||||
.into());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -1536,8 +1526,7 @@ fn check_vertex_buffers(
|
||||
return Err(CheckVertexBufferError::TooManyInstances {
|
||||
instance_count,
|
||||
max_instance_count: max_instance_index + 1, // TODO: this can overflow
|
||||
}
|
||||
.into());
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
) -> Result<(), QueryError> {
|
||||
// VUID-vkCmdBeginQuery-commandBuffer-cmdpool
|
||||
if !(self.queue_family().supports_graphics() || self.queue_family().supports_compute()) {
|
||||
return Err(QueryError::NotSupportedByQueueFamily.into());
|
||||
return Err(QueryError::NotSupportedByQueueFamily);
|
||||
}
|
||||
|
||||
let device = self.device();
|
||||
@ -175,7 +175,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
fn validate_end_query(&self, query_pool: &QueryPool, query: u32) -> Result<(), QueryError> {
|
||||
// VUID-vkCmdEndQuery-commandBuffer-cmdpool
|
||||
if !(self.queue_family().supports_graphics() || self.queue_family().supports_compute()) {
|
||||
return Err(QueryError::NotSupportedByQueueFamily.into());
|
||||
return Err(QueryError::NotSupportedByQueueFamily);
|
||||
}
|
||||
|
||||
let device = self.device();
|
||||
@ -191,7 +191,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
state.query_pool == query_pool.internal_object() && state.query == query
|
||||
})
|
||||
{
|
||||
return Err(QueryError::QueryNotActive.into());
|
||||
return Err(QueryError::QueryNotActive);
|
||||
}
|
||||
|
||||
// VUID-vkCmdEndQuery-query-00810
|
||||
@ -256,7 +256,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
|| self.queue_family().supports_graphics()
|
||||
|| self.queue_family().supports_compute())
|
||||
{
|
||||
return Err(QueryError::NotSupportedByQueueFamily.into());
|
||||
return Err(QueryError::NotSupportedByQueueFamily);
|
||||
}
|
||||
|
||||
let device = self.device();
|
||||
@ -391,7 +391,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
{
|
||||
// VUID-vkCmdCopyQueryPoolResults-commandBuffer-cmdpool
|
||||
if !(self.queue_family().supports_graphics() || self.queue_family().supports_compute()) {
|
||||
return Err(QueryError::NotSupportedByQueueFamily.into());
|
||||
return Err(QueryError::NotSupportedByQueueFamily);
|
||||
}
|
||||
|
||||
// VUID-vkCmdCopyQueryPoolResults-renderpass
|
||||
@ -476,7 +476,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
|
||||
// VUID-vkCmdResetQueryPool-commandBuffer-cmdpool
|
||||
if !(self.queue_family().supports_graphics() || self.queue_family().supports_compute()) {
|
||||
return Err(QueryError::NotSupportedByQueueFamily.into());
|
||||
return Err(QueryError::NotSupportedByQueueFamily);
|
||||
}
|
||||
|
||||
let device = self.device();
|
||||
@ -494,7 +494,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
if self.query_state.values().any(|state| {
|
||||
state.query_pool == query_pool.internal_object() && queries.contains(&state.query)
|
||||
}) {
|
||||
return Err(QueryError::QueryIsActive.into());
|
||||
return Err(QueryError::QueryIsActive);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
@ -84,7 +84,7 @@ where
|
||||
fn validate_begin_render_pass(
|
||||
&self,
|
||||
render_pass_begin_info: &mut RenderPassBeginInfo,
|
||||
contents: SubpassContents,
|
||||
_contents: SubpassContents,
|
||||
) -> Result<(), RenderPassError> {
|
||||
let device = self.device();
|
||||
|
||||
@ -407,12 +407,12 @@ where
|
||||
Ok(self)
|
||||
}
|
||||
|
||||
fn validate_next_subpass(&self, contents: SubpassContents) -> Result<(), RenderPassError> {
|
||||
fn validate_next_subpass(&self, _contents: SubpassContents) -> Result<(), RenderPassError> {
|
||||
// VUID-vkCmdNextSubpass2-renderpass
|
||||
let render_pass_state = self
|
||||
.render_pass_state
|
||||
.as_ref()
|
||||
.ok_or_else(|| RenderPassError::ForbiddenOutsideRenderPass)?;
|
||||
.ok_or(RenderPassError::ForbiddenOutsideRenderPass)?;
|
||||
|
||||
let begin_render_pass_state = match &render_pass_state.render_pass {
|
||||
RenderPassStateType::BeginRenderPass(state) => state,
|
||||
@ -463,7 +463,7 @@ where
|
||||
let render_pass_state = self
|
||||
.render_pass_state
|
||||
.as_ref()
|
||||
.ok_or_else(|| RenderPassError::ForbiddenOutsideRenderPass)?;
|
||||
.ok_or(RenderPassError::ForbiddenOutsideRenderPass)?;
|
||||
|
||||
let begin_render_pass_state = match &render_pass_state.render_pass {
|
||||
RenderPassStateType::BeginRenderPass(state) => state,
|
||||
@ -518,7 +518,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
ref color_attachments,
|
||||
ref depth_attachment,
|
||||
ref stencil_attachment,
|
||||
contents,
|
||||
contents: _,
|
||||
_ne: _,
|
||||
} = &mut rendering_info;
|
||||
|
||||
@ -597,7 +597,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
let &RenderingInfo {
|
||||
render_area_offset,
|
||||
render_area_extent,
|
||||
layer_count,
|
||||
layer_count: _,
|
||||
view_mask,
|
||||
ref color_attachments,
|
||||
ref depth_attachment,
|
||||
@ -717,9 +717,9 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
ref image_view,
|
||||
image_layout,
|
||||
ref resolve_info,
|
||||
load_op,
|
||||
store_op,
|
||||
clear_value,
|
||||
load_op: _,
|
||||
store_op: _,
|
||||
clear_value: _,
|
||||
_ne: _,
|
||||
} = attachment_info;
|
||||
|
||||
@ -742,7 +742,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
// VUID-VkRenderingInfo-imageView-06070
|
||||
match samples {
|
||||
Some(samples) if samples == image.samples() => (),
|
||||
Some(samples) => {
|
||||
Some(_) => {
|
||||
return Err(RenderPassError::ColorAttachmentSamplesMismatch {
|
||||
attachment_index,
|
||||
});
|
||||
@ -851,9 +851,9 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
ref image_view,
|
||||
image_layout,
|
||||
ref resolve_info,
|
||||
load_op,
|
||||
store_op,
|
||||
clear_value,
|
||||
load_op: _,
|
||||
store_op: _,
|
||||
clear_value: _,
|
||||
_ne: _,
|
||||
} = attachment_info;
|
||||
|
||||
@ -883,7 +883,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
// VUID-VkRenderingInfo-imageView-06070
|
||||
match samples {
|
||||
Some(samples) if samples == image.samples() => (),
|
||||
Some(samples) => {
|
||||
Some(_) => {
|
||||
return Err(RenderPassError::DepthAttachmentSamplesMismatch);
|
||||
}
|
||||
None => samples = Some(image.samples()),
|
||||
@ -961,9 +961,9 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
ref image_view,
|
||||
image_layout,
|
||||
ref resolve_info,
|
||||
load_op,
|
||||
store_op,
|
||||
clear_value,
|
||||
load_op: _,
|
||||
store_op: _,
|
||||
clear_value: _,
|
||||
_ne: _,
|
||||
} = attachment_info;
|
||||
|
||||
@ -993,7 +993,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
// VUID-VkRenderingInfo-imageView-06070
|
||||
match samples {
|
||||
Some(samples) if samples == image.samples() => (),
|
||||
Some(samples) => {
|
||||
Some(_) => {
|
||||
return Err(RenderPassError::StencilAttachmentSamplesMismatch);
|
||||
}
|
||||
None => (),
|
||||
@ -1123,13 +1123,11 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
}
|
||||
|
||||
fn validate_end_rendering(&self) -> Result<(), RenderPassError> {
|
||||
let device = self.device();
|
||||
|
||||
// VUID-vkCmdEndRendering-renderpass
|
||||
let render_pass_state = self
|
||||
.render_pass_state
|
||||
.as_ref()
|
||||
.ok_or_else(|| RenderPassError::ForbiddenOutsideRenderPass)?;
|
||||
.ok_or(RenderPassError::ForbiddenOutsideRenderPass)?;
|
||||
|
||||
// VUID-vkCmdEndRendering-None-06161
|
||||
// VUID-vkCmdEndRendering-commandBuffer-06162
|
||||
@ -1228,12 +1226,12 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
let attachment_format = match &render_pass_state.render_pass {
|
||||
RenderPassStateType::BeginRenderPass(state) => {
|
||||
let color_attachments = &state.subpass.subpass_desc().color_attachments;
|
||||
let atch_ref = color_attachments
|
||||
.get(color_attachment as usize)
|
||||
.ok_or_else(|| RenderPassError::ColorAttachmentIndexOutOfRange {
|
||||
let atch_ref = color_attachments.get(color_attachment as usize).ok_or(
|
||||
RenderPassError::ColorAttachmentIndexOutOfRange {
|
||||
color_attachment_index: color_attachment,
|
||||
num_color_attachments: color_attachments.len() as u32,
|
||||
})?;
|
||||
},
|
||||
)?;
|
||||
|
||||
atch_ref.as_ref().map(|atch_ref| {
|
||||
let image_view =
|
||||
@ -1251,7 +1249,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
RenderPassStateType::BeginRendering(state) => state
|
||||
.color_attachments
|
||||
.get(color_attachment as usize)
|
||||
.ok_or_else(|| RenderPassError::ColorAttachmentIndexOutOfRange {
|
||||
.ok_or(RenderPassError::ColorAttachmentIndexOutOfRange {
|
||||
color_attachment_index: color_attachment,
|
||||
num_color_attachments: state.color_attachments.len() as u32,
|
||||
})?
|
||||
@ -1278,7 +1276,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
&info.subpass.subpass_desc().color_attachments;
|
||||
let atch_ref = color_attachments
|
||||
.get(color_attachment as usize)
|
||||
.ok_or_else(|| {
|
||||
.ok_or({
|
||||
RenderPassError::ColorAttachmentIndexOutOfRange {
|
||||
color_attachment_index: color_attachment,
|
||||
num_color_attachments: color_attachments.len()
|
||||
@ -1309,7 +1307,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
*info
|
||||
.color_attachment_formats
|
||||
.get(color_attachment as usize)
|
||||
.ok_or_else(|| {
|
||||
.ok_or({
|
||||
RenderPassError::ColorAttachmentIndexOutOfRange {
|
||||
color_attachment_index: color_attachment,
|
||||
num_color_attachments: info
|
||||
@ -1533,9 +1531,9 @@ impl SyncCommandBufferBuilder {
|
||||
let &RenderPassBeginInfo {
|
||||
ref render_pass,
|
||||
ref framebuffer,
|
||||
render_area_offset,
|
||||
render_area_extent,
|
||||
ref clear_values,
|
||||
render_area_offset: _,
|
||||
render_area_extent: _,
|
||||
clear_values: _,
|
||||
_ne: _,
|
||||
} = &render_pass_begin_info;
|
||||
|
||||
@ -1652,14 +1650,14 @@ impl SyncCommandBufferBuilder {
|
||||
}
|
||||
|
||||
let &RenderingInfo {
|
||||
render_area_offset,
|
||||
render_area_extent,
|
||||
layer_count,
|
||||
view_mask,
|
||||
render_area_offset: _,
|
||||
render_area_extent: _,
|
||||
layer_count: _,
|
||||
view_mask: _,
|
||||
ref color_attachments,
|
||||
ref depth_attachment,
|
||||
ref stencil_attachment,
|
||||
contents,
|
||||
contents: _,
|
||||
_ne,
|
||||
} = &rendering_info;
|
||||
|
||||
@ -1675,10 +1673,10 @@ impl SyncCommandBufferBuilder {
|
||||
let &RenderingAttachmentInfo {
|
||||
ref image_view,
|
||||
image_layout,
|
||||
resolve_info: ref resolve,
|
||||
load_op,
|
||||
store_op,
|
||||
clear_value,
|
||||
ref resolve_info,
|
||||
load_op: _,
|
||||
store_op: _,
|
||||
clear_value: _,
|
||||
_ne: _,
|
||||
} = attachment_info;
|
||||
|
||||
@ -1704,9 +1702,9 @@ impl SyncCommandBufferBuilder {
|
||||
end_layout: image_layout,
|
||||
},
|
||||
)),
|
||||
attachment_info.resolve_info.as_ref().map(|resolve_info| {
|
||||
resolve_info.as_ref().map(|resolve_info| {
|
||||
let &RenderingAttachmentResolveInfo {
|
||||
mode,
|
||||
mode: _,
|
||||
ref image_view,
|
||||
image_layout,
|
||||
} = resolve_info;
|
||||
@ -1714,11 +1712,8 @@ impl SyncCommandBufferBuilder {
|
||||
(
|
||||
format!("color resolve attachment {}", index).into(),
|
||||
Resource::Image {
|
||||
image: resolve_info.image_view.image(),
|
||||
subresource_range: resolve_info
|
||||
.image_view
|
||||
.subresource_range()
|
||||
.clone(),
|
||||
image: image_view.image(),
|
||||
subresource_range: image_view.subresource_range().clone(),
|
||||
memory: PipelineMemoryAccess {
|
||||
stages: PipelineStages {
|
||||
all_commands: true,
|
||||
@ -1731,8 +1726,8 @@ impl SyncCommandBufferBuilder {
|
||||
}, // TODO: suboptimal
|
||||
exclusive: true, // TODO: suboptimal
|
||||
},
|
||||
start_layout: resolve_info.image_layout,
|
||||
end_layout: resolve_info.image_layout,
|
||||
start_layout: image_layout,
|
||||
end_layout: image_layout,
|
||||
},
|
||||
)
|
||||
}),
|
||||
@ -1744,10 +1739,10 @@ impl SyncCommandBufferBuilder {
|
||||
let &RenderingAttachmentInfo {
|
||||
ref image_view,
|
||||
image_layout,
|
||||
resolve_info: ref resolve,
|
||||
load_op,
|
||||
store_op,
|
||||
clear_value,
|
||||
ref resolve_info,
|
||||
load_op: _,
|
||||
store_op: _,
|
||||
clear_value: _,
|
||||
_ne: _,
|
||||
} = attachment_info;
|
||||
|
||||
@ -1773,9 +1768,9 @@ impl SyncCommandBufferBuilder {
|
||||
end_layout: image_layout,
|
||||
},
|
||||
)),
|
||||
attachment_info.resolve_info.as_ref().map(|resolve_info| {
|
||||
resolve_info.as_ref().map(|resolve_info| {
|
||||
let &RenderingAttachmentResolveInfo {
|
||||
mode,
|
||||
mode: _,
|
||||
ref image_view,
|
||||
image_layout,
|
||||
} = resolve_info;
|
||||
@ -1783,8 +1778,8 @@ impl SyncCommandBufferBuilder {
|
||||
(
|
||||
"depth resolve attachment".into(),
|
||||
Resource::Image {
|
||||
image: resolve_info.image_view.image(),
|
||||
subresource_range: resolve_info.image_view.subresource_range().clone(),
|
||||
image: image_view.image(),
|
||||
subresource_range: image_view.subresource_range().clone(),
|
||||
memory: PipelineMemoryAccess {
|
||||
stages: PipelineStages {
|
||||
all_commands: true,
|
||||
@ -1797,8 +1792,8 @@ impl SyncCommandBufferBuilder {
|
||||
}, // TODO: suboptimal
|
||||
exclusive: true, // TODO: suboptimal
|
||||
},
|
||||
start_layout: resolve_info.image_layout,
|
||||
end_layout: resolve_info.image_layout,
|
||||
start_layout: image_layout,
|
||||
end_layout: image_layout,
|
||||
},
|
||||
)
|
||||
}),
|
||||
@ -1810,10 +1805,10 @@ impl SyncCommandBufferBuilder {
|
||||
let &RenderingAttachmentInfo {
|
||||
ref image_view,
|
||||
image_layout,
|
||||
resolve_info: ref resolve,
|
||||
load_op,
|
||||
store_op,
|
||||
clear_value,
|
||||
ref resolve_info,
|
||||
load_op: _,
|
||||
store_op: _,
|
||||
clear_value: _,
|
||||
_ne: _,
|
||||
} = attachment_info;
|
||||
|
||||
@ -1839,9 +1834,9 @@ impl SyncCommandBufferBuilder {
|
||||
end_layout: image_layout,
|
||||
},
|
||||
)),
|
||||
attachment_info.resolve_info.as_ref().map(|resolve_info| {
|
||||
resolve_info.as_ref().map(|resolve_info| {
|
||||
let &RenderingAttachmentResolveInfo {
|
||||
mode,
|
||||
mode: _,
|
||||
ref image_view,
|
||||
image_layout,
|
||||
} = resolve_info;
|
||||
@ -1849,8 +1844,8 @@ impl SyncCommandBufferBuilder {
|
||||
(
|
||||
"stencil resolve attachment".into(),
|
||||
Resource::Image {
|
||||
image: resolve_info.image_view.image(),
|
||||
subresource_range: resolve_info.image_view.subresource_range().clone(),
|
||||
image: image_view.image(),
|
||||
subresource_range: image_view.subresource_range().clone(),
|
||||
memory: PipelineMemoryAccess {
|
||||
stages: PipelineStages {
|
||||
all_commands: true,
|
||||
@ -1863,8 +1858,8 @@ impl SyncCommandBufferBuilder {
|
||||
}, // TODO: suboptimal
|
||||
exclusive: true, // TODO: suboptimal
|
||||
},
|
||||
start_layout: resolve_info.image_layout,
|
||||
end_layout: resolve_info.image_layout,
|
||||
start_layout: image_layout,
|
||||
end_layout: image_layout,
|
||||
},
|
||||
)
|
||||
}),
|
||||
@ -1957,7 +1952,7 @@ impl UnsafeCommandBufferBuilder {
|
||||
} = render_pass_begin_info;
|
||||
|
||||
let clear_values_vk: SmallVec<[_; 4]> = clear_values
|
||||
.into_iter()
|
||||
.iter()
|
||||
.copied()
|
||||
.map(|clear_value| clear_value.map(Into::into).unwrap_or_default())
|
||||
.collect();
|
||||
@ -2042,7 +2037,7 @@ impl UnsafeCommandBufferBuilder {
|
||||
debug_assert!(subpass_begin_info.p_next.is_null());
|
||||
debug_assert!(subpass_end_info.p_next.is_null());
|
||||
|
||||
(fns.v1_0.cmd_next_subpass)(self.handle, subpass_begin_info.contents.into());
|
||||
(fns.v1_0.cmd_next_subpass)(self.handle, subpass_begin_info.contents);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2190,7 +2185,7 @@ impl UnsafeCommandBufferBuilder {
|
||||
/// Does nothing if the list of attachments or the list of rects is empty, as it would be a
|
||||
/// no-op and isn't a valid usage of the command anyway.
|
||||
#[inline]
|
||||
pub unsafe fn clear_attachments<'a>(
|
||||
pub unsafe fn clear_attachments(
|
||||
&mut self,
|
||||
attachments: impl IntoIterator<Item = ClearAttachment>,
|
||||
rects: impl IntoIterator<Item = ClearRect>,
|
||||
|
@ -324,12 +324,11 @@ where
|
||||
match state.ty {
|
||||
QueryType::Occlusion => {
|
||||
// VUID-vkCmdExecuteCommands-commandBuffer-00102
|
||||
let inherited_flags = command_buffer
|
||||
.inheritance_info()
|
||||
.occlusion_query
|
||||
.ok_or_else(|| ExecuteCommandsError::OcclusionQueryInheritanceRequired {
|
||||
let inherited_flags = command_buffer.inheritance_info().occlusion_query.ok_or(
|
||||
ExecuteCommandsError::OcclusionQueryInheritanceRequired {
|
||||
command_buffer_index,
|
||||
})?;
|
||||
},
|
||||
)?;
|
||||
|
||||
let inherited_flags_vk = ash::vk::QueryControlFlags::from(inherited_flags);
|
||||
let state_flags_vk = ash::vk::QueryControlFlags::from(state.flags);
|
||||
|
@ -771,7 +771,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
for (dst_region_index, dst_region) in regions.iter().enumerate() {
|
||||
let &ImageCopy {
|
||||
ref dst_subresource,
|
||||
dst_offset,
|
||||
dst_offset: _,
|
||||
..
|
||||
} = dst_region;
|
||||
|
||||
@ -1729,7 +1729,7 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
}
|
||||
|
||||
let &mut FillBufferInfo {
|
||||
data,
|
||||
data: _,
|
||||
ref dst_buffer,
|
||||
dst_offset,
|
||||
size,
|
||||
@ -1895,25 +1895,6 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Computes the minimum required len in elements for buffer with image data in specified
|
||||
/// format of specified size.
|
||||
fn required_size_for_format(format: Format, extent: [u32; 3], layer_count: u32) -> DeviceSize {
|
||||
let num_blocks = extent
|
||||
.into_iter()
|
||||
.zip(format.block_extent())
|
||||
.map(|(extent, block_extent)| {
|
||||
let extent = extent as DeviceSize;
|
||||
let block_extent = block_extent as DeviceSize;
|
||||
(extent + block_extent - 1) / block_extent
|
||||
})
|
||||
.product::<DeviceSize>()
|
||||
* layer_count as DeviceSize;
|
||||
let block_size = format
|
||||
.block_size()
|
||||
.expect("this format cannot accept pixels");
|
||||
num_blocks * block_size
|
||||
}
|
||||
|
||||
impl SyncCommandBufferBuilder {
|
||||
/// Calls `vkCmdCopyBuffer` on the builder.
|
||||
///
|
||||
@ -2046,10 +2027,10 @@ impl SyncCommandBufferBuilder {
|
||||
.flat_map(|region| {
|
||||
let &ImageCopy {
|
||||
ref src_subresource,
|
||||
src_offset,
|
||||
src_offset: _,
|
||||
ref dst_subresource,
|
||||
dst_offset,
|
||||
extent,
|
||||
dst_offset: _,
|
||||
extent: _,
|
||||
_ne: _,
|
||||
} = region;
|
||||
|
||||
@ -2147,11 +2128,11 @@ impl SyncCommandBufferBuilder {
|
||||
.flat_map(|region| {
|
||||
let &BufferImageCopy {
|
||||
buffer_offset,
|
||||
buffer_row_length,
|
||||
buffer_image_height,
|
||||
buffer_row_length: _,
|
||||
buffer_image_height: _,
|
||||
ref image_subresource,
|
||||
image_offset,
|
||||
image_extent,
|
||||
image_offset: _,
|
||||
image_extent: _,
|
||||
_ne: _,
|
||||
} = region;
|
||||
|
||||
@ -2250,11 +2231,11 @@ impl SyncCommandBufferBuilder {
|
||||
.flat_map(|region| {
|
||||
let &BufferImageCopy {
|
||||
buffer_offset,
|
||||
buffer_row_length,
|
||||
buffer_image_height,
|
||||
buffer_row_length: _,
|
||||
buffer_image_height: _,
|
||||
ref image_subresource,
|
||||
image_offset,
|
||||
image_extent,
|
||||
image_offset: _,
|
||||
image_extent: _,
|
||||
_ne: _,
|
||||
} = region;
|
||||
|
||||
@ -2338,7 +2319,7 @@ impl SyncCommandBufferBuilder {
|
||||
}
|
||||
|
||||
let &FillBufferInfo {
|
||||
data,
|
||||
data: _,
|
||||
ref dst_buffer,
|
||||
dst_offset,
|
||||
size,
|
||||
@ -3566,6 +3547,25 @@ mod tests {
|
||||
use super::*;
|
||||
use crate::format::Format;
|
||||
|
||||
/// Computes the minimum required len in elements for buffer with image data in specified
|
||||
/// format of specified size.
|
||||
fn required_size_for_format(format: Format, extent: [u32; 3], layer_count: u32) -> DeviceSize {
|
||||
let num_blocks = extent
|
||||
.into_iter()
|
||||
.zip(format.block_extent())
|
||||
.map(|(extent, block_extent)| {
|
||||
let extent = extent as DeviceSize;
|
||||
let block_extent = block_extent as DeviceSize;
|
||||
(extent + block_extent - 1) / block_extent
|
||||
})
|
||||
.product::<DeviceSize>()
|
||||
* layer_count as DeviceSize;
|
||||
let block_size = format
|
||||
.block_size()
|
||||
.expect("this format cannot accept pixels");
|
||||
num_blocks * block_size
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_required_len_for_format() {
|
||||
// issue #1292
|
||||
|
@ -266,7 +266,7 @@ mod tests {
|
||||
let (device, queue) = gfx_dev_and_queue!();
|
||||
|
||||
let thread = thread::spawn({
|
||||
let (device, queue) = (device.clone(), queue.clone());
|
||||
let (device, queue) = (device, queue);
|
||||
move || {
|
||||
device
|
||||
.with_standard_command_pool(queue.family(), |pool| {
|
||||
|
@ -39,8 +39,8 @@ pub struct UnsafeCommandPool {
|
||||
dummy_avoid_sync: PhantomData<*const u8>,
|
||||
|
||||
queue_family_index: u32,
|
||||
transient: bool,
|
||||
reset_command_buffer: bool,
|
||||
_transient: bool,
|
||||
_reset_command_buffer: bool,
|
||||
}
|
||||
|
||||
unsafe impl Send for UnsafeCommandPool {}
|
||||
@ -67,8 +67,8 @@ impl UnsafeCommandPool {
|
||||
dummy_avoid_sync: PhantomData,
|
||||
|
||||
queue_family_index,
|
||||
transient,
|
||||
reset_command_buffer,
|
||||
_transient: transient,
|
||||
_reset_command_buffer: reset_command_buffer,
|
||||
})
|
||||
}
|
||||
|
||||
@ -94,8 +94,8 @@ impl UnsafeCommandPool {
|
||||
dummy_avoid_sync: PhantomData,
|
||||
|
||||
queue_family_index,
|
||||
transient,
|
||||
reset_command_buffer,
|
||||
_transient: transient,
|
||||
_reset_command_buffer: reset_command_buffer,
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,8 +105,8 @@ impl UnsafeCommandPool {
|
||||
) -> Result<(), UnsafeCommandPoolCreationError> {
|
||||
let &mut UnsafeCommandPoolCreateInfo {
|
||||
queue_family_index,
|
||||
transient,
|
||||
reset_command_buffer,
|
||||
transient: _,
|
||||
reset_command_buffer: _,
|
||||
_ne: _,
|
||||
} = create_info;
|
||||
|
||||
@ -615,14 +615,18 @@ mod tests {
|
||||
.unwrap();
|
||||
|
||||
if device.api_version() >= Version::V1_1 {
|
||||
match pool.trim() {
|
||||
Err(CommandPoolTrimError::Maintenance1ExtensionNotEnabled) => panic!(),
|
||||
_ => (),
|
||||
if matches!(
|
||||
pool.trim(),
|
||||
Err(CommandPoolTrimError::Maintenance1ExtensionNotEnabled)
|
||||
) {
|
||||
panic!()
|
||||
}
|
||||
} else {
|
||||
match pool.trim() {
|
||||
Err(CommandPoolTrimError::Maintenance1ExtensionNotEnabled) => (),
|
||||
_ => panic!(),
|
||||
if !matches!(
|
||||
pool.trim(),
|
||||
Err(CommandPoolTrimError::Maintenance1ExtensionNotEnabled)
|
||||
) {
|
||||
panic!()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,9 +43,6 @@ impl<'a> SubmitAnyBuilder<'a> {
|
||||
/// Returns true if equal to `SubmitAnyBuilder::Empty`.
|
||||
#[inline]
|
||||
pub fn is_empty(&self) -> bool {
|
||||
match self {
|
||||
&SubmitAnyBuilder::Empty => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(self, SubmitAnyBuilder::Empty)
|
||||
}
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn empty_submit() {
|
||||
let (device, queue) = gfx_dev_and_queue!();
|
||||
let (_device, queue) = gfx_dev_and_queue!();
|
||||
let builder = SubmitCommandBufferBuilder::new();
|
||||
builder.submit(&queue).unwrap();
|
||||
}
|
||||
@ -310,7 +310,7 @@ mod tests {
|
||||
unsafe {
|
||||
let (device, queue) = gfx_dev_and_queue!();
|
||||
|
||||
let fence = Fence::new(device.clone(), Default::default()).unwrap();
|
||||
let fence = Fence::new(device, Default::default()).unwrap();
|
||||
assert!(!fence.is_signaled().unwrap());
|
||||
|
||||
let mut builder = SubmitCommandBufferBuilder::new();
|
||||
@ -325,9 +325,9 @@ mod tests {
|
||||
#[test]
|
||||
fn has_fence() {
|
||||
unsafe {
|
||||
let (device, queue) = gfx_dev_and_queue!();
|
||||
let (device, _queue) = gfx_dev_and_queue!();
|
||||
|
||||
let fence = Fence::new(device.clone(), Default::default()).unwrap();
|
||||
let fence = Fence::new(device, Default::default()).unwrap();
|
||||
|
||||
let mut builder = SubmitCommandBufferBuilder::new();
|
||||
assert!(!builder.has_fence());
|
||||
@ -342,7 +342,7 @@ mod tests {
|
||||
let (device, _) = gfx_dev_and_queue!();
|
||||
|
||||
let fence1 = Fence::new(device.clone(), Default::default()).unwrap();
|
||||
let fence2 = Fence::new(device.clone(), Default::default()).unwrap();
|
||||
let fence2 = Fence::new(device, Default::default()).unwrap();
|
||||
|
||||
let mut builder1 = SubmitCommandBufferBuilder::new();
|
||||
builder1.set_fence_signal(&fence1);
|
||||
|
@ -46,12 +46,12 @@ impl<'a> SubmitSemaphoresWaitBuilder<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Into<SubmitCommandBufferBuilder<'a>> for SubmitSemaphoresWaitBuilder<'a> {
|
||||
impl<'a> From<SubmitSemaphoresWaitBuilder<'a>> for SubmitCommandBufferBuilder<'a> {
|
||||
#[inline]
|
||||
fn into(mut self) -> SubmitCommandBufferBuilder<'a> {
|
||||
fn from(mut val: SubmitSemaphoresWaitBuilder<'a>) -> Self {
|
||||
unsafe {
|
||||
let mut builder = SubmitCommandBufferBuilder::new();
|
||||
for sem in self.semaphores.drain(..) {
|
||||
for sem in val.semaphores.drain(..) {
|
||||
builder.add_wait_semaphore(
|
||||
sem,
|
||||
PipelineStages {
|
||||
@ -66,12 +66,12 @@ impl<'a> Into<SubmitCommandBufferBuilder<'a>> for SubmitSemaphoresWaitBuilder<'a
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Into<SubmitPresentBuilder<'a>> for SubmitSemaphoresWaitBuilder<'a> {
|
||||
impl<'a> From<SubmitSemaphoresWaitBuilder<'a>> for SubmitPresentBuilder<'a> {
|
||||
#[inline]
|
||||
fn into(mut self) -> SubmitPresentBuilder<'a> {
|
||||
fn from(mut val: SubmitSemaphoresWaitBuilder<'a>) -> Self {
|
||||
unsafe {
|
||||
let mut builder = SubmitPresentBuilder::new();
|
||||
for sem in self.semaphores.drain(..) {
|
||||
for sem in val.semaphores.drain(..) {
|
||||
builder.add_wait_semaphore(sem);
|
||||
}
|
||||
builder
|
||||
|
@ -198,8 +198,8 @@ impl SyncCommandBufferBuilder {
|
||||
) -> Result<(), SyncCommandBufferBuilderError> {
|
||||
let (resource_name, resource) = resource;
|
||||
|
||||
match resource {
|
||||
&Resource::Buffer {
|
||||
match *resource {
|
||||
Resource::Buffer {
|
||||
ref buffer,
|
||||
ref range,
|
||||
ref memory,
|
||||
@ -217,7 +217,7 @@ impl SyncCommandBufferBuilder {
|
||||
});
|
||||
}
|
||||
}
|
||||
&Resource::Image {
|
||||
Resource::Image {
|
||||
ref image,
|
||||
ref subresource_range,
|
||||
ref memory,
|
||||
@ -266,7 +266,7 @@ impl SyncCommandBufferBuilder {
|
||||
|
||||
let range_map = self.buffers2.get(inner.buffer)?;
|
||||
|
||||
for (range, state) in range_map
|
||||
for (_range, state) in range_map
|
||||
.range(&range)
|
||||
.filter(|(_range, state)| !state.resource_uses.is_empty())
|
||||
{
|
||||
@ -297,7 +297,7 @@ impl SyncCommandBufferBuilder {
|
||||
mut subresource_range: ImageSubresourceRange,
|
||||
memory: &PipelineMemoryAccess,
|
||||
start_layout: ImageLayout,
|
||||
end_layout: ImageLayout,
|
||||
_end_layout: ImageLayout,
|
||||
) -> Option<&ImageUse> {
|
||||
// Barriers work differently in render passes, so if we're in one, we can only insert a
|
||||
// barrier before the start of the render pass.
|
||||
@ -313,7 +313,7 @@ impl SyncCommandBufferBuilder {
|
||||
let range_map = self.images2.get(inner.image)?;
|
||||
|
||||
for range in inner.image.iter_ranges(subresource_range) {
|
||||
for (range, state) in range_map
|
||||
for (_range, state) in range_map
|
||||
.range(&range)
|
||||
.filter(|(_range, state)| !state.resource_uses.is_empty())
|
||||
{
|
||||
@ -851,7 +851,7 @@ impl SyncCommandBufferBuilder {
|
||||
buffers2,
|
||||
images2,
|
||||
commands: self.commands,
|
||||
barriers: self.barriers,
|
||||
_barriers: self.barriers,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ pub struct SyncCommandBuffer {
|
||||
|
||||
// Locations within commands that pipeline barriers were inserted. For debugging purposes.
|
||||
// TODO: present only in cfg(debug_assertions)?
|
||||
barriers: Vec<usize>,
|
||||
_barriers: Vec<usize>,
|
||||
|
||||
// State of all the resources used by this command buffer.
|
||||
buffers2: HashMap<Arc<UnsafeBuffer>, RangeMap<DeviceSize, BufferFinalState>>,
|
||||
@ -311,7 +311,7 @@ impl SyncCommandBuffer {
|
||||
buffer: &UnsafeBuffer,
|
||||
range: Range<DeviceSize>,
|
||||
exclusive: bool,
|
||||
queue: &Queue,
|
||||
_queue: &Queue,
|
||||
) -> Result<Option<(PipelineStages, AccessFlags)>, AccessCheckError> {
|
||||
let range_map = match self.buffers2.get(buffer) {
|
||||
Some(x) => x,
|
||||
@ -345,7 +345,7 @@ impl SyncCommandBuffer {
|
||||
range: Range<DeviceSize>,
|
||||
exclusive: bool,
|
||||
expected_layout: ImageLayout,
|
||||
queue: &Queue,
|
||||
_queue: &Queue,
|
||||
) -> Result<Option<(PipelineStages, AccessFlags)>, AccessCheckError> {
|
||||
let range_map = match self.images2.get(image) {
|
||||
Some(x) => x,
|
||||
@ -556,7 +556,7 @@ mod tests {
|
||||
.unwrap();
|
||||
|
||||
SyncCommandBufferBuilder::new(
|
||||
&pool_builder_alloc.inner(),
|
||||
pool_builder_alloc.inner(),
|
||||
CommandBufferBeginInfo {
|
||||
usage: CommandBufferUsage::MultipleSubmit,
|
||||
..Default::default()
|
||||
@ -635,7 +635,7 @@ mod tests {
|
||||
|
||||
// Ensure that the builder added a barrier between the two writes
|
||||
assert_eq!(&names, &["execute_commands", "execute_commands"]);
|
||||
assert_eq!(&primary.barriers, &[0, 1]);
|
||||
assert_eq!(&primary._barriers, &[0, 1]);
|
||||
}
|
||||
|
||||
{
|
||||
@ -672,7 +672,7 @@ mod tests {
|
||||
})
|
||||
.unwrap();
|
||||
let mut sync = SyncCommandBufferBuilder::new(
|
||||
&pool_builder_alloc.inner(),
|
||||
pool_builder_alloc.inner(),
|
||||
CommandBufferBeginInfo {
|
||||
usage: CommandBufferUsage::MultipleSubmit,
|
||||
..Default::default()
|
||||
@ -705,7 +705,7 @@ mod tests {
|
||||
})
|
||||
.unwrap();
|
||||
let mut sync = SyncCommandBufferBuilder::new(
|
||||
&pool_builder_alloc.inner(),
|
||||
pool_builder_alloc.inner(),
|
||||
CommandBufferBeginInfo {
|
||||
usage: CommandBufferUsage::MultipleSubmit,
|
||||
..Default::default()
|
||||
@ -794,7 +794,7 @@ mod tests {
|
||||
.unwrap();
|
||||
|
||||
let set = PersistentDescriptorSet::new(
|
||||
set_layout.clone(),
|
||||
set_layout,
|
||||
[WriteDescriptorSet::sampler(
|
||||
0,
|
||||
Sampler::new(device, SamplerCreateInfo::simple_repeat_linear()).unwrap(),
|
||||
|
@ -101,7 +101,7 @@ impl UnsafeCommandBufferBuilder {
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
if let Some(flags) = inheritance_info.occlusion_query {
|
||||
if let Some(flags) = occlusion_query {
|
||||
inheritance_info_vk.occlusion_query_enable = ash::vk::TRUE;
|
||||
|
||||
if flags.precise {
|
||||
|
@ -387,7 +387,7 @@ where
|
||||
return Ok(SubmitAnyBuilder::Empty);
|
||||
}
|
||||
|
||||
return self.build_submission_impl();
|
||||
self.build_submission_impl()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@ -416,7 +416,7 @@ where
|
||||
|
||||
#[inline]
|
||||
unsafe fn signal_finished(&self) {
|
||||
if self.finished.swap(true, Ordering::SeqCst) == false {
|
||||
if !self.finished.swap(true, Ordering::SeqCst) {
|
||||
self.command_buffer.unlock();
|
||||
}
|
||||
|
||||
|
@ -48,17 +48,10 @@ macro_rules! impl_collection {
|
||||
$(, $others: Into<DescriptorSetWithOffsets>)*
|
||||
{
|
||||
#[inline]
|
||||
#[allow(non_snake_case)]
|
||||
fn into_vec(self) -> Vec<DescriptorSetWithOffsets> {
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
let ($first, $($others,)*) = self;
|
||||
|
||||
let mut list = Vec::new();
|
||||
list.push($first.into());
|
||||
$(
|
||||
list.push($others.into());
|
||||
)+
|
||||
list
|
||||
vec![$first.into() $(, $others.into())+]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ impl DescriptorSetLayout {
|
||||
} = create_info;
|
||||
|
||||
let mut descriptor_counts = HashMap::default();
|
||||
for (&binding_num, binding) in bindings.iter() {
|
||||
for binding in bindings.values() {
|
||||
if binding.descriptor_count != 0 {
|
||||
*descriptor_counts
|
||||
.entry(binding.descriptor_type)
|
||||
@ -699,18 +699,18 @@ impl DescriptorSetLayoutBinding {
|
||||
let DescriptorRequirements {
|
||||
descriptor_types,
|
||||
descriptor_count,
|
||||
image_format,
|
||||
image_multisampled,
|
||||
image_scalar_type,
|
||||
image_view_type,
|
||||
sampler_compare,
|
||||
sampler_no_unnormalized_coordinates,
|
||||
sampler_no_ycbcr_conversion,
|
||||
sampler_with_images,
|
||||
image_format: _,
|
||||
image_multisampled: _,
|
||||
image_scalar_type: _,
|
||||
image_view_type: _,
|
||||
sampler_compare: _,
|
||||
sampler_no_unnormalized_coordinates: _,
|
||||
sampler_no_ycbcr_conversion: _,
|
||||
sampler_with_images: _,
|
||||
stages,
|
||||
storage_image_atomic,
|
||||
storage_read,
|
||||
storage_write,
|
||||
storage_image_atomic: _,
|
||||
storage_read: _,
|
||||
storage_write: _,
|
||||
} = descriptor_requirements;
|
||||
|
||||
if !descriptor_types.contains(&self.descriptor_type) {
|
||||
@ -786,7 +786,7 @@ impl fmt::Display for DescriptorRequirementsNotMet {
|
||||
"the descriptor count ({}) is less than what is required ({})",
|
||||
obtained, required
|
||||
),
|
||||
Self::ShaderStages { required, obtained } => write!(
|
||||
Self::ShaderStages { .. } => write!(
|
||||
fmt,
|
||||
"the descriptor's shader stages do not contain the stages that are required",
|
||||
),
|
||||
@ -869,7 +869,7 @@ mod tests {
|
||||
let (device, _) = gfx_dev_and_queue!();
|
||||
|
||||
let sl = DescriptorSetLayout::new(
|
||||
device.clone(),
|
||||
device,
|
||||
DescriptorSetLayoutCreateInfo {
|
||||
bindings: [(
|
||||
0,
|
||||
|
@ -148,9 +148,7 @@ impl Hash for dyn DescriptorSet {
|
||||
}
|
||||
|
||||
pub(crate) struct DescriptorSetInner {
|
||||
handle: ash::vk::DescriptorSet,
|
||||
layout: Arc<DescriptorSetLayout>,
|
||||
variable_descriptor_count: u32,
|
||||
resources: DescriptorSetResources,
|
||||
}
|
||||
|
||||
@ -225,22 +223,13 @@ impl DescriptorSetInner {
|
||||
);
|
||||
}
|
||||
|
||||
Ok(DescriptorSetInner {
|
||||
handle,
|
||||
layout,
|
||||
variable_descriptor_count,
|
||||
resources,
|
||||
})
|
||||
Ok(DescriptorSetInner { layout, resources })
|
||||
}
|
||||
|
||||
pub(crate) fn layout(&self) -> &Arc<DescriptorSetLayout> {
|
||||
&self.layout
|
||||
}
|
||||
|
||||
pub(crate) fn variable_descriptor_count(&self) -> u32 {
|
||||
self.variable_descriptor_count
|
||||
}
|
||||
|
||||
pub(crate) fn resources(&self) -> &DescriptorSetResources {
|
||||
&self.resources
|
||||
}
|
||||
@ -317,7 +306,7 @@ impl DescriptorSetResources {
|
||||
///
|
||||
/// - Panics if the binding number of a write does not exist in the resources.
|
||||
/// - See also [`DescriptorBindingResources::update`].
|
||||
pub fn update<'a>(&mut self, write: &WriteDescriptorSet) {
|
||||
pub fn update(&mut self, write: &WriteDescriptorSet) {
|
||||
self.binding_resources
|
||||
.get_mut(&write.binding())
|
||||
.expect("descriptor write has invalid binding number")
|
||||
@ -460,13 +449,13 @@ impl DescriptorSetWithOffsets {
|
||||
}
|
||||
|
||||
assert!(
|
||||
!(dynamic_offsets.len() < dynamic_offset_index),
|
||||
dynamic_offsets.len() >= dynamic_offset_index,
|
||||
"Too few dynamic offsets: got {}, expected {}",
|
||||
dynamic_offsets.len(),
|
||||
dynamic_offset_index
|
||||
);
|
||||
assert!(
|
||||
!(dynamic_offsets.len() > dynamic_offset_index),
|
||||
dynamic_offsets.len() <= dynamic_offset_index,
|
||||
"Too many dynamic offsets: got {}, expected {}",
|
||||
dynamic_offsets.len(),
|
||||
dynamic_offset_index
|
||||
@ -519,10 +508,10 @@ impl std::fmt::Display for DescriptorSetCreationError {
|
||||
#[inline]
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::DescriptorSetUpdateError(err) => {
|
||||
Self::DescriptorSetUpdateError(_) => {
|
||||
write!(f, "an error occurred while updating the descriptor set")
|
||||
}
|
||||
Self::OomError(err) => write!(f, "out of memory"),
|
||||
Self::OomError(_) => write!(f, "out of memory"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ impl UnsafeDescriptorPool {
|
||||
})
|
||||
.unzip();
|
||||
|
||||
let output = if layouts.len() == 0 {
|
||||
let output = if layouts.is_empty() {
|
||||
vec![]
|
||||
} else {
|
||||
let variable_desc_count_alloc_info = if (self.device.api_version() >= Version::V1_2
|
||||
@ -265,9 +265,7 @@ impl UnsafeDescriptorPool {
|
||||
output
|
||||
};
|
||||
|
||||
Ok(output
|
||||
.into_iter()
|
||||
.map(|handle| UnsafeDescriptorSet::new(handle)))
|
||||
Ok(output.into_iter().map(UnsafeDescriptorSet::new))
|
||||
}
|
||||
|
||||
/// Frees some descriptor sets.
|
||||
|
@ -117,7 +117,7 @@ impl SingleLayoutDescSetPool {
|
||||
struct SingleLayoutPool {
|
||||
// The actual Vulkan descriptor pool. This field isn't actually used anywhere, but we need to
|
||||
// keep the pool alive in order to keep the descriptor sets valid.
|
||||
inner: UnsafeDescriptorPool,
|
||||
_inner: UnsafeDescriptorPool,
|
||||
// List of descriptor sets. When `alloc` is called, a descriptor will be extracted from this
|
||||
// list. When a `SingleLayoutPoolAlloc` is dropped, its descriptor set is put back in this list.
|
||||
reserve: ArrayQueue<UnsafeDescriptorSet>,
|
||||
@ -169,7 +169,10 @@ impl SingleLayoutPool {
|
||||
}
|
||||
};
|
||||
|
||||
Ok(Arc::new(Self { inner, reserve }))
|
||||
Ok(Arc::new(Self {
|
||||
_inner: inner,
|
||||
reserve,
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
@ -372,7 +375,7 @@ impl SingleLayoutVariableDescSetPool {
|
||||
|
||||
Ok(SingleLayoutVariablePoolAlloc {
|
||||
inner,
|
||||
pool: self.inner.clone(),
|
||||
_pool: self.inner.clone(),
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -430,7 +433,7 @@ pub(crate) struct SingleLayoutVariablePoolAlloc {
|
||||
// The `SingleLayoutVariablePool` where we allocated from. We need to keep a copy of it in each
|
||||
// allocation so that we can put back the pool in the reserve once all allocations have been
|
||||
// dropped.
|
||||
pool: Arc<SingleLayoutVariablePool>,
|
||||
_pool: Arc<SingleLayoutVariablePool>,
|
||||
}
|
||||
|
||||
unsafe impl Send for SingleLayoutVariablePoolAlloc {}
|
||||
|
@ -372,27 +372,6 @@ pub(crate) enum DescriptorWriteInfo {
|
||||
BufferView(SmallVec<[ash::vk::BufferView; 1]>),
|
||||
}
|
||||
|
||||
impl DescriptorWriteInfo {
|
||||
fn set_info(&self, write: &mut ash::vk::WriteDescriptorSet) {
|
||||
match self {
|
||||
DescriptorWriteInfo::Image(info) => {
|
||||
write.descriptor_count = info.len() as u32;
|
||||
write.p_image_info = info.as_ptr();
|
||||
}
|
||||
DescriptorWriteInfo::Buffer(info) => {
|
||||
write.descriptor_count = info.len() as u32;
|
||||
write.p_buffer_info = info.as_ptr();
|
||||
}
|
||||
DescriptorWriteInfo::BufferView(info) => {
|
||||
write.descriptor_count = info.len() as u32;
|
||||
write.p_texel_buffer_view = info.as_ptr();
|
||||
}
|
||||
}
|
||||
|
||||
debug_assert!(write.descriptor_count != 0);
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn check_descriptor_write<'a>(
|
||||
write: &WriteDescriptorSet,
|
||||
layout: &'a DescriptorSetLayout,
|
||||
@ -429,7 +408,7 @@ pub(crate) fn check_descriptor_write<'a>(
|
||||
}
|
||||
|
||||
match elements {
|
||||
WriteDescriptorSetElements::None(num_elements) => match layout_binding.descriptor_type {
|
||||
WriteDescriptorSetElements::None(_num_elements) => match layout_binding.descriptor_type {
|
||||
DescriptorType::Sampler
|
||||
if layout.push_descriptor() && !layout_binding.immutable_samplers.is_empty() => {}
|
||||
_ => {
|
||||
|
@ -25,6 +25,6 @@ mod tests {
|
||||
#[test]
|
||||
fn empty_extensions() {
|
||||
let d: Vec<CString> = (&DeviceExtensions::none()).into();
|
||||
assert!(d.iter().next().is_none());
|
||||
assert!(d.get(0).is_none());
|
||||
}
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ impl Device {
|
||||
// VUID-VkDeviceQueueCreateInfo-pQueuePriorities-00383
|
||||
assert!(queues
|
||||
.iter()
|
||||
.all(|&priority| priority >= 0.0 && priority <= 1.0));
|
||||
.all(|&priority| (0.0..=1.0).contains(&priority)));
|
||||
|
||||
if queues.len() > family.queues_count() {
|
||||
return Err(DeviceCreationError::TooManyQueuesForFamily);
|
||||
@ -491,7 +491,7 @@ impl Device {
|
||||
/// > **Note**: Will return `-> impl ExactSizeIterator<Item = QueueFamily>` in the future.
|
||||
// TODO: ^
|
||||
#[inline]
|
||||
pub fn active_queue_families<'a>(&'a self) -> impl ExactSizeIterator<Item = QueueFamily<'a>> {
|
||||
pub fn active_queue_families(&self) -> impl ExactSizeIterator<Item = QueueFamily> {
|
||||
let physical_device = self.physical_device();
|
||||
self.active_queue_families
|
||||
.iter()
|
||||
@ -1058,7 +1058,7 @@ impl Queue {
|
||||
|
||||
fn validate_begin_debug_utils_label(
|
||||
&self,
|
||||
label_info: &mut DebugUtilsLabel,
|
||||
_label_info: &mut DebugUtilsLabel,
|
||||
) -> Result<(), DebugUtilsError> {
|
||||
if !self
|
||||
.device()
|
||||
@ -1151,7 +1151,7 @@ impl Queue {
|
||||
|
||||
fn validate_insert_debug_utils_label(
|
||||
&self,
|
||||
label_info: &mut DebugUtilsLabel,
|
||||
_label_info: &mut DebugUtilsLabel,
|
||||
) -> Result<(), DebugUtilsError> {
|
||||
if !self
|
||||
.device()
|
||||
@ -1246,7 +1246,7 @@ mod tests {
|
||||
};
|
||||
|
||||
let family = physical.queue_families().next().unwrap();
|
||||
let queues = (0..family.queues_count() + 1).map(|_| (family, 1.0));
|
||||
let _queues = (0..family.queues_count() + 1).map(|_| (family, 1.0));
|
||||
|
||||
match Device::new(
|
||||
physical,
|
||||
@ -1258,7 +1258,7 @@ mod tests {
|
||||
..Default::default()
|
||||
},
|
||||
) {
|
||||
Err(DeviceCreationError::TooManyQueuesForFamily) => return, // Success
|
||||
Err(DeviceCreationError::TooManyQueuesForFamily) => (), // Success
|
||||
_ => panic!(),
|
||||
};
|
||||
}
|
||||
@ -1290,7 +1290,7 @@ mod tests {
|
||||
Err(DeviceCreationError::FeatureRestrictionNotMet(FeatureRestrictionError {
|
||||
restriction: FeatureRestriction::NotSupported,
|
||||
..
|
||||
})) => return, // Success
|
||||
})) => (), // Success
|
||||
_ => panic!(),
|
||||
};
|
||||
}
|
||||
|
@ -68,10 +68,10 @@ pub(crate) fn init_physical_devices(
|
||||
}
|
||||
};
|
||||
|
||||
Ok(handles
|
||||
handles
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
.map(|(index, handle)| -> Result<_, InstanceCreationError> {
|
||||
.map(|(_index, handle)| -> Result<_, InstanceCreationError> {
|
||||
let api_version = unsafe {
|
||||
let mut output = MaybeUninit::uninit();
|
||||
(fns.v1_0.get_physical_device_properties)(handle, output.as_mut_ptr());
|
||||
@ -138,7 +138,7 @@ pub(crate) fn init_physical_devices(
|
||||
|
||||
Ok(info)
|
||||
})
|
||||
.collect::<Result<_, _>>()?)
|
||||
.collect::<Result<_, _>>()
|
||||
}
|
||||
|
||||
fn init_info(instance: &Instance, info: &mut PhysicalDeviceInfo) {
|
||||
@ -391,7 +391,7 @@ impl<'a> PhysicalDevice<'a> {
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn instance(&self) -> &'a Arc<Instance> {
|
||||
&self.instance
|
||||
self.instance
|
||||
}
|
||||
|
||||
/// Returns the index of the physical device in the physical devices list.
|
||||
@ -1324,11 +1324,8 @@ impl<'a> PhysicalDevice<'a> {
|
||||
}
|
||||
};
|
||||
|
||||
debug_assert!(modes.len() > 0);
|
||||
debug_assert!(modes
|
||||
.iter()
|
||||
.find(|&&m| m == ash::vk::PresentModeKHR::FIFO)
|
||||
.is_some());
|
||||
debug_assert!(!modes.is_empty());
|
||||
debug_assert!(modes.iter().any(|&m| m == ash::vk::PresentModeKHR::FIFO));
|
||||
|
||||
Ok(modes
|
||||
.into_iter()
|
||||
@ -1564,7 +1561,7 @@ impl<'a> QueueFamily<'a> {
|
||||
/// of `[width, height, depth]`
|
||||
#[inline]
|
||||
pub fn min_image_transfer_granularity(&self) -> [u32; 3] {
|
||||
let ref granularity = self.properties.min_image_transfer_granularity;
|
||||
let granularity = &self.properties.min_image_transfer_granularity;
|
||||
[granularity.width, granularity.height, granularity.depth]
|
||||
}
|
||||
|
||||
@ -1809,7 +1806,7 @@ pub struct ShaderCoreProperties {}
|
||||
|
||||
impl From<ash::vk::ShaderCorePropertiesFlagsAMD> for ShaderCoreProperties {
|
||||
#[inline]
|
||||
fn from(val: ash::vk::ShaderCorePropertiesFlagsAMD) -> Self {
|
||||
fn from(_val: ash::vk::ShaderCorePropertiesFlagsAMD) -> Self {
|
||||
Self {}
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,10 @@ include!(concat!(env!("OUT_DIR"), "/formats.rs"));
|
||||
|
||||
impl Format {
|
||||
/// Retrieves the properties of a format when used by a certain device.
|
||||
#[deprecated(since = "0.28", note = "Use PhysicalDevice::format_properties instead")]
|
||||
#[deprecated(
|
||||
since = "0.28.0",
|
||||
note = "Use PhysicalDevice::format_properties instead"
|
||||
)]
|
||||
#[inline]
|
||||
pub fn properties(&self, physical_device: PhysicalDevice) -> FormatProperties {
|
||||
physical_device.format_properties(*self)
|
||||
|
@ -30,7 +30,7 @@ use std::{
|
||||
fs::File,
|
||||
hash::{Hash, Hasher},
|
||||
sync::{
|
||||
atomic::{AtomicBool, AtomicUsize, Ordering},
|
||||
atomic::{AtomicBool, Ordering},
|
||||
Arc,
|
||||
},
|
||||
};
|
||||
@ -72,9 +72,6 @@ pub struct AttachmentImage<A = PotentialDedicatedAllocation<StandardMemoryPoolAl
|
||||
// Memory used to back the image.
|
||||
memory: A,
|
||||
|
||||
// Format.
|
||||
format: Format,
|
||||
|
||||
// Layout to use when the image is used as a framebuffer attachment.
|
||||
// Must be either "depth-stencil optimal" or "color optimal".
|
||||
attachment_layout: ImageLayout,
|
||||
@ -82,9 +79,6 @@ pub struct AttachmentImage<A = PotentialDedicatedAllocation<StandardMemoryPoolAl
|
||||
// If true, then the image is in the layout of `attachment_layout` (above). If false, then it
|
||||
// is still `Undefined`.
|
||||
initialized: AtomicBool,
|
||||
|
||||
// Number of times this image is locked on the GPU side.
|
||||
gpu_lock: AtomicUsize,
|
||||
}
|
||||
|
||||
impl AttachmentImage {
|
||||
@ -464,14 +458,12 @@ impl AttachmentImage {
|
||||
Ok(Arc::new(AttachmentImage {
|
||||
image,
|
||||
memory,
|
||||
format,
|
||||
attachment_layout: if is_depth {
|
||||
ImageLayout::DepthStencilAttachmentOptimal
|
||||
} else {
|
||||
ImageLayout::ColorAttachmentOptimal
|
||||
},
|
||||
initialized: AtomicBool::new(false),
|
||||
gpu_lock: AtomicUsize::new(0),
|
||||
}))
|
||||
}
|
||||
|
||||
@ -547,14 +539,12 @@ impl AttachmentImage {
|
||||
Ok(Arc::new(AttachmentImage {
|
||||
image,
|
||||
memory,
|
||||
format,
|
||||
attachment_layout: if is_depth {
|
||||
ImageLayout::DepthStencilAttachmentOptimal
|
||||
} else {
|
||||
ImageLayout::ColorAttachmentOptimal
|
||||
},
|
||||
initialized: AtomicBool::new(false),
|
||||
gpu_lock: AtomicUsize::new(0),
|
||||
}))
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,6 @@ use std::{
|
||||
error::Error,
|
||||
fmt,
|
||||
hash::{Hash, Hasher},
|
||||
ops::Range,
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
@ -49,8 +48,7 @@ use std::{
|
||||
pub struct ImmutableImage<A = PotentialDedicatedAllocation<StandardMemoryPoolAlloc>> {
|
||||
image: Arc<UnsafeImage>,
|
||||
dimensions: ImageDimensions,
|
||||
memory: A,
|
||||
format: Format,
|
||||
_memory: A,
|
||||
layout: ImageLayout,
|
||||
}
|
||||
|
||||
@ -66,7 +64,7 @@ fn generate_mipmaps<L>(
|
||||
cbb: &mut AutoCommandBufferBuilder<L>,
|
||||
image: Arc<dyn ImageAccess>,
|
||||
dimensions: ImageDimensions,
|
||||
layout: ImageLayout,
|
||||
_layout: ImageLayout,
|
||||
) {
|
||||
for level in 1..image.mip_levels() {
|
||||
let src_size = dimensions
|
||||
@ -225,16 +223,13 @@ impl ImmutableImage {
|
||||
|
||||
let image = Arc::new(ImmutableImage {
|
||||
image,
|
||||
memory,
|
||||
_memory: memory,
|
||||
dimensions,
|
||||
format,
|
||||
layout,
|
||||
});
|
||||
|
||||
let init = Arc::new(ImmutableImageInitialization {
|
||||
image: image.clone(),
|
||||
mip_levels_access: 0..image.mip_levels(),
|
||||
array_layers_access: 0..image.dimensions().array_layers(),
|
||||
});
|
||||
|
||||
Ok((image, init))
|
||||
@ -414,8 +409,6 @@ where
|
||||
// Must not implement Clone, as that would lead to multiple `used` values.
|
||||
pub struct ImmutableImageInitialization<A = PotentialDedicatedAllocation<StandardMemoryPoolAlloc>> {
|
||||
image: Arc<ImmutableImage<A>>,
|
||||
mip_levels_access: Range<u32>,
|
||||
array_layers_access: Range<u32>,
|
||||
}
|
||||
|
||||
unsafe impl<A> DeviceOwned for ImmutableImageInitialization<A> {
|
||||
|
@ -946,7 +946,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn mipmap_working_immutable_image() {
|
||||
let (device, queue) = gfx_dev_and_queue!();
|
||||
let (_device, queue) = gfx_dev_and_queue!();
|
||||
|
||||
let dimensions = ImageDimensions::Dim2d {
|
||||
width: 512,
|
||||
@ -978,7 +978,7 @@ mod tests {
|
||||
dimensions,
|
||||
MipmapsCount::Log2,
|
||||
Format::R8_UNORM,
|
||||
queue.clone(),
|
||||
queue,
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(image.mip_levels(), 10);
|
||||
|
@ -48,12 +48,6 @@ where
|
||||
|
||||
// Dimensions of the image.
|
||||
dimensions: ImageDimensions,
|
||||
|
||||
// Format.
|
||||
format: Format,
|
||||
|
||||
// Queue families allowed to access this image.
|
||||
queue_families: SmallVec<[u32; 4]>,
|
||||
}
|
||||
|
||||
impl StorageImage {
|
||||
@ -150,8 +144,6 @@ impl StorageImage {
|
||||
image,
|
||||
memory,
|
||||
dimensions,
|
||||
format,
|
||||
queue_families,
|
||||
}))
|
||||
}
|
||||
|
||||
@ -196,7 +188,7 @@ impl StorageImage {
|
||||
|
||||
let mem_reqs = image.memory_requirements();
|
||||
let memory = alloc_dedicated_with_exportable_fd(
|
||||
device.clone(),
|
||||
device,
|
||||
&mem_reqs,
|
||||
AllocLayout::Optimal,
|
||||
MappingRequirement::DoNotMap,
|
||||
@ -218,8 +210,6 @@ impl StorageImage {
|
||||
image,
|
||||
memory,
|
||||
dimensions,
|
||||
format,
|
||||
queue_families,
|
||||
}))
|
||||
}
|
||||
|
||||
@ -376,7 +366,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn create_general_purpose_image_view() {
|
||||
let (device, queue) = gfx_dev_and_queue!();
|
||||
let (_device, queue) = gfx_dev_and_queue!();
|
||||
let usage = ImageUsage {
|
||||
transfer_src: true,
|
||||
transfer_dst: true,
|
||||
@ -384,7 +374,7 @@ mod tests {
|
||||
..ImageUsage::none()
|
||||
};
|
||||
let img_view = StorageImage::general_purpose_image_view(
|
||||
queue.clone(),
|
||||
queue,
|
||||
[32, 32],
|
||||
Format::R8G8B8A8_UNORM,
|
||||
usage,
|
||||
@ -395,14 +385,14 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn create_general_purpose_image_view_failed() {
|
||||
let (device, queue) = gfx_dev_and_queue!();
|
||||
let (_device, queue) = gfx_dev_and_queue!();
|
||||
// Not valid for image view...
|
||||
let usage = ImageUsage {
|
||||
transfer_src: true,
|
||||
..ImageUsage::none()
|
||||
};
|
||||
let img_result = StorageImage::general_purpose_image_view(
|
||||
queue.clone(),
|
||||
queue,
|
||||
[32, 32],
|
||||
Format::R8G8B8A8_UNORM,
|
||||
usage,
|
||||
|
@ -45,10 +45,8 @@ impl<W> SwapchainImage<W> {
|
||||
swapchain: Arc<Swapchain<W>>,
|
||||
id: usize,
|
||||
) -> Result<Arc<SwapchainImage<W>>, OomError> {
|
||||
let image = swapchain.raw_image(id).unwrap();
|
||||
|
||||
Ok(Arc::new(SwapchainImage {
|
||||
swapchain: swapchain.clone(),
|
||||
swapchain,
|
||||
image_offset: id,
|
||||
}))
|
||||
}
|
||||
|
@ -126,9 +126,9 @@ impl UnsafeImage {
|
||||
samples,
|
||||
tiling,
|
||||
usage,
|
||||
sharing,
|
||||
sharing: _,
|
||||
initial_layout,
|
||||
external_memory_handle_types,
|
||||
external_memory_handle_types: _,
|
||||
mutable_format,
|
||||
cube_compatible,
|
||||
array_2d_compatible,
|
||||
@ -218,7 +218,7 @@ impl UnsafeImage {
|
||||
color_attachment: false,
|
||||
depth_stencil_attachment: false,
|
||||
input_attachment: false,
|
||||
..usage.clone()
|
||||
..usage
|
||||
} == ImageUsage::none()
|
||||
)
|
||||
}
|
||||
@ -230,7 +230,7 @@ impl UnsafeImage {
|
||||
));
|
||||
|
||||
// VUID-VkImageCreateInfo-flags-01573
|
||||
assert!(!(block_texel_view_compatible && !mutable_format));
|
||||
assert!(!block_texel_view_compatible || mutable_format);
|
||||
|
||||
// Get format features
|
||||
let format_features = {
|
||||
@ -340,7 +340,7 @@ impl UnsafeImage {
|
||||
ChromaSampling::Mode444 => (),
|
||||
ChromaSampling::Mode422 => {
|
||||
// VUID-VkImageCreateInfo-format-04712
|
||||
if !(extent[0] % 2 == 0) {
|
||||
if extent[0] % 2 != 0 {
|
||||
return Err(ImageCreationError::YcbcrFormatInvalidDimensions);
|
||||
}
|
||||
}
|
||||
@ -653,7 +653,7 @@ impl UnsafeImage {
|
||||
&& ImageUsage {
|
||||
transfer_src: false,
|
||||
transfer_dst: false,
|
||||
..usage.clone()
|
||||
..usage
|
||||
} == ImageUsage::none())
|
||||
} else {
|
||||
false
|
||||
@ -673,10 +673,7 @@ impl UnsafeImage {
|
||||
if !external_memory_handle_types.is_empty() {
|
||||
// If external memory handles are used, the properties need to be queried
|
||||
// individually for each handle type.
|
||||
external_memory_handle_types
|
||||
.iter()
|
||||
.map(|handle_type| Some(handle_type))
|
||||
.collect()
|
||||
external_memory_handle_types.iter().map(Some).collect()
|
||||
} else {
|
||||
smallvec![None]
|
||||
};
|
||||
@ -703,7 +700,7 @@ impl UnsafeImage {
|
||||
max_mip_levels,
|
||||
max_array_layers,
|
||||
sample_counts,
|
||||
max_resource_size,
|
||||
max_resource_size: _,
|
||||
..
|
||||
} = match image_format_properties {
|
||||
Some(x) => x,
|
||||
@ -894,7 +891,7 @@ impl UnsafeImage {
|
||||
|
||||
let image = UnsafeImage {
|
||||
handle,
|
||||
device: device.clone(),
|
||||
device,
|
||||
|
||||
dimensions,
|
||||
format: Some(format),
|
||||
@ -1328,7 +1325,7 @@ impl UnsafeImage {
|
||||
|
||||
let subresource = ash::vk::ImageSubresource {
|
||||
aspect_mask: ash::vk::ImageAspectFlags::from(aspect),
|
||||
mip_level: mip_level,
|
||||
mip_level,
|
||||
array_layer: 0,
|
||||
};
|
||||
|
||||
@ -1685,7 +1682,7 @@ impl fmt::Display for ImageCreationError {
|
||||
Self::FormatNotSupported => {
|
||||
write!(fmt, "the given format was not supported by the device")
|
||||
}
|
||||
Self::FormatUsageNotSupported { usage } => {
|
||||
Self::FormatUsageNotSupported { .. } => {
|
||||
write!(
|
||||
fmt,
|
||||
"a requested usage flag was not supported by the given format"
|
||||
@ -1694,16 +1691,16 @@ impl fmt::Display for ImageCreationError {
|
||||
Self::ImageFormatPropertiesNotSupported => {
|
||||
write!(fmt, "the image configuration as queried through the `image_format_properties` function was not supported by the device")
|
||||
}
|
||||
Self::MaxArrayLayersExceeded { array_layers, max } => {
|
||||
Self::MaxArrayLayersExceeded { .. } => {
|
||||
write!(fmt, "the number of array layers exceeds the maximum supported by the device for this image configuration")
|
||||
}
|
||||
Self::MaxDimensionsExceeded { extent, max } => {
|
||||
Self::MaxDimensionsExceeded { .. } => {
|
||||
write!(fmt, "the specified dimensions exceed the maximum supported by the device for this image configuration")
|
||||
}
|
||||
Self::MaxFramebufferDimensionsExceeded { extent, max } => {
|
||||
Self::MaxFramebufferDimensionsExceeded { .. } => {
|
||||
write!(fmt, "the usage included one of the attachment types, and the specified width and height exceeded the `max_framebuffer_width` or `max_framebuffer_height` limits")
|
||||
}
|
||||
Self::MaxMipLevelsExceeded { mip_levels, max } => {
|
||||
Self::MaxMipLevelsExceeded { .. } => {
|
||||
write!(
|
||||
fmt,
|
||||
"the maximum number of mip levels for the given dimensions has been exceeded"
|
||||
@ -1730,13 +1727,13 @@ impl fmt::Display for ImageCreationError {
|
||||
"multisampling was enabled, but the image type was not 2D"
|
||||
)
|
||||
}
|
||||
Self::SampleCountNotSupported { samples, supported } => {
|
||||
Self::SampleCountNotSupported { .. } => {
|
||||
write!(
|
||||
fmt,
|
||||
"the sample count is not supported by the device for this image configuration"
|
||||
)
|
||||
}
|
||||
Self::SharingInvalidQueueFamilyId { id } => {
|
||||
Self::SharingInvalidQueueFamilyId { .. } => {
|
||||
write!(fmt, "the sharing mode was set to `Concurrent`, but one of the specified queue family ids was not valid")
|
||||
}
|
||||
Self::YcbcrFormatInvalidDimensions => {
|
||||
@ -1761,7 +1758,7 @@ impl fmt::Display for ImageCreationError {
|
||||
)
|
||||
}
|
||||
Self::DirectImageViewCreationFailed(e) => {
|
||||
write!(fmt, "Image view creation failed {}", e.to_string())
|
||||
write!(fmt, "Image view creation failed {}", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1840,6 +1837,7 @@ impl ImageState {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(crate) fn check_cpu_read(&mut self, range: Range<DeviceSize>) -> Result<(), ReadLockError> {
|
||||
for (_range, state) in self.ranges.range(&range) {
|
||||
match &state.current_access {
|
||||
@ -1852,6 +1850,7 @@ impl ImageState {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(crate) unsafe fn cpu_read_lock(&mut self, range: Range<DeviceSize>) {
|
||||
self.ranges.split_at(&range.start);
|
||||
self.ranges.split_at(&range.end);
|
||||
@ -1866,6 +1865,7 @@ impl ImageState {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(crate) unsafe fn cpu_read_unlock(&mut self, range: Range<DeviceSize>) {
|
||||
self.ranges.split_at(&range.start);
|
||||
self.ranges.split_at(&range.end);
|
||||
@ -1878,6 +1878,7 @@ impl ImageState {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(crate) fn check_cpu_write(
|
||||
&mut self,
|
||||
range: Range<DeviceSize>,
|
||||
@ -1900,6 +1901,7 @@ impl ImageState {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(crate) unsafe fn cpu_write_lock(&mut self, range: Range<DeviceSize>) {
|
||||
self.ranges.split_at(&range.start);
|
||||
self.ranges.split_at(&range.end);
|
||||
@ -1909,6 +1911,7 @@ impl ImageState {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(crate) unsafe fn cpu_write_unlock(&mut self, range: Range<DeviceSize>) {
|
||||
self.ranges.split_at(&range.start);
|
||||
self.ranges.split_at(&range.end);
|
||||
@ -2285,7 +2288,7 @@ mod tests {
|
||||
array_layers: 1,
|
||||
},
|
||||
format: Some(Format::R8G8B8A8_UNORM),
|
||||
mip_levels: u32::MAX.into(),
|
||||
mip_levels: u32::MAX,
|
||||
usage: ImageUsage {
|
||||
sampled: true,
|
||||
..ImageUsage::none()
|
||||
@ -2417,6 +2420,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[allow(clippy::erasing_op, clippy::identity_op)]
|
||||
fn subresource_range_iterator() {
|
||||
// A fictitious set of aspects that no real image would actually ever have.
|
||||
let image_aspect_list: SmallVec<[ImageAspect; 4]> = ImageAspects {
|
||||
@ -2453,6 +2457,7 @@ mod tests {
|
||||
mip,
|
||||
image_array_layers,
|
||||
);
|
||||
|
||||
assert_eq!(iter.next(), Some(0 * asp..4 * asp));
|
||||
assert_eq!(iter.next(), None);
|
||||
|
||||
@ -2475,6 +2480,7 @@ mod tests {
|
||||
mip,
|
||||
image_array_layers,
|
||||
);
|
||||
|
||||
assert_eq!(iter.next(), Some(0 * asp..2 * asp));
|
||||
assert_eq!(iter.next(), Some(3 * asp..4 * asp));
|
||||
assert_eq!(iter.next(), None);
|
||||
@ -2521,6 +2527,7 @@ mod tests {
|
||||
mip,
|
||||
image_array_layers,
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
iter.next(),
|
||||
Some(0 * asp + 0 * mip + 2..0 * asp + 0 * mip + 4)
|
||||
|
@ -508,14 +508,13 @@ where
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let mut sampler_ycbcr_conversion_info = if let Some(conversion) = sampler_ycbcr_conversion {
|
||||
Some(ash::vk::SamplerYcbcrConversionInfo {
|
||||
conversion: conversion.internal_object(),
|
||||
..Default::default()
|
||||
})
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let mut sampler_ycbcr_conversion_info =
|
||||
sampler_ycbcr_conversion.as_ref().map(|conversion| {
|
||||
ash::vk::SamplerYcbcrConversionInfo {
|
||||
conversion: conversion.internal_object(),
|
||||
..Default::default()
|
||||
}
|
||||
});
|
||||
|
||||
if let Some(sampler_ycbcr_conversion_info) = sampler_ycbcr_conversion_info.as_mut() {
|
||||
sampler_ycbcr_conversion_info.p_next = create_info.p_next;
|
||||
@ -811,7 +810,7 @@ impl fmt::Display for ImageViewCreationError {
|
||||
#[inline]
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
match *self {
|
||||
Self::OomError(err) => write!(
|
||||
Self::OomError(_) => write!(
|
||||
fmt,
|
||||
"allocating memory failed",
|
||||
),
|
||||
@ -854,7 +853,7 @@ impl fmt::Display for ImageViewCreationError {
|
||||
fmt,
|
||||
"the format requires a sampler YCbCr conversion, but none was provided",
|
||||
),
|
||||
Self::FormatUsageNotSupported { usage } => write!(
|
||||
Self::FormatUsageNotSupported { .. } => write!(
|
||||
fmt,
|
||||
"a requested usage flag was not supported by the given format"
|
||||
),
|
||||
|
@ -63,7 +63,7 @@ pub(super) type UserCallback = Arc<dyn Fn(&Message) + RefUnwindSafe + Send + Syn
|
||||
pub struct DebugUtilsMessenger {
|
||||
handle: ash::vk::DebugUtilsMessengerEXT,
|
||||
instance: Arc<Instance>,
|
||||
user_callback: Box<UserCallback>,
|
||||
_user_callback: Box<UserCallback>,
|
||||
}
|
||||
|
||||
impl DebugUtilsMessenger {
|
||||
@ -86,7 +86,7 @@ impl DebugUtilsMessenger {
|
||||
Ok(DebugUtilsMessenger {
|
||||
handle,
|
||||
instance,
|
||||
user_callback,
|
||||
_user_callback: user_callback,
|
||||
})
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ impl DebugUtilsMessenger {
|
||||
let &mut DebugUtilsMessengerCreateInfo {
|
||||
message_type,
|
||||
message_severity,
|
||||
ref user_callback,
|
||||
user_callback: _,
|
||||
_ne: _,
|
||||
} = create_info;
|
||||
|
||||
@ -185,7 +185,7 @@ impl fmt::Debug for DebugUtilsMessenger {
|
||||
let Self {
|
||||
handle,
|
||||
instance,
|
||||
user_callback: _,
|
||||
_user_callback: _,
|
||||
} = self;
|
||||
|
||||
f.debug_struct("DebugUtilsMessenger")
|
||||
|
@ -27,6 +27,6 @@ mod tests {
|
||||
#[test]
|
||||
fn empty_extensions() {
|
||||
let i: Vec<CString> = (&InstanceExtensions::none()).into();
|
||||
assert!(i.iter().next().is_none());
|
||||
assert!(i.get(0).is_none());
|
||||
}
|
||||
}
|
||||
|
@ -118,11 +118,11 @@ mod tests {
|
||||
Err(_) => return,
|
||||
};
|
||||
|
||||
let mut list = match library.layer_properties() {
|
||||
let list = match library.layer_properties() {
|
||||
Ok(l) => l,
|
||||
Err(_) => return,
|
||||
};
|
||||
|
||||
while let Some(_) = list.next() {}
|
||||
for _ in list {}
|
||||
}
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ pub struct Instance {
|
||||
enabled_layers: Vec<String>,
|
||||
library: Arc<VulkanLibrary>,
|
||||
max_api_version: Version,
|
||||
user_callbacks: Vec<Box<UserCallback>>,
|
||||
_user_callbacks: Vec<Box<UserCallback>>,
|
||||
}
|
||||
|
||||
// TODO: fix the underlying cause instead
|
||||
@ -323,7 +323,7 @@ impl Instance {
|
||||
}
|
||||
|
||||
// Check if the extensions are correct
|
||||
enabled_extensions.check_requirements(&supported_extensions, api_version)?;
|
||||
enabled_extensions.check_requirements(supported_extensions, api_version)?;
|
||||
|
||||
// FIXME: check whether each layer is supported
|
||||
let enabled_layers_cstr: Vec<CString> = enabled_layers
|
||||
@ -453,7 +453,7 @@ impl Instance {
|
||||
enabled_layers,
|
||||
library,
|
||||
max_api_version,
|
||||
user_callbacks,
|
||||
_user_callbacks: user_callbacks,
|
||||
};
|
||||
|
||||
// Enumerating all physical devices.
|
||||
@ -550,7 +550,7 @@ impl fmt::Debug for Instance {
|
||||
enabled_layers,
|
||||
library: function_pointers,
|
||||
max_api_version,
|
||||
user_callbacks: _,
|
||||
_user_callbacks: _,
|
||||
} = self;
|
||||
|
||||
f.debug_struct("Instance")
|
||||
|
@ -62,8 +62,24 @@
|
||||
//!
|
||||
|
||||
//#![warn(missing_docs)] // TODO: activate
|
||||
#![allow(dead_code)] // TODO: remove
|
||||
#![allow(unused_variables)] // TODO: remove
|
||||
|
||||
// These lints are a bit too pedantic, so they're disabled here.
|
||||
#![allow(
|
||||
clippy::collapsible_else_if,
|
||||
clippy::collapsible_if,
|
||||
clippy::large_enum_variant,
|
||||
clippy::len_without_is_empty,
|
||||
clippy::missing_safety_doc, // TODO: remove
|
||||
clippy::module_inception,
|
||||
clippy::mutable_key_type,
|
||||
clippy::new_without_default,
|
||||
clippy::nonminimal_bool,
|
||||
clippy::op_ref, // Seems to be bugged, the fixed code triggers a compile error
|
||||
clippy::too_many_arguments,
|
||||
clippy::type_complexity,
|
||||
clippy::vec_box,
|
||||
clippy::wrong_self_convention
|
||||
)]
|
||||
|
||||
pub use ash::vk::Handle;
|
||||
pub use half;
|
||||
|
@ -264,14 +264,14 @@ where
|
||||
|
||||
impl fmt::Debug for dyn Loader {
|
||||
#[inline]
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Implementation of `Loader` that loads Vulkan from a dynamic library.
|
||||
pub struct DynamicLibraryLoader {
|
||||
vk_lib: Library,
|
||||
_vk_lib: Library,
|
||||
get_instance_proc_addr: ash::vk::PFN_vkGetInstanceProcAddr,
|
||||
}
|
||||
|
||||
@ -294,7 +294,7 @@ impl DynamicLibraryLoader {
|
||||
.map_err(LoadingError::LibraryLoadFailure)?;
|
||||
|
||||
Ok(DynamicLibraryLoader {
|
||||
vk_lib,
|
||||
_vk_lib: vk_lib,
|
||||
get_instance_proc_addr,
|
||||
})
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ use crate::{
|
||||
device::{physical::MemoryType, Device, DeviceOwned},
|
||||
DeviceSize, OomError, Version, VulkanError, VulkanObject,
|
||||
};
|
||||
use parking_lot::Mutex;
|
||||
use std::{
|
||||
error::Error,
|
||||
ffi::c_void,
|
||||
@ -55,8 +54,6 @@ pub struct DeviceMemory {
|
||||
allocation_size: DeviceSize,
|
||||
memory_type_index: u32,
|
||||
export_handle_types: ExternalMemoryHandleTypes,
|
||||
|
||||
mapped: Mutex<bool>,
|
||||
}
|
||||
|
||||
impl DeviceMemory {
|
||||
@ -80,7 +77,7 @@ impl DeviceMemory {
|
||||
let MemoryAllocateInfo {
|
||||
allocation_size,
|
||||
memory_type_index,
|
||||
dedicated_allocation,
|
||||
dedicated_allocation: _,
|
||||
export_handle_types,
|
||||
_ne: _,
|
||||
} = allocate_info;
|
||||
@ -92,8 +89,6 @@ impl DeviceMemory {
|
||||
allocation_size,
|
||||
memory_type_index,
|
||||
export_handle_types,
|
||||
|
||||
mapped: Mutex::new(false),
|
||||
})
|
||||
}
|
||||
|
||||
@ -119,7 +114,7 @@ impl DeviceMemory {
|
||||
let MemoryAllocateInfo {
|
||||
allocation_size,
|
||||
memory_type_index,
|
||||
dedicated_allocation,
|
||||
dedicated_allocation: _,
|
||||
export_handle_types,
|
||||
_ne: _,
|
||||
} = allocate_info;
|
||||
@ -131,8 +126,6 @@ impl DeviceMemory {
|
||||
allocation_size,
|
||||
memory_type_index,
|
||||
export_handle_types,
|
||||
|
||||
mapped: Mutex::new(false),
|
||||
})
|
||||
}
|
||||
|
||||
@ -246,7 +239,7 @@ impl DeviceMemory {
|
||||
match import_info {
|
||||
&mut MemoryImportInfo::Fd {
|
||||
handle_type,
|
||||
ref file,
|
||||
file: _,
|
||||
} => {
|
||||
if !device.enabled_extensions().khr_external_memory_fd {
|
||||
return Err(DeviceMemoryAllocationError::ExtensionNotEnabled {
|
||||
@ -319,8 +312,8 @@ impl DeviceMemory {
|
||||
.memory_type_index(memory_type_index);
|
||||
|
||||
// VUID-VkMemoryDedicatedAllocateInfo-image-01432
|
||||
let mut dedicated_allocate_info = if let Some(dedicated_allocation) = dedicated_allocation {
|
||||
Some(match dedicated_allocation {
|
||||
let mut dedicated_allocate_info =
|
||||
dedicated_allocation.map(|dedicated_allocation| match dedicated_allocation {
|
||||
DedicatedAllocation::Buffer(buffer) => ash::vk::MemoryDedicatedAllocateInfo {
|
||||
buffer: buffer.internal_object(),
|
||||
..Default::default()
|
||||
@ -329,10 +322,7 @@ impl DeviceMemory {
|
||||
image: image.internal_object(),
|
||||
..Default::default()
|
||||
},
|
||||
})
|
||||
} else {
|
||||
None
|
||||
};
|
||||
});
|
||||
|
||||
if let Some(info) = dedicated_allocate_info.as_mut() {
|
||||
allocate_info = allocate_info.push_next(info);
|
||||
@ -1528,8 +1518,7 @@ mod tests {
|
||||
let memory_type = device
|
||||
.physical_device()
|
||||
.memory_types()
|
||||
.filter(|m| !m.is_lazily_allocated())
|
||||
.next()
|
||||
.find(|m| !m.is_lazily_allocated())
|
||||
.unwrap();
|
||||
|
||||
match DeviceMemory::allocate(
|
||||
@ -1552,8 +1541,7 @@ mod tests {
|
||||
let memory_type = device
|
||||
.physical_device()
|
||||
.memory_types()
|
||||
.filter(|m| !m.is_lazily_allocated())
|
||||
.next()
|
||||
.find(|m| !m.is_lazily_allocated())
|
||||
.unwrap();
|
||||
let heap_size = memory_type.heap().size();
|
||||
|
||||
@ -1582,7 +1570,7 @@ mod tests {
|
||||
let (device, _) = gfx_dev_and_queue!();
|
||||
let memory_type = device.physical_device().memory_types().next().unwrap();
|
||||
assert_eq!(*device.allocation_count().lock(), 0);
|
||||
let mem1 = DeviceMemory::allocate(
|
||||
let _mem1 = DeviceMemory::allocate(
|
||||
device.clone(),
|
||||
MemoryAllocateInfo {
|
||||
allocation_size: 256,
|
||||
@ -1593,7 +1581,7 @@ mod tests {
|
||||
.unwrap();
|
||||
assert_eq!(*device.allocation_count().lock(), 1);
|
||||
{
|
||||
let mem2 = DeviceMemory::allocate(
|
||||
let _mem2 = DeviceMemory::allocate(
|
||||
device.clone(),
|
||||
MemoryAllocateInfo {
|
||||
allocation_size: 256,
|
||||
|
@ -52,7 +52,7 @@ impl StandardHostVisibleMemoryTypePool {
|
||||
assert!(memory_type.is_host_visible());
|
||||
|
||||
Arc::new(StandardHostVisibleMemoryTypePool {
|
||||
device: device.clone(),
|
||||
device,
|
||||
memory_type: memory_type.id(),
|
||||
occupied: Mutex::new(Vec::new()),
|
||||
})
|
||||
|
@ -60,8 +60,7 @@ where
|
||||
first_loop
|
||||
.chain(second_loop)
|
||||
.filter(|&(t, _)| (requirements.memory_type_bits & (1 << t.id())) != 0)
|
||||
.filter(|&(t, rq)| filter(t) == rq)
|
||||
.next()
|
||||
.find(|&(t, rq)| filter(t) == rq)
|
||||
.expect("Couldn't find a memory type to allocate from")
|
||||
.0
|
||||
};
|
||||
@ -73,7 +72,7 @@ where
|
||||
pub(crate) fn alloc_dedicated_with_exportable_fd<F>(
|
||||
device: Arc<Device>,
|
||||
requirements: &MemoryRequirements,
|
||||
layout: AllocLayout,
|
||||
_layout: AllocLayout,
|
||||
map: MappingRequirement,
|
||||
dedicated_allocation: DedicatedAllocation,
|
||||
filter: F,
|
||||
|
@ -47,7 +47,7 @@ impl StandardNonHostVisibleMemoryTypePool {
|
||||
);
|
||||
|
||||
Arc::new(StandardNonHostVisibleMemoryTypePool {
|
||||
device: device.clone(),
|
||||
device,
|
||||
memory_type: memory_type.id(),
|
||||
occupied: Mutex::new(Vec::new()),
|
||||
})
|
||||
|
@ -40,7 +40,7 @@ impl StandardMemoryPool {
|
||||
let cap = device.physical_device().memory_types().len();
|
||||
|
||||
Arc::new(StandardMemoryPool {
|
||||
device: device.clone(),
|
||||
device,
|
||||
pools: Mutex::new(HashMap::with_capacity(cap)),
|
||||
})
|
||||
}
|
||||
@ -60,21 +60,21 @@ fn generic_allocation(
|
||||
assert!(memory_type_host_visible || map == MappingRequirement::DoNotMap);
|
||||
|
||||
match pools.entry((memory_type.id(), layout, map)) {
|
||||
Entry::Occupied(entry) => match entry.get() {
|
||||
&Pool::HostVisible(ref pool) => {
|
||||
Entry::Occupied(entry) => match *entry.get() {
|
||||
Pool::HostVisible(ref pool) => {
|
||||
let alloc = pool.alloc(size, alignment)?;
|
||||
let inner = StandardMemoryPoolAllocInner::HostVisible(alloc);
|
||||
Ok(StandardMemoryPoolAlloc {
|
||||
inner,
|
||||
pool: mem_pool.clone(),
|
||||
_pool: mem_pool.clone(),
|
||||
})
|
||||
}
|
||||
&Pool::NonHostVisible(ref pool) => {
|
||||
Pool::NonHostVisible(ref pool) => {
|
||||
let alloc = pool.alloc(size, alignment)?;
|
||||
let inner = StandardMemoryPoolAllocInner::NonHostVisible(alloc);
|
||||
Ok(StandardMemoryPoolAlloc {
|
||||
inner,
|
||||
pool: mem_pool.clone(),
|
||||
_pool: mem_pool.clone(),
|
||||
})
|
||||
}
|
||||
},
|
||||
@ -88,7 +88,7 @@ fn generic_allocation(
|
||||
let inner = StandardMemoryPoolAllocInner::HostVisible(alloc);
|
||||
Ok(StandardMemoryPoolAlloc {
|
||||
inner,
|
||||
pool: mem_pool.clone(),
|
||||
_pool: mem_pool.clone(),
|
||||
})
|
||||
} else {
|
||||
let pool =
|
||||
@ -98,7 +98,7 @@ fn generic_allocation(
|
||||
let inner = StandardMemoryPoolAllocInner::NonHostVisible(alloc);
|
||||
Ok(StandardMemoryPoolAlloc {
|
||||
inner,
|
||||
pool: mem_pool.clone(),
|
||||
_pool: mem_pool.clone(),
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -136,7 +136,7 @@ enum Pool {
|
||||
#[derive(Debug)]
|
||||
pub struct StandardMemoryPoolAlloc {
|
||||
inner: StandardMemoryPoolAllocInner,
|
||||
pool: Arc<StandardMemoryPool>,
|
||||
_pool: Arc<StandardMemoryPool>,
|
||||
}
|
||||
|
||||
impl StandardMemoryPoolAlloc {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user