From a6caf232d9e3089e14d4f0e70d8f087b3f02d255 Mon Sep 17 00:00:00 2001 From: buckn Date: Fri, 15 Dec 2023 23:33:32 -0500 Subject: [PATCH] upgraded Ash and Vulkan versions --- Cargo.toml | 2 +- src/main.rs | 11 +++++------ src/utility/constants.rs | 8 ++++---- src/utility/debug.rs | 2 +- src/utility/platforms.rs | 21 ++++++++++----------- src/utility/share.rs | 7 ++----- 6 files changed, 23 insertions(+), 28 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e46f08a..fd21c49 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" [dependencies] winit = "0.20.0" -ash = "0.29.0" +ash = "0.37.3" num = "0.2" cgmath = "0.17.0" image = "0.22" diff --git a/src/main.rs b/src/main.rs index 8334dde..8cd5811 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,9 +7,8 @@ use crate::{ utility::structures::*, }; -use ash::version::DeviceV1_0; -use ash::version::InstanceV1_0; -use ash::vk; +use ash::{vk, Entry}; +use vk::*; use memoffset::offset_of; use winit::event::{Event, VirtualKeyCode, ElementState, KeyboardInput, WindowEvent}; use winit::event_loop::{EventLoop, ControlFlow}; @@ -118,7 +117,7 @@ impl VulkanApp { let window = utility::window::init_window(event_loop, WINDOW_TITLE, WINDOW_WIDTH, WINDOW_HEIGHT); // init vulkan stuff - let entry = ash::Entry::new().unwrap(); + let entry = unsafe { Entry::load().unwrap() }; let instance = share::create_instance( &entry, WINDOW_TITLE, @@ -544,7 +543,7 @@ impl VulkanApp { let color_blend_attachment_states = [vk::PipelineColorBlendAttachmentState { blend_enable: vk::FALSE, - color_write_mask: vk::ColorComponentFlags::all(), + color_write_mask: vk::ColorComponentFlags::RGBA, src_color_blend_factor: vk::BlendFactor::ONE, dst_color_blend_factor: vk::BlendFactor::ZERO, color_blend_op: vk::BlendOp::ADD, @@ -860,7 +859,7 @@ impl VulkanApp { self.draw_frame(); tick_counter.tick_frame(); - if IS_PAINT_FPS_COUNTER { + if true { print!("FPS: {}\r", tick_counter.fps()); } }, diff --git a/src/utility/constants.rs b/src/utility/constants.rs index 3871f91..99f2f7e 100644 --- a/src/utility/constants.rs +++ b/src/utility/constants.rs @@ -1,12 +1,12 @@ use crate::utility::debug::ValidationInfo; use crate::utility::structures::DeviceExtension; -use ash::vk_make_version; +use ash::vk::make_api_version; use std::os::raw::c_char; -pub const APPLICATION_VERSION: u32 = vk_make_version!(1, 0, 0); -pub const ENGINE_VERSION: u32 = vk_make_version!(1, 0, 0); -pub const API_VERSION: u32 = vk_make_version!(1, 0, 92); +pub const APPLICATION_VERSION: u32 = make_api_version(1, 0, 0, 0); +pub const ENGINE_VERSION: u32 = make_api_version(1, 0, 0, 0); +pub const API_VERSION: u32 = make_api_version(1, 3, 251, 0); pub const WINDOW_WIDTH: u32 = 800; pub const WINDOW_HEIGHT: u32 = 600; diff --git a/src/utility/debug.rs b/src/utility/debug.rs index 9c41e40..b271a7e 100644 --- a/src/utility/debug.rs +++ b/src/utility/debug.rs @@ -1,5 +1,5 @@ -use ash::version::EntryV1_0; use ash::vk; +use vk::*; use std::ffi::CStr; use std::os::raw::c_void; diff --git a/src/utility/platforms.rs b/src/utility/platforms.rs index 82ab0bd..fdcab4f 100644 --- a/src/utility/platforms.rs +++ b/src/utility/platforms.rs @@ -1,5 +1,4 @@ -use ash::version::{EntryV1_0, InstanceV1_0}; -use ash::vk; +use ash::{vk, Entry, Instance}; #[cfg(target_os = "windows")] use ash::extensions::khr::Win32Surface; @@ -51,9 +50,9 @@ pub fn required_extension_names() -> Vec<*const i8> { // create surface --------------------------------------------------------- #[cfg(all(unix, not(target_os = "android"), not(target_os = "macos")))] -pub unsafe fn create_surface( - entry: &E, - instance: &I, +pub unsafe fn create_surface( + entry: &Entry, + instance: &Instance, window: &winit::window::Window, ) -> Result { use std::ptr; @@ -73,9 +72,9 @@ pub unsafe fn create_surface( } #[cfg(target_os = "macos")] -pub unsafe fn create_surface( - entry: &E, - instance: &I, +pub unsafe fn create_surface( + entry: &Entry, + instance: &Instance, window: &winit::window::Window, ) -> Result { use std::mem; @@ -109,9 +108,9 @@ pub unsafe fn create_surface( } #[cfg(target_os = "windows")] -pub unsafe fn create_surface( - entry: &E, - instance: &I, +pub unsafe fn create_surface( + entry: &Entry, + instance: &Instance, window: &winit::window::Window, ) -> Result { use std::os::raw::c_void; diff --git a/src/utility/share.rs b/src/utility/share.rs index f10a52d..abb01e2 100644 --- a/src/utility/share.rs +++ b/src/utility/share.rs @@ -206,7 +206,7 @@ pub mod v1 { let color_blend_attachment_states = [vk::PipelineColorBlendAttachmentState { blend_enable: vk::FALSE, - color_write_mask: vk::ColorComponentFlags::all(), + color_write_mask: vk::ColorComponentFlags::empty(), src_color_blend_factor: vk::BlendFactor::ONE, dst_color_blend_factor: vk::BlendFactor::ZERO, color_blend_op: vk::BlendOp::ADD, @@ -1371,9 +1371,6 @@ pub mod v2 { } } -use ash::version::DeviceV1_0; -use ash::version::EntryV1_0; -use ash::version::InstanceV1_0; use ash::vk; use std::ffi::CString; @@ -1641,7 +1638,7 @@ pub fn find_queue_family( physical_device, index as u32, surface_stuff.surface, - ) + ).unwrap() }; if queue_family.queue_count > 0 && is_present_support { queue_family_indices.present_family = Some(index);