From 11ed7b2306b428f9be174939768c42dd56575339 Mon Sep 17 00:00:00 2001 From: Lucien Greathouse Date: Fri, 2 Mar 2018 23:58:45 -0800 Subject: [PATCH 1/3] examples: Clean up warnings and trim dead code --- examples/src/lib.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/examples/src/lib.rs b/examples/src/lib.rs index 8e48443..18f52f5 100644 --- a/examples/src/lib.rs +++ b/examples/src/lib.rs @@ -1,4 +1,3 @@ -#![allow(dead_code)] #[macro_use] extern crate ash; #[cfg(windows)] @@ -120,7 +119,7 @@ unsafe fn create_surface( ) -> Result { use winit::os::windows::WindowExt; let hwnd = window.get_hwnd() as *mut winapi::windef::HWND__; - let hinstance = unsafe { user32::GetWindow(hwnd, 0) as *const vk::c_void }; + let hinstance = user32::GetWindow(hwnd, 0) as *const vk::c_void; let win32_create_info = vk::Win32SurfaceCreateInfoKHR { s_type: vk::StructureType::Win32SurfaceCreateInfoKhr, p_next: ptr::null(), @@ -203,10 +202,6 @@ pub fn find_memorytype_index_f, pub instance: Instance, @@ -270,7 +265,6 @@ impl ExampleBase { let window = winit::WindowBuilder::new() .with_title("Ash - Example") .with_dimensions(window_width, window_height) - //.with_window_resize_callback(resize_callback) .build(&events_loop) .unwrap(); let entry = Entry::new().unwrap(); From 8e3e3b9e721abe03c59b45e1af9bfd633a07cdc7 Mon Sep 17 00:00:00 2001 From: Lucien Greathouse Date: Fri, 2 Mar 2018 23:59:28 -0800 Subject: [PATCH 2/3] examples: Minor whitespace cleanup --- examples/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/src/lib.rs b/examples/src/lib.rs index 18f52f5..218caa3 100644 --- a/examples/src/lib.rs +++ b/examples/src/lib.rs @@ -164,7 +164,6 @@ unsafe extern "system" fn vulkan_debug_callback( 1 } - pub fn find_memorytype_index( memory_req: &vk::MemoryRequirements, memory_prop: &vk::PhysicalDeviceMemoryProperties, @@ -259,6 +258,7 @@ impl ExampleBase { } }); } + pub fn new(window_width: u32, window_height: u32) -> Self { unsafe { let events_loop = winit::EventsLoop::new(); From 91da74fca4c06491f3947019bae262d6eed3ef58 Mon Sep 17 00:00:00 2001 From: Lucien Greathouse Date: Sat, 3 Mar 2018 00:02:43 -0800 Subject: [PATCH 3/3] examples: Update to winapi 0.3 and winit 0.11 --- examples/Cargo.toml | 5 ++--- examples/src/lib.rs | 9 +++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/Cargo.toml b/examples/Cargo.toml index fd51f40..3ad5c47 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -4,10 +4,9 @@ version = "0.1.0" authors = ["maik klein "] [dependencies] -winit = "0.9.0" +winit = "0.11.1" image = "0.10.4" ash = { path = "../ash" } [target.'cfg(windows)'.dependencies] -user32-sys = "0.2.0" -winapi = "0.2.8" +winapi = { version = "0.3.4", features = ["windef", "winuser"] } diff --git a/examples/src/lib.rs b/examples/src/lib.rs index 218caa3..55c4862 100644 --- a/examples/src/lib.rs +++ b/examples/src/lib.rs @@ -1,8 +1,6 @@ #[macro_use] extern crate ash; #[cfg(windows)] -extern crate user32; -#[cfg(windows)] extern crate winapi; extern crate winit; @@ -117,9 +115,12 @@ unsafe fn create_surface( instance: &I, window: &winit::Window, ) -> Result { + use winapi::shared::windef::HWND; + use winapi::um::winuser::GetWindow; use winit::os::windows::WindowExt; - let hwnd = window.get_hwnd() as *mut winapi::windef::HWND__; - let hinstance = user32::GetWindow(hwnd, 0) as *const vk::c_void; + + let hwnd = window.get_hwnd() as HWND; + let hinstance = GetWindow(hwnd, 0) as *const vk::c_void; let win32_create_info = vk::Win32SurfaceCreateInfoKHR { s_type: vk::StructureType::Win32SurfaceCreateInfoKhr, p_next: ptr::null(),