Add log::info!/log::error! for Vulkan issues
This commit is contained in:
parent
a990c89758
commit
45e01aa6e6
2 changed files with 16 additions and 5 deletions
|
|
@ -283,6 +283,14 @@ fn start(conn: Connection) -> mpsc::Receiver<Event> {
|
|||
// spawn an executor using one additional thread.
|
||||
let thread_pool = ThreadPool::builder().pool_size(1).create().unwrap();
|
||||
|
||||
let vulkan = vulkan::Vulkan::new();
|
||||
if let Err(err) = &vulkan {
|
||||
log::info!(
|
||||
"Unable to initialize Vulkan: {}. Assuming now GPU workarounds needed.",
|
||||
err
|
||||
);
|
||||
}
|
||||
|
||||
let registry_state = RegistryState::new(&globals);
|
||||
let mut app_data = AppData {
|
||||
qh: qh.clone(),
|
||||
|
|
@ -300,7 +308,7 @@ fn start(conn: Connection) -> mpsc::Receiver<Event> {
|
|||
dmabuf_feedback: None,
|
||||
gbm_devices: GbmDevices::default(),
|
||||
thread_pool,
|
||||
vulkan: vulkan::Vulkan::new(),
|
||||
vulkan: vulkan.ok(),
|
||||
};
|
||||
|
||||
let (cmd_sender, cmd_channel) = calloop::channel::channel();
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ pub struct Vulkan {
|
|||
}
|
||||
|
||||
impl Vulkan {
|
||||
pub fn new() -> Option<Self> {
|
||||
let entry = unsafe { ash::Entry::load().ok()? };
|
||||
pub fn new() -> anyhow::Result<Self> {
|
||||
let entry = unsafe { ash::Entry::load()? };
|
||||
let app_info = vk::ApplicationInfo {
|
||||
api_version: vk::make_api_version(0, 1, 1, 0),
|
||||
..Default::default()
|
||||
|
|
@ -19,8 +19,8 @@ impl Vulkan {
|
|||
p_application_info: &app_info,
|
||||
..Default::default()
|
||||
};
|
||||
let instance = unsafe { entry.create_instance(&create_info, None).ok()? };
|
||||
Some(Self {
|
||||
let instance = unsafe { entry.create_instance(&create_info, None)? };
|
||||
Ok(Self {
|
||||
_entry: entry,
|
||||
instance,
|
||||
device_name_cache: HashMap::new(),
|
||||
|
|
@ -30,6 +30,9 @@ impl Vulkan {
|
|||
pub fn device_name(&mut self, dev: u64) -> VkResult<Option<&str>> {
|
||||
if !self.device_name_cache.contains_key(&dev) {
|
||||
let value = self.device_name_uncached(dev);
|
||||
if let Err(err) = &value {
|
||||
log::error!("Failed to query Vulkan device properties: {}", err);
|
||||
}
|
||||
self.device_name_cache.insert(dev, value);
|
||||
}
|
||||
self.device_name_cache
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue