mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-26 00:34:19 +00:00
added raw_loaded_extensions() to Instance to allow querying of all extensions, not just known ones. (#1255)
This commit is contained in:
parent
e5d6c2cb1a
commit
08d635c977
@ -11,6 +11,8 @@
|
|||||||
- Update Winit to 0.20.0
|
- Update Winit to 0.20.0
|
||||||
- Update dependencies: lazy_static, half, syn, quote & proc-macro2
|
- Update dependencies: lazy_static, half, syn, quote & proc-macro2
|
||||||
- Swapchain can now be recreated with dimensions of corresponding surface using `recreate()`.
|
- Swapchain can now be recreated with dimensions of corresponding surface using `recreate()`.
|
||||||
|
- Added `raw_loaded_extensions()` to `Instance` to allow querying of all extensions, not just known ones.
|
||||||
|
- **Breaking Change** `loaded_extensions()` on `Instance` no longer returns a reference.
|
||||||
- Add support for GLSL macro defines to the `shader!` macro.
|
- Add support for GLSL macro defines to the `shader!` macro.
|
||||||
- Switch to Vulkan 1.1 and inherently SpirV 1.3 (shaderc default version for vulkan 1.1)
|
- Switch to Vulkan 1.1 and inherently SpirV 1.3 (shaderc default version for vulkan 1.1)
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ pub struct Instance {
|
|||||||
//alloc: Option<Box<Alloc + Send + Sync>>,
|
//alloc: Option<Box<Alloc + Send + Sync>>,
|
||||||
physical_devices: Vec<PhysicalDeviceInfos>,
|
physical_devices: Vec<PhysicalDeviceInfos>,
|
||||||
vk: vk::InstancePointers,
|
vk: vk::InstancePointers,
|
||||||
extensions: InstanceExtensions,
|
extensions: RawInstanceExtensions,
|
||||||
layers: SmallVec<[CString; 16]>,
|
layers: SmallVec<[CString; 16]>,
|
||||||
function_pointers: OwnedOrRef<FunctionPointers<Box<dyn Loader + Send + Sync>>>,
|
function_pointers: OwnedOrRef<FunctionPointers<Box<dyn Loader + Send + Sync>>>,
|
||||||
}
|
}
|
||||||
@ -283,12 +283,11 @@ impl Instance {
|
|||||||
devices
|
devices
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: should be Into
|
let vk_khr_get_physical_device_properties2 = CString::new(b"VK_KHR_get_physical_device_properties2".to_vec()).unwrap();
|
||||||
let extensions: InstanceExtensions = (&extensions).into();
|
|
||||||
|
|
||||||
// Getting the properties of all physical devices.
|
// Getting the properties of all physical devices.
|
||||||
// If possible, we use VK_KHR_get_physical_device_properties2.
|
// If possible, we use VK_KHR_get_physical_device_properties2.
|
||||||
let physical_devices = if extensions.khr_get_physical_device_properties2 {
|
let physical_devices = if extensions.iter().any(|v| *v == vk_khr_get_physical_device_properties2) {
|
||||||
Instance::init_physical_devices2(&vk, physical_devices, &extensions)
|
Instance::init_physical_devices2(&vk, physical_devices, &extensions)
|
||||||
} else {
|
} else {
|
||||||
Instance::init_physical_devices(&vk, physical_devices)
|
Instance::init_physical_devices(&vk, physical_devices)
|
||||||
@ -354,7 +353,7 @@ impl Instance {
|
|||||||
/// TODO: Query extension-specific physical device properties, once a new instance extension is supported.
|
/// TODO: Query extension-specific physical device properties, once a new instance extension is supported.
|
||||||
fn init_physical_devices2(vk: &vk::InstancePointers,
|
fn init_physical_devices2(vk: &vk::InstancePointers,
|
||||||
physical_devices: Vec<vk::PhysicalDevice>,
|
physical_devices: Vec<vk::PhysicalDevice>,
|
||||||
extensions: &InstanceExtensions)
|
extensions: &RawInstanceExtensions)
|
||||||
-> Vec<PhysicalDeviceInfos> {
|
-> Vec<PhysicalDeviceInfos> {
|
||||||
let mut output = Vec::with_capacity(physical_devices.len());
|
let mut output = Vec::with_capacity(physical_devices.len());
|
||||||
|
|
||||||
@ -450,10 +449,15 @@ impl Instance {
|
|||||||
///
|
///
|
||||||
/// let extensions = InstanceExtensions::supported_by_core().unwrap();
|
/// let extensions = InstanceExtensions::supported_by_core().unwrap();
|
||||||
/// let instance = Instance::new(None, &extensions, None).unwrap();
|
/// let instance = Instance::new(None, &extensions, None).unwrap();
|
||||||
/// assert_eq!(instance.loaded_extensions(), &extensions);
|
/// assert_eq!(instance.loaded_extensions(), extensions);
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn loaded_extensions(&self) -> &InstanceExtensions {
|
pub fn loaded_extensions(&self) -> InstanceExtensions {
|
||||||
|
InstanceExtensions::from(&self.extensions)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn raw_loaded_extensions(&self) -> &RawInstanceExtensions {
|
||||||
&self.extensions
|
&self.extensions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user