From 116abf4d5821d1105467eafd38ed7001411e9ab5 Mon Sep 17 00:00:00 2001 From: prataprc Date: Mon, 10 May 2021 20:02:08 +0530 Subject: [PATCH] Collection of commits. (#1567) * Add core instance extensions. core extensions added as part of `vulkano::instance::InstanceExtensions` VK_KHR_device_group_creation VK_KHR_external_fence_capabilities VK_KHR_external_memory_capabilities VK_KHR_external_semaphore_capabilities VK_KHR_get_display_properties2 VK_EXT_acquire_xlib_display VK_EXT_debug_report VK_EXT_direct_mode_display VK_EXT_display_surface_counter * export FunctionPointers::entry_points method. Similar to PhysicalDevice.instance().pointers() export root-level entry_points() method. This will allow applications to call vk-functions like `vkEnumerateInstanceExtensionProperties` directly. * heap: Add MEMORY_HEAP_MULTI_INSTANCE_BIT for MemoryHeap. A new method is_multi_instance() method is added to `MemoryHeap` to know whether the heap is enabled for multi-instance. * CHANGE-LOG. --- CHANGELOG_VULKANO.md | 3 +++ vk-sys/src/lib.rs | 1 + vulkano/src/instance/extensions.rs | 9 +++++++++ vulkano/src/instance/instance.rs | 8 ++++++++ vulkano/src/instance/loader.rs | 2 +- 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/CHANGELOG_VULKANO.md b/CHANGELOG_VULKANO.md index 54fbbf189..c065ebb23 100644 --- a/CHANGELOG_VULKANO.md +++ b/CHANGELOG_VULKANO.md @@ -55,6 +55,9 @@ - Fixed a bug which caused a segfault when extending memory allocation info in DeviceMemoryBuilder - `BufferlessDefinition` and `BufferlessVertices` now derive `Copy` and `Clone`. This allows `GraphicsPipelineBuilder`s that have not yet defined a vertex buffer type to be cloned. - Various functions for converting to/from Vulkan flags have been consolidated into implementations of the standard `From` trait. +- Export root-level `entry_point` method on `loader::FunctionPointers` type. +- Add few more `InstanceExtensions` from KHR and EXT. +- Add `MEMORY_HEAP_MULTI_INSTANCE_BIT` for `MemoryHeap`. # Version 0.22.0 (2021-03-31) diff --git a/vk-sys/src/lib.rs b/vk-sys/src/lib.rs index 89210c41e..a39e414ac 100644 --- a/vk-sys/src/lib.rs +++ b/vk-sys/src/lib.rs @@ -1434,6 +1434,7 @@ pub type MemoryPropertyFlags = Flags; pub type MemoryHeapFlagBits = u32; pub const MEMORY_HEAP_DEVICE_LOCAL_BIT: u32 = 0x00000001; +pub const MEMORY_HEAP_MULTI_INSTANCE_BIT: u32 = 0x00000002; pub type MemoryHeapFlags = Flags; pub type DeviceCreateFlags = Flags; pub type DeviceQueueCreateFlags = Flags; diff --git a/vulkano/src/instance/extensions.rs b/vulkano/src/instance/extensions.rs index 9f048b8de..73d4a895b 100644 --- a/vulkano/src/instance/extensions.rs +++ b/vulkano/src/instance/extensions.rs @@ -160,6 +160,15 @@ instance_extensions! { ext_swapchain_colorspace => b"VK_EXT_swapchain_colorspace", khr_get_physical_device_properties2 => b"VK_KHR_get_physical_device_properties2", khr_get_surface_capabilities2 => b"VK_KHR_get_surface_capabilities2", + khr_device_group_creation => b"VK_KHR_device_group_creation", + khr_external_fence_capabilities => b"VK_KHR_external_fence_capabilities", + khr_external_memory_capabilities => b"VK_KHR_external_memory_capabilities", + khr_external_semaphore_capabilities => b"VK_KHR_external_semaphore_capabilities", + khr_get_display_properties2 => b"VK_KHR_get_display_properties2", + ext_acquire_xlib_display => b"VK_EXT_acquire_xlib_display", + ext_debug_report => b"VK_EXT_debug_report", + ext_direct_mode_display => b"VK_EXT_direct_mode_display", + ext_display_surface_counter => b"VK_EXT_display_surface_counter", } /// This helper type can only be instantiated inside this module. diff --git a/vulkano/src/instance/instance.rs b/vulkano/src/instance/instance.rs index 669dd378a..72603fb55 100644 --- a/vulkano/src/instance/instance.rs +++ b/vulkano/src/instance/instance.rs @@ -1379,6 +1379,14 @@ impl<'a> MemoryHeap<'a> { let flags = self.physical_device.infos().memory.memoryHeaps[self.id as usize].flags; (flags & vk::MEMORY_HEAP_DEVICE_LOCAL_BIT) != 0 } + + /// Returns true if the heap is multi-instance enabled, that is allocation from such + /// heap will replicate to each physical-device's instance of heap. + #[inline] + pub fn is_multi_instance(&self) -> bool { + let flags = self.physical_device.infos().memory.memoryHeaps[self.id as usize].flags; + (flags & vk::MEMORY_HEAP_MULTI_INSTANCE_BIT) != 0 + } } /// Iterator for all the memory heaps available on a physical device. diff --git a/vulkano/src/instance/loader.rs b/vulkano/src/instance/loader.rs index 2c68b49e0..9959076cd 100644 --- a/vulkano/src/instance/loader.rs +++ b/vulkano/src/instance/loader.rs @@ -133,7 +133,7 @@ impl FunctionPointers { /// Returns the collection of Vulkan entry points from the Vulkan loader. #[inline] - pub(crate) fn entry_points(&self) -> &vk::EntryPoints { + pub fn entry_points(&self) -> &vk::EntryPoints { &self.entry_points }