backend/wayland/vulkan: Fix use of Vulkan (correctly this time)
It seems https://github.com/pop-os/cosmic-workspaces-epoch/pull/280 was just wrong. I didn't test it correctly, and it actually prevented crashes simply because the Vulkan instance failed to create. This failed because it's a device extension, not an instance extension (and we already check for the device extension). The *real* issue seems to be simply the fact this was using the `Instance` after dropping the `Entry`. Which is easy enough to address.
This commit is contained in:
parent
9bab56ddfc
commit
a990c89758
1 changed files with 3 additions and 3 deletions
|
|
@ -3,6 +3,7 @@ use std::{collections::HashMap, ffi::CStr};
|
||||||
|
|
||||||
pub struct Vulkan {
|
pub struct Vulkan {
|
||||||
instance: ash::Instance,
|
instance: ash::Instance,
|
||||||
|
_entry: ash::Entry,
|
||||||
// TODO purge cache at some point
|
// TODO purge cache at some point
|
||||||
device_name_cache: HashMap<u64, VkResult<Option<String>>>,
|
device_name_cache: HashMap<u64, VkResult<Option<String>>>,
|
||||||
}
|
}
|
||||||
|
|
@ -14,14 +15,13 @@ impl Vulkan {
|
||||||
api_version: vk::make_api_version(0, 1, 1, 0),
|
api_version: vk::make_api_version(0, 1, 1, 0),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
let extensions = &[c"VK_EXT_physical_device_drm".as_ptr()];
|
|
||||||
let create_info = vk::InstanceCreateInfo {
|
let create_info = vk::InstanceCreateInfo {
|
||||||
p_application_info: &app_info,
|
p_application_info: &app_info,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
};
|
||||||
.enabled_extension_names(extensions);
|
|
||||||
let instance = unsafe { entry.create_instance(&create_info, None).ok()? };
|
let instance = unsafe { entry.create_instance(&create_info, None).ok()? };
|
||||||
Some(Self {
|
Some(Self {
|
||||||
|
_entry: entry,
|
||||||
instance,
|
instance,
|
||||||
device_name_cache: HashMap::new(),
|
device_name_cache: HashMap::new(),
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue