From 2c5364871e028d33ada891614089219b2c061f71 Mon Sep 17 00:00:00 2001 From: Maik Klein Date: Thu, 2 Aug 2018 21:22:46 +0200 Subject: [PATCH] Update winit to 0.16 --- examples/Cargo.toml | 2 +- examples/src/lib.rs | 38 +++++++++++++++++--------------------- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 3ad5c47..8873048 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["maik klein "] [dependencies] -winit = "0.11.1" +winit = "0.16" image = "0.10.4" ash = { path = "../ash" } diff --git a/examples/src/lib.rs b/examples/src/lib.rs index e0df121..a197f4c 100644 --- a/examples/src/lib.rs +++ b/examples/src/lib.rs @@ -46,8 +46,7 @@ pub fn record_submit_commandbuffer winit::ControlFlow::Break, + WindowEvent::Destroyed => winit::ControlFlow::Break, _ => ControlFlow::Continue, }, _ => ControlFlow::Continue, @@ -267,8 +266,10 @@ impl ExampleBase { let events_loop = winit::EventsLoop::new(); let window = winit::WindowBuilder::new() .with_title("Ash - Example") - .with_dimensions(window_width, window_height) - .build(&events_loop) + .with_dimensions(winit::dpi::LogicalSize::new( + window_width as f64, + window_height as f64, + )).build(&events_loop) .unwrap(); let entry = Entry::new().unwrap(); let app_name = CString::new("VulkanTriangle").unwrap(); @@ -331,8 +332,8 @@ impl ExampleBase { .enumerate() .filter_map(|(index, ref info)| { let supports_graphic_and_surface = - info.queue_flags.subset(vk::QueueFlags::GRAPHICS) - && surface_loader.get_physical_device_surface_support_khr( + info.queue_flags.subset(vk::QueueFlags::GRAPHICS) && surface_loader + .get_physical_device_surface_support_khr( *pdevice, index as u32, surface, @@ -341,10 +342,8 @@ impl ExampleBase { true => Some((*pdevice, index)), _ => None, } - }) - .nth(0) - }) - .filter_map(|v| v) + }).nth(0) + }).filter_map(|v| v) .nth(0) .expect("Couldn't find suitable device."); let queue_family_index = queue_family_index as u32; @@ -390,8 +389,7 @@ impl ExampleBase { color_space: sfmt.color_space, }, _ => sfmt.clone(), - }) - .nth(0) + }).nth(0) .expect("Unable to find suitable surface format."); let surface_capabilities = surface_loader .get_physical_device_surface_capabilities_khr(pdevice, surface) @@ -498,8 +496,7 @@ impl ExampleBase { image: image, }; device.create_image_view(&create_view_info, None).unwrap() - }) - .collect(); + }).collect(); let device_memory_properties = instance.get_physical_device_memory_properties(pdevice); let depth_image_create_info = vk::ImageCreateInfo { s_type: vk::StructureType::IMAGE_CREATE_INFO, @@ -524,12 +521,11 @@ impl ExampleBase { }; let depth_image = device.create_image(&depth_image_create_info, None).unwrap(); let depth_image_memory_req = device.get_image_memory_requirements(depth_image); - let depth_image_memory_index = - find_memorytype_index( - &depth_image_memory_req, - &device_memory_properties, - vk::MemoryPropertyFlags::DEVICE_LOCAL, - ).expect("Unable to find suitable memory index for depth image."); + let depth_image_memory_index = find_memorytype_index( + &depth_image_memory_req, + &device_memory_properties, + vk::MemoryPropertyFlags::DEVICE_LOCAL, + ).expect("Unable to find suitable memory index for depth image."); let depth_image_allocate_info = vk::MemoryAllocateInfo { s_type: vk::StructureType::MEMORY_ALLOCATE_INFO,