Add log + Cleanup
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 0s
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 0s
This commit is contained in:
parent
21195b57e6
commit
bc94b68c0c
8 changed files with 46 additions and 131 deletions
|
@ -1,14 +1,8 @@
|
|||
use crate::vulkan::utils::formatter::format_instance_layer;
|
||||
use crate::vulkan::utils::layers::{use_layers, LayersSelector};
|
||||
use crate::vulkan::vk_surface::VkSurface;
|
||||
use crate::vulkan::{VkPhysicalDevice, LOG_TARGET};
|
||||
use ash::khr::surface;
|
||||
use ash::prelude::VkResult;
|
||||
use ash::vk::QueueFlags;
|
||||
use ash::{vk, Entry, Instance};
|
||||
use std::ffi::{c_char, CStr, CString};
|
||||
use std::fmt::{Display, Formatter};
|
||||
use winit::raw_window_handle::{HasDisplayHandle, HasWindowHandle};
|
||||
|
||||
pub struct VkInstance {
|
||||
pub(super) entry: Entry,
|
||||
|
@ -24,6 +18,17 @@ impl VkInstance {
|
|||
|
||||
log::debug!(target: LOG_TARGET, "Initializing Vulkan instance");
|
||||
|
||||
if log::log_enabled!(target: LOG_TARGET, log::Level::Debug) {
|
||||
let layer_properties = unsafe { entry.enumerate_instance_layer_properties() }
|
||||
.unwrap_or_default();
|
||||
|
||||
for layer_property in layer_properties {
|
||||
let layer_extensions = unsafe { entry.enumerate_instance_extension_properties(layer_property.layer_name_as_c_str().ok()) }
|
||||
.unwrap_or_default();
|
||||
log::debug!(target: LOG_TARGET, "{layer_property:#?} {layer_extensions:#?}");
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
let required_extensions = required_extensions
|
||||
.iter()
|
||||
|
@ -106,25 +111,3 @@ impl Drop for VkInstance {
|
|||
log::debug!(target: LOG_TARGET, "Vulkan instance destroyed ({:?})", self.handle.handle());
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for VkInstance {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
writeln!(f, "")?;
|
||||
|
||||
let instance_layers = unsafe { self.entry.enumerate_instance_layer_properties().unwrap_or_default() };
|
||||
writeln!(f, "Instance layers ({}) :", instance_layers.len())?;
|
||||
for instance_layer in &instance_layers {
|
||||
writeln!(f, "{}", format_instance_layer(instance_layer))?;
|
||||
}
|
||||
writeln!(f, "")?;
|
||||
|
||||
let physical_devices = self.get_physical_devices();
|
||||
writeln!(f, "Physical Devices ({}) :", physical_devices.len())?;
|
||||
for physical_device in physical_devices {
|
||||
writeln!(f, "{physical_device}")?;
|
||||
}
|
||||
writeln!(f, "")?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue