From 2e6868a0c0817b45106a2f04f0dd8f7d057dbba8 Mon Sep 17 00:00:00 2001 From: Austin Johnson Date: Fri, 1 Nov 2019 10:12:17 -0500 Subject: [PATCH] Downgrade Winit back to 0.19; Release Vulkano 0.16 (#1267) * fix after revert; release 0.16 * bump shaders version --- CHANGELOG_VK_SYS.md | 4 +- CHANGELOG_VULKANO.md | 6 +++ examples/Cargo.toml | 4 +- examples/src/bin/deferred/main.rs | 56 ++++++++++++------------ examples/src/bin/image/main.rs | 57 ++++++++++++------------ examples/src/bin/indirect.rs | 56 ++++++++++++------------ examples/src/bin/instancing.rs | 56 ++++++++++++------------ examples/src/bin/runtime-shader/main.rs | 58 +++++++++++++------------ examples/src/bin/teapot/main.rs | 58 +++++++++++++------------ examples/src/bin/tessellation.rs | 56 ++++++++++++------------ examples/src/bin/triangle.rs | 58 +++++++++++++------------ vk-sys/Cargo.toml | 2 +- vulkano-shaders/Cargo.toml | 4 +- vulkano-win/Cargo.toml | 6 +-- vulkano-win/src/lib.rs | 51 +++++++++++----------- vulkano/Cargo.toml | 4 +- 16 files changed, 280 insertions(+), 256 deletions(-) diff --git a/CHANGELOG_VK_SYS.md b/CHANGELOG_VK_SYS.md index a81d1198..2e446485 100644 --- a/CHANGELOG_VK_SYS.md +++ b/CHANGELOG_VK_SYS.md @@ -1,4 +1,6 @@ -# Unreleased *breaking* +# Unreleased + +# Version 0.5.0 (2019-11-01) - Add const `STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES_KHR` and struct `PhysicalDevice16BitStorageFeaturesKHR` for `VK_KHR_16bit_storage` diff --git a/CHANGELOG_VULKANO.md b/CHANGELOG_VULKANO.md index 3182d211..6ee60544 100644 --- a/CHANGELOG_VULKANO.md +++ b/CHANGELOG_VULKANO.md @@ -1,5 +1,7 @@ # Unreleased +# Version 0.16.0 (2019-11-01) + - Fixed bug in examples causing OutOfHostMemory errors - Replaced `VK_EXT_debug_report` `VK_EXT_debug_marker` with `VK_EXT_debug_utils`. - Update MacOS dependencies metal to 0.17 and cocoa to 0.19 @@ -16,6 +18,10 @@ - Add support for GLSL macro defines to the `shader!` macro. - Switch to Vulkan 1.1 and inherently SpirV 1.3 (shaderc default version for vulkan 1.1) +# Version 0.15.0 (2019-10-18) + +*Yanked* + # Version 0.14.0 (2019-08-17) - Update shaderc to 0.6. This again allows to use locally installed libraries which reduces the build-time significantly on Arch/Voidlinux (see https://github.com/google/shaderc-rs/issues/58) diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 634659ca..7e1c9c73 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "examples" -version = "0.2.0" +version = "0.1.0" edition = "2018" authors = ["Pierre Krieger "] publish = false @@ -12,7 +12,7 @@ vulkano = { path = "../vulkano" } vulkano-shaders = { path = "../vulkano-shaders" } # The Vulkan library doesn't provide any functionality to create and handle windows, as # this would be out of scope. In order to open a window, we are going to use the `winit` crate. -winit = "0.20.0-alpha4" +winit = "0.19" # The `vulkano_win` crate is the link between `vulkano` and `winit`. Vulkano doesn't know about winit, # and winit doesn't know about vulkano, so import a crate that will provide a link between the two. vulkano-win = { path = "../vulkano-win" } diff --git a/examples/src/bin/deferred/main.rs b/examples/src/bin/deferred/main.rs index 79ab6e64..022fef17 100644 --- a/examples/src/bin/deferred/main.rs +++ b/examples/src/bin/deferred/main.rs @@ -35,9 +35,7 @@ use vulkano::sync; use vulkano_win::VkSurfaceBuild; -use winit::event_loop::{EventLoop, ControlFlow}; -use winit::window::{WindowBuilder}; -use winit::event::{Event, WindowEvent}; +use winit::{EventsLoop, WindowBuilder, Event, WindowEvent}; use cgmath::Matrix4; use cgmath::SquareMatrix; @@ -56,7 +54,7 @@ fn main() { let physical = PhysicalDevice::enumerate(&instance).next().unwrap(); - let events_loop = EventLoop::new(); + let mut events_loop = EventsLoop::new(); let surface = WindowBuilder::new().build_vk_surface(&events_loop, instance.clone()).unwrap(); let window = surface.window(); @@ -76,9 +74,11 @@ fn main() { let alpha = caps.supported_composite_alpha.iter().next().unwrap(); let format = caps.supported_formats[0].0; - let initial_dimensions = { - let dimensions: (u32, u32) = window.inner_size().to_physical(window.hidpi_factor()).into(); + let initial_dimensions = if let Some(dimensions) = window.get_inner_size() { + let dimensions: (u32, u32) = dimensions.to_physical(window.get_hidpi_factor()).into(); [dimensions.0, dimensions.1] + } else { + return; }; Swapchain::new(device.clone(), surface.clone(), caps.min_image_count, format, @@ -92,24 +92,23 @@ fn main() { let triangle_draw_system = TriangleDrawSystem::new(queue.clone(), frame_system.deferred_subpass()); let mut recreate_swapchain = false; - let mut previous_frame_end = Some(Box::new(sync::now(device.clone())) as Box); + let mut previous_frame_end = Box::new(sync::now(device.clone())) as Box; - events_loop.run(move |ev, _, cf| { - *cf = ControlFlow::Poll; - let window = surface.window(); - - previous_frame_end.as_mut().unwrap().cleanup_finished(); + loop { + previous_frame_end.cleanup_finished(); if recreate_swapchain { - let dimensions = { - let dimensions: (u32, u32) = window.inner_size().to_physical(window.hidpi_factor()).into(); + let dimensions = if let Some(dimensions) = window.get_inner_size() { + let dimensions: (u32, u32) = dimensions.to_physical(window.get_hidpi_factor()).into(); [dimensions.0, dimensions.1] + } else { + return; }; let (new_swapchain, new_images) = match swapchain.recreate_with_dimension(dimensions) { Ok(r) => r, Err(SwapchainCreationError::UnsupportedDimensions) => { - return; + continue; } Err(err) => panic!("{:?}", err) }; @@ -123,13 +122,12 @@ fn main() { Ok(r) => r, Err(AcquireError::OutOfDate) => { recreate_swapchain = true; - return; + continue; } Err(err) => panic!("{:?}", err) }; - let prev = previous_frame_end.take(); - let future = prev.unwrap().join(acquire_future); + let future = previous_frame_end.join(acquire_future); let mut frame = frame_system.frame(future, images[image_num].clone(), Matrix4::identity()); let mut after_future = None; while let Some(pass) = frame.next_pass() { @@ -159,22 +157,26 @@ fn main() { Ok(future) => { // This wait is required when using NVIDIA or running on macOS. See https://github.com/vulkano-rs/vulkano/issues/1247 future.wait(None).unwrap(); - previous_frame_end = Some(Box::new(future) as Box<_>); + previous_frame_end = Box::new(future) as Box<_>; } Err(FlushError::OutOfDate) => { recreate_swapchain = true; - previous_frame_end = Some(Box::new(sync::now(device.clone())) as Box<_>); + previous_frame_end = Box::new(sync::now(device.clone())) as Box<_>; } Err(e) => { println!("{:?}", e); - previous_frame_end = Some(Box::new(sync::now(device.clone())) as Box<_>); + previous_frame_end = Box::new(sync::now(device.clone())) as Box<_>; } } - match ev { - Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => *cf = ControlFlow::Exit, - Event::WindowEvent { event: WindowEvent::Resized(_), .. } => recreate_swapchain = true, - _ => (), - } - }); + let mut done = false; + events_loop.poll_events(|ev| { + match ev { + Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => done = true, + Event::WindowEvent { event: WindowEvent::Resized(_), .. } => recreate_swapchain = true, + _ => () + } + }); + if done { return; } + } } diff --git a/examples/src/bin/image/main.rs b/examples/src/bin/image/main.rs index 434a9dac..9369d00a 100644 --- a/examples/src/bin/image/main.rs +++ b/examples/src/bin/image/main.rs @@ -25,9 +25,7 @@ use vulkano::sync; use vulkano_win::VkSurfaceBuild; -use winit::event_loop::{EventLoop, ControlFlow}; -use winit::window::{Window, WindowBuilder}; -use winit::event::{Event, WindowEvent}; +use winit::{EventsLoop, Window, WindowBuilder, Event, WindowEvent}; use png; use std::io::Cursor; @@ -44,7 +42,7 @@ fn main() { let physical = PhysicalDevice::enumerate(&instance).next().unwrap(); println!("Using device: {} (type: {:?})", physical.name(), physical.ty()); - let events_loop = EventLoop::new(); + let mut events_loop = EventsLoop::new(); let surface = WindowBuilder::new().build_vk_surface(&events_loop, instance.clone()).unwrap(); let window = surface.window(); @@ -64,10 +62,13 @@ fn main() { let alpha = caps.supported_composite_alpha.iter().next().unwrap(); let format = caps.supported_formats[0].0; - let initial_dimensions = { + let initial_dimensions = if let Some(dimensions) = window.get_inner_size() { // convert to physical pixels - let dimensions: (u32, u32) = window.inner_size().to_physical(window.hidpi_factor()).into(); + let dimensions: (u32, u32) = dimensions.to_physical(window.get_hidpi_factor()).into(); [dimensions.0, dimensions.1] + } else { + // The window no longer exists so exit the application. + return; }; Swapchain::new(device.clone(), surface.clone(), caps.min_image_count, format, @@ -153,22 +154,21 @@ fn main() { let mut framebuffers = window_size_dependent_setup(&images, render_pass.clone(), &mut dynamic_state); let mut recreate_swapchain = false; - let mut previous_frame_end = Some(Box::new(tex_future) as Box); + let mut previous_frame_end = Box::new(tex_future) as Box; - events_loop.run(move |ev, _, cf| { - *cf = ControlFlow::Poll; - let window = surface.window(); - - previous_frame_end.as_mut().unwrap().cleanup_finished(); + loop { + previous_frame_end.cleanup_finished(); if recreate_swapchain { - let dimensions = { - let dimensions: (u32, u32) = window.inner_size().to_physical(window.hidpi_factor()).into(); + let dimensions = if let Some(dimensions) = window.get_inner_size() { + let dimensions: (u32, u32) = dimensions.to_physical(window.get_hidpi_factor()).into(); [dimensions.0, dimensions.1] + } else { + return; }; let (new_swapchain, new_images) = match swapchain.recreate_with_dimension(dimensions) { Ok(r) => r, - Err(SwapchainCreationError::UnsupportedDimensions) => return, + Err(SwapchainCreationError::UnsupportedDimensions) => continue, Err(err) => panic!("{:?}", err) }; @@ -182,7 +182,7 @@ fn main() { Ok(r) => r, Err(AcquireError::OutOfDate) => { recreate_swapchain = true; - return; + continue; } Err(err) => panic!("{:?}", err) }; @@ -195,8 +195,7 @@ fn main() { .end_render_pass().unwrap() .build().unwrap(); - let prev = previous_frame_end.take(); - let future = prev.unwrap().join(future) + let future = previous_frame_end.join(future) .then_execute(queue.clone(), cb).unwrap() .then_swapchain_present(queue.clone(), swapchain.clone(), image_num) .then_signal_fence_and_flush(); @@ -205,24 +204,28 @@ fn main() { Ok(future) => { // This wait is required when using NVIDIA or running on macOS. See https://github.com/vulkano-rs/vulkano/issues/1247 future.wait(None).unwrap(); - previous_frame_end = Some(Box::new(future) as Box<_>); + previous_frame_end = Box::new(future) as Box<_>; } Err(FlushError::OutOfDate) => { recreate_swapchain = true; - previous_frame_end = Some(Box::new(sync::now(device.clone())) as Box<_>); + previous_frame_end = Box::new(sync::now(device.clone())) as Box<_>; } Err(e) => { println!("{:?}", e); - previous_frame_end = Some(Box::new(sync::now(device.clone())) as Box<_>); + previous_frame_end = Box::new(sync::now(device.clone())) as Box<_>; } } - match ev { - Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => *cf = ControlFlow::Exit, - Event::WindowEvent { event: WindowEvent::Resized(_), .. } => recreate_swapchain = true, - _ => () - } - }); + let mut done = false; + events_loop.poll_events(|ev| { + match ev { + Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => done = true, + Event::WindowEvent { event: WindowEvent::Resized(_), .. } => recreate_swapchain = true, + _ => () + } + }); + if done { return; } + } } /// This method is called once during initialization, then again whenever the window is resized diff --git a/examples/src/bin/indirect.rs b/examples/src/bin/indirect.rs index edc92c7e..2ec27173 100644 --- a/examples/src/bin/indirect.rs +++ b/examples/src/bin/indirect.rs @@ -46,9 +46,7 @@ use vulkano::sync; use vulkano_win::VkSurfaceBuild; -use winit::event_loop::{EventLoop, ControlFlow}; -use winit::window::{Window, WindowBuilder}; -use winit::event::{Event, WindowEvent}; +use winit::{EventsLoop, Window, WindowBuilder, Event, WindowEvent}; use std::sync::Arc; use std::iter; @@ -71,7 +69,7 @@ fn main() { println!("Using device: {} (type: {:?})", physical.name(), physical.ty()); - let events_loop = EventLoop::new(); + let mut events_loop = EventsLoop::new(); let surface = WindowBuilder::new().build_vk_surface(&events_loop, instance.clone()).unwrap(); let window = surface.window(); @@ -90,9 +88,11 @@ fn main() { let usage = caps.supported_usage_flags; let alpha = caps.supported_composite_alpha.iter().next().unwrap(); let format = caps.supported_formats[0].0; - let initial_dimensions = { - let dimensions: (u32, u32) = window.inner_size().to_physical(window.hidpi_factor()).into(); + let initial_dimensions = if let Some(dimensions) = window.get_inner_size() { + let dimensions: (u32, u32) = dimensions.to_physical(window.get_hidpi_factor()).into(); [dimensions.0, dimensions.1] + } else { + return; }; Swapchain::new(device.clone(), surface.clone(), caps.min_image_count, format, @@ -211,22 +211,21 @@ void main() { let mut dynamic_state = DynamicState { line_width: None, viewports: None, scissors: None, compare_mask: None, write_mask: None, reference: None }; let mut framebuffers = window_size_dependent_setup(&images, render_pass.clone(), &mut dynamic_state); let mut recreate_swapchain = false; - let mut previous_frame_end = Some(Box::new(sync::now(device.clone())) as Box); + let mut previous_frame_end = Box::new(sync::now(device.clone())) as Box; - events_loop.run(move |ev, _, cf| { - *cf = ControlFlow::Poll; - let window = surface.window(); - - previous_frame_end.as_mut().unwrap().cleanup_finished(); + loop { + previous_frame_end.cleanup_finished(); if recreate_swapchain { - let dimensions = { - let dimensions: (u32, u32) = window.inner_size().to_physical(window.hidpi_factor()).into(); + let dimensions = if let Some(dimensions) = window.get_inner_size() { + let dimensions: (u32, u32) = dimensions.to_physical(window.get_hidpi_factor()).into(); [dimensions.0, dimensions.1] + } else { + return; }; let (new_swapchain, new_images) = match swapchain.recreate_with_dimension(dimensions) { Ok(r) => r, - Err(SwapchainCreationError::UnsupportedDimensions) => return, + Err(SwapchainCreationError::UnsupportedDimensions) => continue, Err(err) => panic!("{:?}", err) }; swapchain = new_swapchain; @@ -238,7 +237,7 @@ void main() { Ok(r) => r, Err(AcquireError::OutOfDate) => { recreate_swapchain = true; - return; + continue; }, Err(err) => panic!("{:?}", err) }; @@ -288,8 +287,7 @@ void main() { .unwrap() .build().unwrap(); - let prev = previous_frame_end.take(); - let future = prev.unwrap().join(acquire_future) + let future = previous_frame_end.join(acquire_future) .then_execute(queue.clone(), command_buffer).unwrap() .then_swapchain_present(queue.clone(), swapchain.clone(), image_num) .then_signal_fence_and_flush(); @@ -298,24 +296,28 @@ void main() { Ok(future) => { // This wait is required when using NVIDIA or running on macOS. See https://github.com/vulkano-rs/vulkano/issues/1247 future.wait(None).unwrap(); - previous_frame_end = Some(Box::new(future) as Box<_>); + previous_frame_end = Box::new(future) as Box<_>; } Err(FlushError::OutOfDate) => { recreate_swapchain = true; - previous_frame_end = Some(Box::new(sync::now(device.clone())) as Box<_>); + previous_frame_end = Box::new(sync::now(device.clone())) as Box<_>; } Err(e) => { println!("{:?}", e); - previous_frame_end = Some(Box::new(sync::now(device.clone())) as Box<_>); + previous_frame_end = Box::new(sync::now(device.clone())) as Box<_>; } } - match ev { - Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => *cf = ControlFlow::Exit, - Event::WindowEvent { event: WindowEvent::Resized(_), .. } => recreate_swapchain = true, - _ => () - } - }); + let mut done = false; + events_loop.poll_events(|ev| { + match ev { + Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => done = true, + Event::WindowEvent { event: WindowEvent::Resized(_), .. } => recreate_swapchain = true, + _ => () + } + }); + if done { return; } + } } /// This method is called once during initialization, then again whenever the window is resized diff --git a/examples/src/bin/instancing.rs b/examples/src/bin/instancing.rs index 81aabdb7..50594b66 100644 --- a/examples/src/bin/instancing.rs +++ b/examples/src/bin/instancing.rs @@ -34,9 +34,7 @@ use vulkano::sync; use vulkano_win::VkSurfaceBuild; -use winit::event_loop::{EventLoop, ControlFlow}; -use winit::window::{Window, WindowBuilder}; -use winit::event::{Event, WindowEvent}; +use winit::{EventsLoop, Window, WindowBuilder, Event, WindowEvent}; use std::sync::Arc; @@ -70,7 +68,7 @@ fn main() { println!("Using device: {} (type: {:?})", physical.name(), physical.ty()); - let events_loop = EventLoop::new(); + let mut events_loop = EventsLoop::new(); let surface = WindowBuilder::new().build_vk_surface(&events_loop, instance.clone()).unwrap(); let window = surface.window(); @@ -89,9 +87,11 @@ fn main() { let usage = caps.supported_usage_flags; let alpha = caps.supported_composite_alpha.iter().next().unwrap(); let format = caps.supported_formats[0].0; - let initial_dimensions = { - let dimensions: (u32, u32) = window.inner_size().to_physical(window.hidpi_factor()).into(); + let initial_dimensions = if let Some(dimensions) = window.get_inner_size() { + let dimensions: (u32, u32) = dimensions.to_physical(window.get_hidpi_factor()).into(); [dimensions.0, dimensions.1] + } else { + return; }; Swapchain::new(device.clone(), surface.clone(), caps.min_image_count, format, @@ -200,22 +200,21 @@ void main() { let mut dynamic_state = DynamicState { line_width: None, viewports: None, scissors: None, compare_mask: None, write_mask: None, reference: None }; let mut framebuffers = window_size_dependent_setup(&images, render_pass.clone(), &mut dynamic_state); let mut recreate_swapchain = false; - let mut previous_frame_end = Some(Box::new(sync::now(device.clone())) as Box); + let mut previous_frame_end = Box::new(sync::now(device.clone())) as Box; - events_loop.run(move |ev, _, cf| { - *cf = ControlFlow::Poll; - let window = surface.window(); - - previous_frame_end.as_mut().unwrap().cleanup_finished(); + loop { + previous_frame_end.cleanup_finished(); if recreate_swapchain { - let dimensions = { - let dimensions: (u32, u32) = window.inner_size().to_physical(window.hidpi_factor()).into(); + let dimensions = if let Some(dimensions) = window.get_inner_size() { + let dimensions: (u32, u32) = dimensions.to_physical(window.get_hidpi_factor()).into(); [dimensions.0, dimensions.1] + } else { + return; }; let (new_swapchain, new_images) = match swapchain.recreate_with_dimension(dimensions) { Ok(r) => r, - Err(SwapchainCreationError::UnsupportedDimensions) => return, + Err(SwapchainCreationError::UnsupportedDimensions) => continue, Err(err) => panic!("{:?}", err) }; swapchain = new_swapchain; @@ -227,7 +226,7 @@ void main() { Ok(r) => r, Err(AcquireError::OutOfDate) => { recreate_swapchain = true; - return; + continue; }, Err(err) => panic!("{:?}", err) }; @@ -250,8 +249,7 @@ void main() { .unwrap() .build().unwrap(); - let prev = previous_frame_end.take(); - let future = prev.unwrap().join(acquire_future) + let future = previous_frame_end.join(acquire_future) .then_execute(queue.clone(), command_buffer).unwrap() .then_swapchain_present(queue.clone(), swapchain.clone(), image_num) .then_signal_fence_and_flush(); @@ -260,24 +258,28 @@ void main() { Ok(future) => { // This wait is required when using NVIDIA or running on macOS. See https://github.com/vulkano-rs/vulkano/issues/1247 future.wait(None).unwrap(); - previous_frame_end = Some(Box::new(future) as Box<_>); + previous_frame_end = Box::new(future) as Box<_>; } Err(FlushError::OutOfDate) => { recreate_swapchain = true; - previous_frame_end = Some(Box::new(sync::now(device.clone())) as Box<_>); + previous_frame_end = Box::new(sync::now(device.clone())) as Box<_>; } Err(e) => { println!("{:?}", e); - previous_frame_end = Some(Box::new(sync::now(device.clone())) as Box<_>); + previous_frame_end = Box::new(sync::now(device.clone())) as Box<_>; } } - match ev { - Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => *cf = ControlFlow::Exit, - Event::WindowEvent { event: WindowEvent::Resized(_), .. } => recreate_swapchain = true, - _ => () - } - }); + let mut done = false; + events_loop.poll_events(|ev| { + match ev { + Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => done = true, + Event::WindowEvent { event: WindowEvent::Resized(_), .. } => recreate_swapchain = true, + _ => () + } + }); + if done { return; } + } } /// This method is called once during initialization, then again whenever the window is resized diff --git a/examples/src/bin/runtime-shader/main.rs b/examples/src/bin/runtime-shader/main.rs index e72a193e..f7e64ee3 100644 --- a/examples/src/bin/runtime-shader/main.rs +++ b/examples/src/bin/runtime-shader/main.rs @@ -44,9 +44,7 @@ use vulkano::sync; use vulkano_win::VkSurfaceBuild; -use winit::event_loop::{EventLoop, ControlFlow}; -use winit::window::{Window, WindowBuilder}; -use winit::event::{Event, WindowEvent}; +use winit::Window; use std::borrow::Cow; use std::ffi::CStr; @@ -66,8 +64,8 @@ fn main() { let instance = vk::instance::Instance::new(None, &vulkano_win::required_extensions(), None).unwrap(); let physical = vk::instance::PhysicalDevice::enumerate(&instance).next().unwrap(); - let events_loop = EventLoop::new(); - let surface = WindowBuilder::new().build_vk_surface(&events_loop, instance.clone()).unwrap(); + let mut events_loop = winit::EventsLoop::new(); + let surface = winit::WindowBuilder::new().build_vk_surface(&events_loop, instance.clone()).unwrap(); let window = surface.window(); let queue_family = physical.queue_families().find(|&q| { @@ -80,9 +78,11 @@ fn main() { }; let queue = queues.next().unwrap(); - let initial_dimensions = { - let dimensions: (u32, u32) = window.inner_size().to_physical(window.hidpi_factor()).into(); + let initial_dimensions = if let Some(dimensions) = window.get_inner_size() { + let dimensions: (u32, u32) = dimensions.to_physical(window.get_hidpi_factor()).into(); [dimensions.0, dimensions.1] + } else { + return; }; let (mut swapchain, images) = { @@ -384,24 +384,23 @@ fn main() { let mut dynamic_state = DynamicState { line_width: None, viewports: None, scissors: None, compare_mask: None, write_mask: None, reference: None }; let mut framebuffers = window_size_dependent_setup(&images, render_pass.clone(), &mut dynamic_state); - let mut previous_frame_end = Some(Box::new(sync::now(device.clone())) as Box); + let mut previous_frame_end = Box::new(sync::now(device.clone())) as Box; - events_loop.run(move |ev, _, cf| { - *cf = ControlFlow::Poll; - let window = surface.window(); - - previous_frame_end.as_mut().unwrap().cleanup_finished(); + loop { + previous_frame_end.cleanup_finished(); if recreate_swapchain { // Get the new dimensions for the viewport/framebuffers. - let dimensions = { - let dimensions: (u32, u32) = window.inner_size().to_physical(window.hidpi_factor()).into(); + let dimensions = if let Some(dimensions) = window.get_inner_size() { + let dimensions: (u32, u32) = dimensions.to_physical(window.get_hidpi_factor()).into(); [dimensions.0, dimensions.1] + } else { + return; }; let (new_swapchain, new_images) = match swapchain.recreate_with_dimension(dimensions) { Ok(r) => r, - Err(SwapchainCreationError::UnsupportedDimensions) => return, + Err(SwapchainCreationError::UnsupportedDimensions) => continue, Err(err) => panic!("{:?}", err) }; @@ -415,7 +414,7 @@ fn main() { Ok(r) => r, Err(AcquireError::OutOfDate) => { recreate_swapchain = true; - return; + continue; }, Err(err) => panic!("{:?}", err) }; @@ -428,8 +427,7 @@ fn main() { .end_render_pass().unwrap() .build().unwrap(); - let prev = previous_frame_end.take(); - let future = prev.unwrap().join(acquire_future) + let future = previous_frame_end.join(acquire_future) .then_execute(queue.clone(), command_buffer).unwrap() .then_swapchain_present(queue.clone(), swapchain.clone(), image_num) .then_signal_fence_and_flush(); @@ -438,24 +436,28 @@ fn main() { Ok(future) => { // This wait is required when using NVIDIA or running on macOS. See https://github.com/vulkano-rs/vulkano/issues/1247 future.wait(None).unwrap(); - previous_frame_end = Some(Box::new(future) as Box<_>); + previous_frame_end = Box::new(future) as Box<_>; } Err(vulkano::sync::FlushError::OutOfDate) => { recreate_swapchain = true; - previous_frame_end = Some(Box::new(vulkano::sync::now(device.clone())) as Box<_>); + previous_frame_end = Box::new(vulkano::sync::now(device.clone())) as Box<_>; } Err(e) => { println!("{:?}", e); - previous_frame_end = Some(Box::new(vulkano::sync::now(device.clone())) as Box<_>); + previous_frame_end = Box::new(vulkano::sync::now(device.clone())) as Box<_>; } } - match ev { - Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => *cf = ControlFlow::Exit, - Event::WindowEvent { event: WindowEvent::Resized(_), .. } => recreate_swapchain = true, - _ => () - } - }); + let mut done = false; + events_loop.poll_events(|ev| { + match ev { + winit::Event::WindowEvent { event: winit::WindowEvent::CloseRequested, .. } => done = true, + winit::Event::WindowEvent { event: winit::WindowEvent::Resized(_), .. } => recreate_swapchain = true, + _ => () + } + }); + if done { return; } + } } /// This method is called once during initialization, then again whenever the window is resized diff --git a/examples/src/bin/teapot/main.rs b/examples/src/bin/teapot/main.rs index bb7cd940..4c45b0d4 100644 --- a/examples/src/bin/teapot/main.rs +++ b/examples/src/bin/teapot/main.rs @@ -28,9 +28,7 @@ use vulkano::sync; use vulkano_win::VkSurfaceBuild; -use winit::event_loop::{EventLoop, ControlFlow}; -use winit::window::{Window, WindowBuilder}; -use winit::event::{Event, WindowEvent}; +use winit::Window; use cgmath::{Matrix3, Matrix4, Point3, Vector3, Rad}; @@ -50,15 +48,17 @@ fn main() { let physical = PhysicalDevice::enumerate(&instance).next().unwrap(); println!("Using device: {} (type: {:?})", physical.name(), physical.ty()); - let events_loop = EventLoop::new(); - let surface = WindowBuilder::new().build_vk_surface(&events_loop, instance.clone()).unwrap(); + let mut events_loop = winit::EventsLoop::new(); + let surface = winit::WindowBuilder::new().build_vk_surface(&events_loop, instance.clone()).unwrap(); let window = surface.window(); // unlike the triangle example we need to keep track of the width and height so we can calculate // render the teapot with the correct aspect ratio. - let mut dimensions = { - let dimensions: (u32, u32) = window.inner_size().to_physical(window.hidpi_factor()).into(); + let mut dimensions = if let Some(dimensions) = window.get_inner_size() { + let dimensions: (u32, u32) = dimensions.to_physical(window.get_hidpi_factor()).into(); [dimensions.0, dimensions.1] + } else { + return; }; let queue_family = physical.queue_families().find(|&q| @@ -123,24 +123,23 @@ fn main() { let (mut pipeline, mut framebuffers) = window_size_dependent_setup(device.clone(), &vs, &fs, &images, render_pass.clone()); let mut recreate_swapchain = false; - let mut previous_frame = Some(Box::new(sync::now(device.clone())) as Box); + let mut previous_frame = Box::new(sync::now(device.clone())) as Box; let rotation_start = Instant::now(); - events_loop.run(move |ev, _, cf| { - *cf = ControlFlow::Poll; - let window = surface.window(); - - previous_frame.as_mut().unwrap().cleanup_finished(); + loop { + previous_frame.cleanup_finished(); if recreate_swapchain { - dimensions = { - let dimensions: (u32, u32) = window.inner_size().to_physical(window.hidpi_factor()).into(); + dimensions = if let Some(dimensions) = window.get_inner_size() { + let dimensions: (u32, u32) = dimensions.to_physical(window.get_hidpi_factor()).into(); [dimensions.0, dimensions.1] + } else { + return; }; let (new_swapchain, new_images) = match swapchain.recreate_with_dimension(dimensions) { Ok(r) => r, - Err(SwapchainCreationError::UnsupportedDimensions) => return, + Err(SwapchainCreationError::UnsupportedDimensions) => continue, Err(err) => panic!("{:?}", err) }; swapchain = new_swapchain; @@ -182,7 +181,7 @@ fn main() { Ok(r) => r, Err(AcquireError::OutOfDate) => { recreate_swapchain = true; - return; + continue; } Err(err) => panic!("{:?}", err) }; @@ -203,8 +202,7 @@ fn main() { .end_render_pass().unwrap() .build().unwrap(); - let prev = previous_frame.take(); - let future = prev.unwrap().join(acquire_future) + let future = previous_frame.join(acquire_future) .then_execute(queue.clone(), command_buffer).unwrap() .then_swapchain_present(queue.clone(), swapchain.clone(), image_num) .then_signal_fence_and_flush(); @@ -213,24 +211,28 @@ fn main() { Ok(future) => { // This wait is required when using NVIDIA or running on macOS. See https://github.com/vulkano-rs/vulkano/issues/1247 future.wait(None).unwrap(); - previous_frame = Some(Box::new(future) as Box<_>); + previous_frame = Box::new(future) as Box<_>; } Err(sync::FlushError::OutOfDate) => { recreate_swapchain = true; - previous_frame = Some(Box::new(sync::now(device.clone())) as Box<_>); + previous_frame = Box::new(sync::now(device.clone())) as Box<_>; } Err(e) => { println!("{:?}", e); - previous_frame = Some(Box::new(sync::now(device.clone())) as Box<_>); + previous_frame = Box::new(sync::now(device.clone())) as Box<_>; } } - match ev { - Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => *cf = ControlFlow::Exit, - Event::WindowEvent { event: WindowEvent::Resized(_), .. } => recreate_swapchain = true, - _ => () - } - }); + let mut done = false; + events_loop.poll_events(|ev| { + match ev { + winit::Event::WindowEvent { event: winit::WindowEvent::CloseRequested, .. } => done = true, + winit::Event::WindowEvent { event: winit::WindowEvent::Resized(_), .. } => recreate_swapchain = true, + _ => () + } + }); + if done { return; } + } } /// This method is called once during initialization, then again whenever the window is resized diff --git a/examples/src/bin/tessellation.rs b/examples/src/bin/tessellation.rs index 0dd6f35c..ccacd72a 100644 --- a/examples/src/bin/tessellation.rs +++ b/examples/src/bin/tessellation.rs @@ -33,9 +33,7 @@ use vulkano::sync; use vulkano_win::VkSurfaceBuild; -use winit::event_loop::{EventLoop, ControlFlow}; -use winit::window::{Window, WindowBuilder}; -use winit::event::{Event, WindowEvent}; +use winit::{EventsLoop, Window, WindowBuilder, Event, WindowEvent}; use std::sync::Arc; @@ -138,7 +136,7 @@ fn main() { let physical = PhysicalDevice::enumerate(&instance).next().unwrap(); println!("Using device: {} (type: {:?})", physical.name(), physical.ty()); - let events_loop = EventLoop::new(); + let mut events_loop = EventsLoop::new(); let surface = WindowBuilder::new().build_vk_surface(&events_loop, instance.clone()).unwrap(); let window = surface.window(); @@ -151,9 +149,11 @@ fn main() { [(queue_family, 0.5)].iter().cloned()).unwrap(); let queue = queues.next().unwrap(); - let initial_dimensions = { - let dimensions: (u32, u32) = window.inner_size().to_physical(window.hidpi_factor()).into(); + let initial_dimensions = if let Some(dimensions) = window.get_inner_size() { + let dimensions: (u32, u32) = dimensions.to_physical(window.get_hidpi_factor()).into(); [dimensions.0, dimensions.1] + } else { + return; }; let (mut swapchain, images) = { @@ -223,26 +223,24 @@ fn main() { .unwrap()); let mut recreate_swapchain = false; - let mut previous_frame_end = Some(Box::new(sync::now(device.clone())) as Box); + let mut previous_frame_end = Box::new(sync::now(device.clone())) as Box; let mut dynamic_state = DynamicState { line_width: None, viewports: None, scissors: None, compare_mask: None, write_mask: None, reference: None }; - let mut framebuffers = window_size_dependent_setup(&images, render_pass.clone(), &mut dynamic_state); - events_loop.run(move |ev, _, cf| { - *cf = ControlFlow::Poll; - let window = surface.window(); - - previous_frame_end.as_mut().unwrap().cleanup_finished(); + loop { + previous_frame_end.cleanup_finished(); if recreate_swapchain { - let dimensions = { - let dimensions: (u32, u32) = window.inner_size().to_physical(window.hidpi_factor()).into(); + let dimensions = if let Some(dimensions) = window.get_inner_size() { + let dimensions: (u32, u32) = dimensions.to_physical(window.get_hidpi_factor()).into(); [dimensions.0, dimensions.1] + } else { + return; }; let (new_swapchain, new_images) = match swapchain.recreate_with_dimension(dimensions) { Ok(r) => r, Err(SwapchainCreationError::UnsupportedDimensions) => { - return; + continue; }, Err(err) => panic!("{:?}", err) }; @@ -257,7 +255,7 @@ fn main() { Ok(r) => r, Err(AcquireError::OutOfDate) => { recreate_swapchain = true; - return; + continue; }, Err(err) => panic!("{:?}", err) }; @@ -271,7 +269,7 @@ fn main() { .unwrap() .build().unwrap(); - let future = previous_frame_end.take().unwrap().join(acquire_future) + let future = previous_frame_end.join(acquire_future) .then_execute(queue.clone(), command_buffer).unwrap() .then_swapchain_present(queue.clone(), swapchain.clone(), image_num) .then_signal_fence_and_flush(); @@ -280,24 +278,28 @@ fn main() { Ok(future) => { // This wait is required when using NVIDIA or running on macOS. See https://github.com/vulkano-rs/vulkano/issues/1247 future.wait(None).unwrap(); - previous_frame_end = Some(Box::new(future) as Box<_>); + previous_frame_end = Box::new(future) as Box<_>; } Err(FlushError::OutOfDate) => { recreate_swapchain = true; - previous_frame_end = Some(Box::new(sync::now(device.clone())) as Box<_>); + previous_frame_end = Box::new(sync::now(device.clone())) as Box<_>; } Err(e) => { println!("{:?}", e); - previous_frame_end = Some(Box::new(sync::now(device.clone())) as Box<_>); + previous_frame_end = Box::new(sync::now(device.clone())) as Box<_>; } } - match ev { - Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => *cf = ControlFlow::Exit, - Event::WindowEvent { event: WindowEvent::Resized(_), .. } => recreate_swapchain = true, - _ => (), - } - }); + let mut done = false; + events_loop.poll_events(|ev| { + match ev { + Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => done = true, + Event::WindowEvent { event: WindowEvent::Resized(_), .. } => recreate_swapchain = true, + _ => () + } + }); + if done { return } + } } /// This method is called once during initialization, then again whenever the window is resized diff --git a/examples/src/bin/triangle.rs b/examples/src/bin/triangle.rs index dd2c7f8f..419aeca2 100644 --- a/examples/src/bin/triangle.rs +++ b/examples/src/bin/triangle.rs @@ -31,9 +31,7 @@ use vulkano::sync; use vulkano_win::VkSurfaceBuild; -use winit::event_loop::{EventLoop, ControlFlow}; -use winit::window::{Window, WindowBuilder}; -use winit::event::{Event, WindowEvent}; +use winit::{EventsLoop, Window, WindowBuilder, Event, WindowEvent}; use std::sync::Arc; @@ -80,7 +78,7 @@ fn main() { // // This returns a `vulkano::swapchain::Surface` object that contains both a cross-platform winit // window and a cross-platform Vulkan surface that represents the surface of the window. - let events_loop = EventLoop::new(); + let mut events_loop = EventsLoop::new(); let surface = WindowBuilder::new().build_vk_surface(&events_loop, instance.clone()).unwrap(); let window = surface.window(); @@ -154,10 +152,13 @@ fn main() { // These drivers will allow anything but the only sensible value is the window dimensions. // // Because for both of these cases, the swapchain needs to be the window dimensions, we just use that. - let initial_dimensions = { + let initial_dimensions = if let Some(dimensions) = window.get_inner_size() { // convert to physical pixels - let dimensions: (u32, u32) = window.inner_size().to_physical(window.hidpi_factor()).into(); + let dimensions: (u32, u32) = dimensions.to_physical(window.get_hidpi_factor()).into(); [dimensions.0, dimensions.1] + } else { + // The window no longer exists so exit the application. + return; }; // Please take a look at the docs for the meaning of the parameters we didn't mention. @@ -309,32 +310,31 @@ void main() { // // Destroying the `GpuFuture` blocks until the GPU is finished executing it. In order to avoid // that, we store the submission of the previous frame here. - let mut previous_frame_end = Some(Box::new(sync::now(device.clone())) as Box); - - events_loop.run(move |ev, _, cf| { - *cf = ControlFlow::Poll; - let window = surface.window(); + let mut previous_frame_end = Box::new(sync::now(device.clone())) as Box; + loop { // It is important to call this function from time to time, otherwise resources will keep // accumulating and you will eventually reach an out of memory error. // Calling this function polls various fences in order to determine what the GPU has // already processed, and frees the resources that are no longer needed. - previous_frame_end.as_mut().unwrap().cleanup_finished(); + previous_frame_end.cleanup_finished(); // Whenever the window resizes we need to recreate everything dependent on the window size. // In this example that includes the swapchain, the framebuffers and the dynamic state viewport. if recreate_swapchain { // Get the new dimensions of the window. - let dimensions = { - let dimensions: (u32, u32) = window.inner_size().to_physical(window.hidpi_factor()).into(); + let dimensions = if let Some(dimensions) = window.get_inner_size() { + let dimensions: (u32, u32) = dimensions.to_physical(window.get_hidpi_factor()).into(); [dimensions.0, dimensions.1] + } else { + return; }; let (new_swapchain, new_images) = match swapchain.recreate_with_dimension(dimensions) { Ok(r) => r, // This error tends to happen when the user is manually resizing the window. // Simply restarting the loop is the easiest way to fix this issue. - Err(SwapchainCreationError::UnsupportedDimensions) => return, + Err(SwapchainCreationError::UnsupportedDimensions) => continue, Err(err) => panic!("{:?}", err) }; @@ -357,7 +357,7 @@ void main() { Ok(r) => r, Err(AcquireError::OutOfDate) => { recreate_swapchain = true; - return; + continue; }, Err(err) => panic!("{:?}", err) }; @@ -401,8 +401,7 @@ void main() { // Finish building the command buffer by calling `build`. .build().unwrap(); - let prev = previous_frame_end.take(); - let future = prev.unwrap().join(acquire_future) + let future = previous_frame_end.join(acquire_future) .then_execute(queue.clone(), command_buffer).unwrap() // The color output is now expected to contain our triangle. But in order to show it on @@ -418,15 +417,15 @@ void main() { Ok(future) => { // This wait is required when using NVIDIA or running on macOS. See https://github.com/vulkano-rs/vulkano/issues/1247 future.wait(None).unwrap(); - previous_frame_end = Some(Box::new(future) as Box<_>); + previous_frame_end = Box::new(future) as Box<_>; } Err(FlushError::OutOfDate) => { recreate_swapchain = true; - previous_frame_end = Some(Box::new(sync::now(device.clone())) as Box<_>); + previous_frame_end = Box::new(sync::now(device.clone())) as Box<_>; } Err(e) => { println!("{:?}", e); - previous_frame_end = Some(Box::new(sync::now(device.clone())) as Box<_>); + previous_frame_end = Box::new(sync::now(device.clone())) as Box<_>; } } @@ -440,13 +439,16 @@ void main() { // Handling the window events in order to close the program when the user wants to close // it. - - match ev { - Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => *cf = ControlFlow::Exit, - Event::WindowEvent { event: WindowEvent::Resized(_), .. } => recreate_swapchain = true, - _ => {}, - } - }); + let mut done = false; + events_loop.poll_events(|ev| { + match ev { + Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => done = true, + Event::WindowEvent { event: WindowEvent::Resized(_), .. } => recreate_swapchain = true, + _ => () + } + }); + if done { return; } + } } /// This method is called once during initialization, then again whenever the window is resized diff --git a/vk-sys/Cargo.toml b/vk-sys/Cargo.toml index 03d9824f..ea8a288b 100644 --- a/vk-sys/Cargo.toml +++ b/vk-sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "vk-sys" -version = "0.4.0" +version = "0.5.0" authors = ["Pierre Krieger ", "The vulkano contributors"] repository = "https://github.com/vulkano-rs/vulkano" description = "Bindings for the Vulkan graphics API" diff --git a/vulkano-shaders/Cargo.toml b/vulkano-shaders/Cargo.toml index 43c3232e..d5336da3 100644 --- a/vulkano-shaders/Cargo.toml +++ b/vulkano-shaders/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "vulkano-shaders" -version = "0.14.0" +version = "0.16.0" edition = "2018" authors = ["Pierre Krieger ", "The vulkano contributors"] repository = "https://github.com/vulkano-rs/vulkano" @@ -21,7 +21,7 @@ quote = "1.0" proc-macro2 = "1.0" [dev-dependencies] -vulkano = { version = "0.14", path = "../vulkano" } +vulkano = { version = "0.16", path = "../vulkano" } [features] shaderc-build-from-source = ["shaderc/build-from-source"] diff --git a/vulkano-win/Cargo.toml b/vulkano-win/Cargo.toml index e3bf9912..7ebe71c0 100644 --- a/vulkano-win/Cargo.toml +++ b/vulkano-win/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "vulkano-win" -version = "0.15.0" +version = "0.16.0" edition = "2018" authors = ["Pierre Krieger ", "The vulkano contributors"] repository = "https://github.com/vulkano-rs/vulkano" @@ -12,8 +12,8 @@ keywords = ["vulkan", "bindings", "graphics", "gpu", "rendering"] categories = ["rendering::graphics-api"] [dependencies] -winit = "0.20.0-alpha4" -vulkano = { version = "0.14.0", path = "../vulkano" } +winit = "0.19" +vulkano = { version = "0.16.0", path = "../vulkano" } [target.'cfg(target_os = "macos")'.dependencies] metal = "0.17.0" diff --git a/vulkano-win/src/lib.rs b/vulkano-win/src/lib.rs index dcf8211e..43e26814 100644 --- a/vulkano-win/src/lib.rs +++ b/vulkano-win/src/lib.rs @@ -12,9 +12,8 @@ use vulkano::instance::Instance; use vulkano::instance::InstanceExtensions; use vulkano::swapchain::Surface; use vulkano::swapchain::SurfaceCreationError; -use winit::event_loop::EventLoop; -use winit::window::WindowBuilder; -use winit::error::OsError as WindowCreationError; +use winit::{EventsLoop, WindowBuilder}; +use winit::CreationError as WindowCreationError; #[cfg(target_os = "macos")] use cocoa::appkit::{NSView, NSWindow}; @@ -53,21 +52,21 @@ pub fn create_vk_surface( window: W, instance: Arc ) -> Result>, SurfaceCreationError> where - W: SafeBorrow, + W: SafeBorrow, { unsafe { winit_to_surface(instance, window) } } pub trait VkSurfaceBuild { fn build_vk_surface( - self, events_loop: &EventLoop<()>, instance: Arc, - ) -> Result>, CreationError>; + self, events_loop: &EventsLoop, instance: Arc, + ) -> Result>, CreationError>; } impl VkSurfaceBuild for WindowBuilder { fn build_vk_surface( - self, events_loop: &EventLoop<()>, instance: Arc, - ) -> Result>, CreationError> { + self, events_loop: &EventsLoop, instance: Arc, + ) -> Result>, CreationError> { let window = self.build(events_loop)?; Ok(create_vk_surface(window, instance)?) } @@ -122,21 +121,21 @@ impl From for CreationError { } #[cfg(target_os = "android")] -unsafe fn winit_to_surface>( +unsafe fn winit_to_surface>( instance: Arc, win: W, ) -> Result>, SurfaceCreationError> { - use winit::platform::android::WindowExtAndroid; - Surface::from_anativewindow(instance, win.borrow().native_window(), win) + use winit::os::android::WindowExt; + Surface::from_anativewindow(instance, win.borrow().get_native_window(), win) } #[cfg(all(unix, not(target_os = "android"), not(target_os = "macos")))] -unsafe fn winit_to_surface>( +unsafe fn winit_to_surface>( instance: Arc, win: W, ) -> Result>, SurfaceCreationError> { - use winit::platform::unix::WindowExtUnix; + use winit::os::unix::WindowExt; match ( - win.borrow().wayland_display(), - win.borrow().wayland_surface(), + win.borrow().get_wayland_display(), + win.borrow().get_wayland_surface(), ) { (Some(display), Some(surface)) => Surface::from_wayland(instance, display, surface, win), _ => { @@ -145,15 +144,15 @@ unsafe fn winit_to_surface>( if instance.loaded_extensions().khr_xlib_surface { Surface::from_xlib( instance, - win.borrow().xlib_display().unwrap(), - win.borrow().xlib_window().unwrap() as _, + win.borrow().get_xlib_display().unwrap(), + win.borrow().get_xlib_window().unwrap() as _, win, ) } else { Surface::from_xcb( instance, - win.borrow().xcb_connection().unwrap(), - win.borrow().xlib_window().unwrap() as _, + win.borrow().get_xcb_connection().unwrap(), + win.borrow().get_xlib_window().unwrap() as _, win, ) } @@ -162,25 +161,25 @@ unsafe fn winit_to_surface>( } #[cfg(target_os = "windows")] -unsafe fn winit_to_surface>( +unsafe fn winit_to_surface>( instance: Arc, win: W, ) -> Result>, SurfaceCreationError> { - use winit::platform::windows::WindowExtWindows; + use winit::os::windows::WindowExt; Surface::from_hwnd( instance, ptr::null() as *const (), // FIXME - win.borrow().hwnd(), + win.borrow().get_hwnd(), win, ) } #[cfg(target_os = "macos")] -unsafe fn winit_to_surface>( +unsafe fn winit_to_surface>( instance: Arc, win: W, ) -> Result>, SurfaceCreationError> { - use winit::platform::macos::WindowExtMacOS; + use winit::os::macos::WindowExt; - let wnd: cocoa_id = mem::transmute(win.borrow().ns_window()); + let wnd: cocoa_id = mem::transmute(win.borrow().get_nswindow()); let layer = CoreAnimationLayer::new(); @@ -194,7 +193,7 @@ unsafe fn winit_to_surface>( view.setLayer(mem::transmute(layer.as_ref())); // Bombs here with out of memory view.setWantsLayer(YES); - Surface::from_macos_moltenvk(instance, win.borrow().ns_view() as *const (), win) + Surface::from_macos_moltenvk(instance, win.borrow().get_nsview() as *const (), win) } /// An alternative to `Borrow` with the requirement that all calls to diff --git a/vulkano/Cargo.toml b/vulkano/Cargo.toml index d61dacb7..84396713 100644 --- a/vulkano/Cargo.toml +++ b/vulkano/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "vulkano" -version = "0.14.0" +version = "0.16.0" authors = ["Pierre Krieger ", "The vulkano contributors"] repository = "https://github.com/vulkano-rs/vulkano" description = "Safe wrapper for the Vulkan graphics API" @@ -18,5 +18,5 @@ fnv = "1.0" shared_library = "0.1" smallvec = "0.6" lazy_static = "1.4" -vk-sys = { version = "0.4.0", path = "../vk-sys" } +vk-sys = { version = "0.5.0", path = "../vk-sys" } half = "1.4"