Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic less #135

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions blade-graphics/src/vulkan/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,14 @@ impl super::Context {
}
};

let vk_surface = surface_handles.map(|(wh, dh)| {
ash_window::create_surface(&entry, &core_instance, dh.as_raw(), wh.as_raw(), None)
.unwrap()
});
let vk_surface = if let Some((wh, dh)) = surface_handles {
Some(
ash_window::create_surface(&entry, &core_instance, dh.as_raw(), wh.as_raw(), None)
.map_err(|e| NotSupportedError::VulkanError(e))?,
)
} else {
None
};

let instance =
super::Instance {
Expand All @@ -381,7 +385,10 @@ impl super::Context {
core: core_instance,
};

let physical_devices = instance.core.enumerate_physical_devices().unwrap();
let physical_devices = instance
.core
.enumerate_physical_devices()
.map_err(|e| NotSupportedError::VulkanError(e))?;
let (physical_device, capabilities) = physical_devices
.into_iter()
.find_map(|phd| {
Expand Down
Loading