diff --git a/CHANGELOG_VULKANO.md b/CHANGELOG_VULKANO.md index cfbd9dc1..3182d211 100644 --- a/CHANGELOG_VULKANO.md +++ b/CHANGELOG_VULKANO.md @@ -11,6 +11,8 @@ - Update Winit to 0.20.0 - Update dependencies: lazy_static, half, syn, quote & proc-macro2 - 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. - Switch to Vulkan 1.1 and inherently SpirV 1.3 (shaderc default version for vulkan 1.1) diff --git a/vulkano/src/instance/instance.rs b/vulkano/src/instance/instance.rs index 5dc73f73..bd356354 100644 --- a/vulkano/src/instance/instance.rs +++ b/vulkano/src/instance/instance.rs @@ -95,7 +95,7 @@ pub struct Instance { //alloc: Option>, physical_devices: Vec, vk: vk::InstancePointers, - extensions: InstanceExtensions, + extensions: RawInstanceExtensions, layers: SmallVec<[CString; 16]>, function_pointers: OwnedOrRef>>, } @@ -283,12 +283,11 @@ impl Instance { devices }; - // TODO: should be Into - let extensions: InstanceExtensions = (&extensions).into(); + let vk_khr_get_physical_device_properties2 = CString::new(b"VK_KHR_get_physical_device_properties2".to_vec()).unwrap(); // Getting the properties of all physical devices. // 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) } else { 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. fn init_physical_devices2(vk: &vk::InstancePointers, physical_devices: Vec, - extensions: &InstanceExtensions) + extensions: &RawInstanceExtensions) -> Vec { let mut output = Vec::with_capacity(physical_devices.len()); @@ -450,10 +449,15 @@ impl Instance { /// /// let extensions = InstanceExtensions::supported_by_core().unwrap(); /// let instance = Instance::new(None, &extensions, None).unwrap(); - /// assert_eq!(instance.loaded_extensions(), &extensions); + /// assert_eq!(instance.loaded_extensions(), extensions); /// ``` #[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 }