Skip to content

Commit

Permalink
bump dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien-ben committed Apr 2, 2024
1 parent 7062c89 commit ca594eb
Show file tree
Hide file tree
Showing 8 changed files with 185 additions and 240 deletions.
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ rust-version = "1.77"
[dependencies]
log = "0.4"
env_logger = "0.11"
ash = { version = "0.37", default-features = false, features = ["debug", "loaded"] }
ash-window = "0.12"
raw-window-handle = "0.5"
ash = "0.38"
ash-window = "0.13"
raw-window-handle = "0.6"
cgmath = "0.18"
image = "0.25"
tobj = "4.0"
ahash = "0.8"
winit = { version = "0.29", default-features = false, features = ["rwh_05", "x11", "wayland", "wayland-dlopen", "wayland-csd-adwaita"]}
winit = "0.29"
13 changes: 7 additions & 6 deletions src/context.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
use ash::{
extensions::{ext::DebugUtils, khr::Surface},
ext::debug_utils,
khr::surface,
vk::{self, DebugUtilsMessengerEXT},
Device, Entry, Instance,
};

pub struct VkContext {
_entry: Entry,
instance: Instance,
debugging_info: Option<(DebugUtils, vk::DebugUtilsMessengerEXT)>,
surface: Surface,
debugging_info: Option<(debug_utils::Instance, vk::DebugUtilsMessengerEXT)>,
surface: surface::Instance,
surface_khr: vk::SurfaceKHR,
physical_device: vk::PhysicalDevice,
device: Device,
Expand All @@ -19,7 +20,7 @@ impl VkContext {
&self.instance
}

pub fn surface(&self) -> &Surface {
pub fn surface(&self) -> &surface::Instance {
&self.surface
}

Expand Down Expand Up @@ -94,8 +95,8 @@ impl VkContext {
pub fn new(
entry: Entry,
instance: Instance,
debugging_info: Option<(DebugUtils, DebugUtilsMessengerEXT)>,
surface: Surface,
debugging_info: Option<(debug_utils::Instance, DebugUtilsMessengerEXT)>,
surface: surface::Instance,
surface_khr: vk::SurfaceKHR,
physical_device: vk::PhysicalDevice,
device: Device,
Expand Down
24 changes: 10 additions & 14 deletions src/debug.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use ash::extensions::ext::DebugUtils;
use ash::{vk, Entry, Instance};
use ash::{ext::debug_utils, vk, Entry, Instance};
use std::{
borrow::Cow,
ffi::{CStr, CString},
Expand Down Expand Up @@ -62,16 +61,13 @@ pub fn get_layer_names_and_pointers() -> (Vec<CString>, Vec<*const c_char>) {
///
/// Panic if at least one on the layer is not supported.
pub fn check_validation_layer_support(entry: &Entry) {
let supported_layers = unsafe { entry.enumerate_instance_layer_properties().unwrap() };
for required in REQUIRED_LAYERS.iter() {
let found = entry
.enumerate_instance_layer_properties()
.unwrap()
.iter()
.any(|layer| {
let name = unsafe { CStr::from_ptr(layer.layer_name.as_ptr()) };
let name = name.to_str().expect("Failed to get layer name pointer");
required == &name
});
let found = supported_layers.iter().any(|layer| {
let name = unsafe { CStr::from_ptr(layer.layer_name.as_ptr()) };
let name = name.to_str().expect("Failed to get layer name pointer");
required == &name
});

if !found {
panic!("Validation layer not supported: {}", required);
Expand All @@ -83,12 +79,12 @@ pub fn check_validation_layer_support(entry: &Entry) {
pub fn setup_debug_messenger(
entry: &Entry,
instance: &Instance,
) -> Option<(DebugUtils, vk::DebugUtilsMessengerEXT)> {
) -> Option<(debug_utils::Instance, vk::DebugUtilsMessengerEXT)> {
if !ENABLE_VALIDATION_LAYERS {
return None;
}

let debug_info = vk::DebugUtilsMessengerCreateInfoEXT::builder()
let debug_info = vk::DebugUtilsMessengerCreateInfoEXT::default()
.message_severity(
vk::DebugUtilsMessageSeverityFlagsEXT::ERROR
| vk::DebugUtilsMessageSeverityFlagsEXT::WARNING
Expand All @@ -101,7 +97,7 @@ pub fn setup_debug_messenger(
)
.pfn_user_callback(Some(vulkan_debug_callback));

let debug_utils_loader = DebugUtils::new(&entry, &instance);
let debug_utils_loader = debug_utils::Instance::new(entry, instance);
let debug_report_callback = unsafe {
debug_utils_loader
.create_debug_utils_messenger(&debug_info, None)
Expand Down
4 changes: 2 additions & 2 deletions src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ pub fn load<P: AsRef<Path>>(path: P) -> Cursor<Vec<u8>> {
use std::io::Read;

let mut buf = Vec::new();
let fullpath = &Path::new("assets").join(&path);
let mut file = File::open(&fullpath).unwrap();
let fullpath = Path::new("assets").join(path);
let mut file = File::open(fullpath).unwrap();
file.read_to_end(&mut buf).unwrap();
Cursor::new(buf)
}
Loading

0 comments on commit ca594eb

Please sign in to comment.