From 435530049a25fd4772f22856b86a300b26957ddc Mon Sep 17 00:00:00 2001 From: Alexander Medvedev <71594357+Snowiiii@users.noreply.github.com> Date: Sun, 23 Jun 2024 16:02:28 +0100 Subject: [PATCH] [vent-window] Fix compile on Windows --- crates/vent-rendering/src/surface.rs | 6 +++++- crates/vent-window/src/platform/windows/mod.rs | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/crates/vent-rendering/src/surface.rs b/crates/vent-rendering/src/surface.rs index 96a6a93..6534f3c 100644 --- a/crates/vent-rendering/src/surface.rs +++ b/crates/vent-rendering/src/surface.rs @@ -3,7 +3,7 @@ use std::os::raw::c_char; use ash::{ - khr::{surface}, + khr::surface, prelude::*, vk, Entry, Instance, }; @@ -19,6 +19,8 @@ pub unsafe fn create_surface( match (display_handle.as_raw(), window_handle.as_raw()) { #[cfg(target_os = "windows")] (RawDisplayHandle::Windows(_), RawWindowHandle::Win32(window)) => { + use ash::khr::win32_surface; + let surface_desc = vk::Win32SurfaceCreateInfoKHR::default() .hwnd(window.hwnd.get()) .hinstance( @@ -118,6 +120,8 @@ pub fn enumerate_required_extensions( let extensions = match display_handle { #[cfg(target_os = "windows")] RawDisplayHandle::Windows(_) => { + use ash::khr::win32_surface; + const WINDOWS_EXTS: [*const c_char; 2] = [surface::NAME.as_ptr(), win32_surface::NAME.as_ptr()]; &WINDOWS_EXTS diff --git a/crates/vent-window/src/platform/windows/mod.rs b/crates/vent-window/src/platform/windows/mod.rs index e798ed3..50944fa 100644 --- a/crates/vent-window/src/platform/windows/mod.rs +++ b/crates/vent-window/src/platform/windows/mod.rs @@ -21,7 +21,7 @@ pub struct PlatformWindow { } impl PlatformWindow { - pub fn create_window(attribs: &crate::WindowAttribs) -> Self { + pub fn create_window(attribs: crate::WindowAttribs) -> Self { let app_name = windows_sys::core::w!("WinAPIApp"); let h_instance = unsafe { GetModuleHandleW(null_mut()) }; @@ -66,8 +66,8 @@ impl PlatformWindow { Self { hwnd, - width: attribs.width, - height: attribs.height, + width: attribs.width.into(), + height: attribs.height.into(), } }