Merge pull request #118 from GabrielMajeri/fix-windows-example

Fix Windows surface creation in the example
This commit is contained in:
Maik Klein 2018-08-30 11:28:37 +02:00 committed by GitHub
commit f13e01d026
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -9,4 +9,4 @@ image = "0.10.4"
ash = { path = "../ash" } ash = { path = "../ash" }
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
winapi = { version = "0.3.4", features = ["windef", "winuser"] } winapi = { version = "0.3.4", features = ["windef", "libloaderapi"] }

View file

@ -118,11 +118,11 @@ unsafe fn create_surface<E: EntryV1_0, I: InstanceV1_0>(
window: &winit::Window, window: &winit::Window,
) -> Result<vk::SurfaceKHR, vk::Result> { ) -> Result<vk::SurfaceKHR, vk::Result> {
use winapi::shared::windef::HWND; use winapi::shared::windef::HWND;
use winapi::um::winuser::GetWindow; use winapi::um::libloaderapi::GetModuleHandleW;
use winit::os::windows::WindowExt; use winit::os::windows::WindowExt;
let hwnd = window.get_hwnd() as HWND; let hwnd = window.get_hwnd() as HWND;
let hinstance = GetWindow(hwnd, 0) as *const c_void; let hinstance = GetModuleHandleW(ptr::null()) as *const c_void;
let win32_create_info = vk::Win32SurfaceCreateInfoKHR { let win32_create_info = vk::Win32SurfaceCreateInfoKHR {
s_type: vk::StructureType::WIN32_SURFACE_CREATE_INFO_KHR, s_type: vk::StructureType::WIN32_SURFACE_CREATE_INFO_KHR,
p_next: ptr::null(), p_next: ptr::null(),