From d0a798f5691604337affa17949f7b4eab7a1b339 Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Wed, 23 Sep 2020 01:31:59 -0400 Subject: [PATCH] Add missing entry points for VK_KHR_get_physical_device_properties2 and VK_KHR_maintenance1 --- Cargo.lock | 22 +++++------ Cargo.toml | 1 + libportability-gfx/Cargo.toml | 1 + libportability-gfx/src/impls.rs | 65 +++++++++++++++++++++++++++++++-- libportability-icd/src/lib.rs | 6 +++ libportability/src/lib.rs | 62 +++++++++++++++++++++++++++++++ 6 files changed, 143 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7737d53..26c5a12 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -263,7 +263,7 @@ dependencies = [ [[package]] name = "gfx-auxil" version = "0.5.0" -source = "git+https://github.com/gfx-rs/gfx#db7a4aa3e7aa909764a2e8bc60e252972676ea2d" +source = "git+https://github.com/gfx-rs/gfx#89dc302254ab68adc99a3b661e23c52b4b0d073f" dependencies = [ "fxhash", "gfx-hal", @@ -273,7 +273,7 @@ dependencies = [ [[package]] name = "gfx-backend-dx11" version = "0.6.0" -source = "git+https://github.com/gfx-rs/gfx#db7a4aa3e7aa909764a2e8bc60e252972676ea2d" +source = "git+https://github.com/gfx-rs/gfx#89dc302254ab68adc99a3b661e23c52b4b0d073f" dependencies = [ "bitflags", "gfx-auxil", @@ -292,7 +292,7 @@ dependencies = [ [[package]] name = "gfx-backend-dx12" version = "0.6.2" -source = "git+https://github.com/gfx-rs/gfx#db7a4aa3e7aa909764a2e8bc60e252972676ea2d" +source = "git+https://github.com/gfx-rs/gfx#89dc302254ab68adc99a3b661e23c52b4b0d073f" dependencies = [ "bitflags", "d3d12", @@ -309,7 +309,7 @@ dependencies = [ [[package]] name = "gfx-backend-empty" version = "0.6.0" -source = "git+https://github.com/gfx-rs/gfx#db7a4aa3e7aa909764a2e8bc60e252972676ea2d" +source = "git+https://github.com/gfx-rs/gfx#89dc302254ab68adc99a3b661e23c52b4b0d073f" dependencies = [ "gfx-hal", "log", @@ -319,7 +319,7 @@ dependencies = [ [[package]] name = "gfx-backend-metal" version = "0.6.0" -source = "git+https://github.com/gfx-rs/gfx#db7a4aa3e7aa909764a2e8bc60e252972676ea2d" +source = "git+https://github.com/gfx-rs/gfx#89dc302254ab68adc99a3b661e23c52b4b0d073f" dependencies = [ "arrayvec", "bitflags", @@ -336,7 +336,6 @@ dependencies = [ "parking_lot", "range-alloc", "raw-window-handle", - "smallvec", "spirv_cross", "storage-map", ] @@ -344,7 +343,7 @@ dependencies = [ [[package]] name = "gfx-backend-vulkan" version = "0.6.1" -source = "git+https://github.com/gfx-rs/gfx#db7a4aa3e7aa909764a2e8bc60e252972676ea2d" +source = "git+https://github.com/gfx-rs/gfx#89dc302254ab68adc99a3b661e23c52b4b0d073f" dependencies = [ "arrayvec", "ash", @@ -365,7 +364,7 @@ dependencies = [ [[package]] name = "gfx-hal" version = "0.6.0" -source = "git+https://github.com/gfx-rs/gfx#db7a4aa3e7aa909764a2e8bc60e252972676ea2d" +source = "git+https://github.com/gfx-rs/gfx#89dc302254ab68adc99a3b661e23c52b4b0d073f" dependencies = [ "bitflags", "raw-window-handle", @@ -427,9 +426,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9" +checksum = "4c30f6d0bc6b00693347368a67d41b58f2fb851215ff1da49e90fe2c5c667151" dependencies = [ "libc", ] @@ -669,6 +668,7 @@ dependencies = [ "log", "parking_lot", "renderdoc", + "smallvec", "typed-arena", ] @@ -753,7 +753,7 @@ dependencies = [ [[package]] name = "range-alloc" version = "0.1.1" -source = "git+https://github.com/gfx-rs/gfx#db7a4aa3e7aa909764a2e8bc60e252972676ea2d" +source = "git+https://github.com/gfx-rs/gfx#89dc302254ab68adc99a3b661e23c52b4b0d073f" [[package]] name = "raw-window-handle" diff --git a/Cargo.toml b/Cargo.toml index 7328dc3..91e2a58 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,4 +6,5 @@ members = [ ] [profile.release] +debug = true panic = "abort" diff --git a/libportability-gfx/Cargo.toml b/libportability-gfx/Cargo.toml index 945786d..7a7e836 100644 --- a/libportability-gfx/Cargo.toml +++ b/libportability-gfx/Cargo.toml @@ -24,6 +24,7 @@ env_logger = { version = "0.7", optional = true } lazy_static = "1" log = { version = "0.4", features = ["release_max_level_error"] } parking_lot = "0.11" +smallvec = "1" renderdoc = { version = "0.3", optional = true } typed-arena = "2" diff --git a/libportability-gfx/src/impls.rs b/libportability-gfx/src/impls.rs index 28375e2..ebf9eb0 100644 --- a/libportability-gfx/src/impls.rs +++ b/libportability-gfx/src/impls.rs @@ -13,6 +13,7 @@ use hal::{ }; use parking_lot::Mutex; +use smallvec::SmallVec; use typed_arena::Arena; #[cfg(feature = "gfx-backend-metal")] @@ -229,6 +230,22 @@ pub unsafe extern "C" fn gfxGetPhysicalDeviceQueueFamilyProperties( } } } +#[inline] +pub unsafe extern "C" fn gfxGetPhysicalDeviceQueueFamilyProperties2KHR( + adapter: VkPhysicalDevice, + pQueueFamilyPropertyCount: *mut u32, + pQueueFamilyProperties: *mut VkQueueFamilyProperties2KHR, +) { + gfxGetPhysicalDeviceQueueFamilyProperties( + adapter, + pQueueFamilyPropertyCount, + if pQueueFamilyProperties.is_null() { + ptr::null_mut() + } else { + &mut (*pQueueFamilyProperties).queueFamilyProperties + }, + ); +} #[inline] pub unsafe extern "C" fn gfxGetPhysicalDeviceFeatures( @@ -298,6 +315,19 @@ pub unsafe extern "C" fn gfxGetPhysicalDeviceFormatProperties( *pFormatProperties = conv::format_properties_from_hal(properties); } +#[inline] +pub unsafe extern "C" fn gfxGetPhysicalDeviceFormatProperties2KHR( + adapter: VkPhysicalDevice, + format: VkFormat, + pFormatProperties: *mut VkFormatProperties2KHR, +) { + gfxGetPhysicalDeviceFormatProperties( + adapter, + format, + &mut (*pFormatProperties).formatProperties, + ) +} + fn get_physical_device_image_format_properties( adapter: VkPhysicalDevice, info: &VkPhysicalDeviceImageFormatInfo2KHR, @@ -477,6 +507,13 @@ pub unsafe extern "C" fn gfxGetPhysicalDeviceMemoryProperties( } } #[inline] +pub unsafe extern "C" fn gfxGetPhysicalDeviceMemoryProperties2KHR( + adapter: VkPhysicalDevice, + pMemoryProperties: *mut VkPhysicalDeviceMemoryProperties2KHR, +) { + gfxGetPhysicalDeviceMemoryProperties(adapter, &mut (*pMemoryProperties).memoryProperties); +} +#[inline] pub unsafe extern "C" fn gfxGetInstanceProcAddr( _instance: VkInstance, pName: *const ::std::os::raw::c_char, @@ -509,11 +546,15 @@ pub unsafe extern "C" fn gfxGetInstanceProcAddr( vkGetPhysicalDeviceProperties, PFN_vkGetPhysicalDeviceProperties => gfxGetPhysicalDeviceProperties, vkGetPhysicalDeviceProperties2KHR, PFN_vkGetPhysicalDeviceProperties2KHR => gfxGetPhysicalDeviceProperties2KHR, vkGetPhysicalDeviceFormatProperties, PFN_vkGetPhysicalDeviceFormatProperties => gfxGetPhysicalDeviceFormatProperties, + vkGetPhysicalDeviceFormatProperties2KHR, PFN_vkGetPhysicalDeviceFormatProperties2KHR => gfxGetPhysicalDeviceFormatProperties2KHR, vkGetPhysicalDeviceImageFormatProperties, PFN_vkGetPhysicalDeviceImageFormatProperties => gfxGetPhysicalDeviceImageFormatProperties, vkGetPhysicalDeviceImageFormatProperties2KHR, PFN_vkGetPhysicalDeviceImageFormatProperties2KHR => gfxGetPhysicalDeviceImageFormatProperties2KHR, vkGetPhysicalDeviceMemoryProperties, PFN_vkGetPhysicalDeviceMemoryProperties => gfxGetPhysicalDeviceMemoryProperties, + vkGetPhysicalDeviceMemoryProperties2KHR, PFN_vkGetPhysicalDeviceMemoryProperties2KHR => gfxGetPhysicalDeviceMemoryProperties2KHR, vkGetPhysicalDeviceQueueFamilyProperties, PFN_vkGetPhysicalDeviceQueueFamilyProperties => gfxGetPhysicalDeviceQueueFamilyProperties, + vkGetPhysicalDeviceQueueFamilyProperties2KHR, PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR => gfxGetPhysicalDeviceQueueFamilyProperties2KHR, vkGetPhysicalDeviceSparseImageFormatProperties, PFN_vkGetPhysicalDeviceSparseImageFormatProperties => gfxGetPhysicalDeviceSparseImageFormatProperties, + vkGetPhysicalDeviceSparseImageFormatProperties2KHR, PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR => gfxGetPhysicalDeviceSparseImageFormatProperties2KHR, vkGetPhysicalDeviceSurfaceSupportKHR, PFN_vkGetPhysicalDeviceSurfaceSupportKHR => gfxGetPhysicalDeviceSurfaceSupportKHR, vkGetPhysicalDeviceSurfaceCapabilitiesKHR, PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR => gfxGetPhysicalDeviceSurfaceCapabilitiesKHR, @@ -627,6 +668,7 @@ pub unsafe extern "C" fn gfxGetDeviceProcAddr( vkCreateCommandPool, PFN_vkCreateCommandPool => gfxCreateCommandPool, vkDestroyCommandPool, PFN_vkDestroyCommandPool => gfxDestroyCommandPool, vkResetCommandPool, PFN_vkResetCommandPool => gfxResetCommandPool, + vkTrimCommandPoolKHR, PFN_vkTrimCommandPoolKHR => gfxTrimCommandPoolKHR, vkAllocateCommandBuffers, PFN_vkAllocateCommandBuffers => gfxAllocateCommandBuffers, vkFreeCommandBuffers, PFN_vkFreeCommandBuffers => gfxFreeCommandBuffers, vkBeginCommandBuffer, PFN_vkBeginCommandBuffer => gfxBeginCommandBuffer, @@ -1365,8 +1407,8 @@ pub unsafe extern "C" fn gfxGetImageMemoryRequirements( memoryTypeBits: req.type_mask, }; } -/* -#[inline] + +/*#[inline] pub unsafe extern "C" fn gfxGetImageMemoryRequirements2KHR( gpu: VkDevice, image: VkImage, @@ -1416,6 +1458,15 @@ pub unsafe extern "C" fn gfxGetPhysicalDeviceSparseImageFormatProperties( *pPropertyCount = 0; } #[inline] +pub unsafe extern "C" fn gfxGetPhysicalDeviceSparseImageFormatProperties2KHR( + _physicalDevice: VkPhysicalDevice, + _pFormatInfo: *const VkPhysicalDeviceSparseImageFormatInfo2KHR, + pPropertyCount: *mut u32, + _pProperties: *mut VkSparseImageFormatProperties2KHR, +) { + *pPropertyCount = 0; +} +#[inline] pub unsafe extern "C" fn gfxQueueBindSparse( _queue: VkQueue, _bindInfoCount: u32, @@ -3251,6 +3302,14 @@ pub unsafe extern "C" fn gfxResetCommandPool( VkResult::VK_SUCCESS } +#[no_mangle] +pub unsafe extern "C" fn gfxTrimCommandPoolKHR( + _gpu: VkDevice, + _commandPool: VkCommandPool, + _flags: VkCommandPoolTrimFlagsKHR, +) { +} + #[inline] pub unsafe extern "C" fn gfxAllocateCommandBuffers( _gpu: VkDevice, @@ -4110,7 +4169,7 @@ pub unsafe extern "C" fn gfxCmdBeginRenderPass( None } }) - .collect::>(); + .collect::>(); let contents = conv::map_subpass_contents(contents); let framebuffer = info.framebuffer.resolve(info.renderPass); diff --git a/libportability-icd/src/lib.rs b/libportability-icd/src/lib.rs index 9dfb868..e675a1a 100644 --- a/libportability-icd/src/lib.rs +++ b/libportability-icd/src/lib.rs @@ -42,11 +42,17 @@ pub unsafe extern "C" fn vk_icdGetPhysicalDeviceProcAddr( vkGetPhysicalDeviceFeatures, PFN_vkGetPhysicalDeviceFeatures => gfxGetPhysicalDeviceFeatures, vkGetPhysicalDeviceFeatures2KHR, PFN_vkGetPhysicalDeviceFeatures2KHR => gfxGetPhysicalDeviceFeatures2KHR, vkGetPhysicalDeviceProperties, PFN_vkGetPhysicalDeviceProperties => gfxGetPhysicalDeviceProperties, + vkGetPhysicalDeviceProperties2KHR, PFN_vkGetPhysicalDeviceProperties2KHR => gfxGetPhysicalDeviceProperties2KHR, vkGetPhysicalDeviceFormatProperties, PFN_vkGetPhysicalDeviceFormatProperties => gfxGetPhysicalDeviceFormatProperties, + vkGetPhysicalDeviceFormatProperties2KHR, PFN_vkGetPhysicalDeviceFormatProperties2KHR => gfxGetPhysicalDeviceFormatProperties2KHR, vkGetPhysicalDeviceImageFormatProperties, PFN_vkGetPhysicalDeviceImageFormatProperties => gfxGetPhysicalDeviceImageFormatProperties, + vkGetPhysicalDeviceImageFormatProperties2KHR, PFN_vkGetPhysicalDeviceImageFormatProperties2KHR => gfxGetPhysicalDeviceImageFormatProperties2KHR, vkGetPhysicalDeviceMemoryProperties, PFN_vkGetPhysicalDeviceMemoryProperties => gfxGetPhysicalDeviceMemoryProperties, + vkGetPhysicalDeviceMemoryProperties2KHR, PFN_vkGetPhysicalDeviceMemoryProperties2KHR => gfxGetPhysicalDeviceMemoryProperties2KHR, vkGetPhysicalDeviceQueueFamilyProperties, PFN_vkGetPhysicalDeviceQueueFamilyProperties => gfxGetPhysicalDeviceQueueFamilyProperties, + vkGetPhysicalDeviceQueueFamilyProperties2KHR, PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR => gfxGetPhysicalDeviceQueueFamilyProperties2KHR, vkGetPhysicalDeviceSparseImageFormatProperties, PFN_vkGetPhysicalDeviceSparseImageFormatProperties => gfxGetPhysicalDeviceSparseImageFormatProperties, + vkGetPhysicalDeviceSparseImageFormatProperties2KHR, PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR => gfxGetPhysicalDeviceSparseImageFormatProperties2KHR, vkGetPhysicalDeviceSurfaceSupportKHR, PFN_vkGetPhysicalDeviceSurfaceSupportKHR => gfxGetPhysicalDeviceSurfaceSupportKHR, vkGetPhysicalDeviceSurfaceCapabilitiesKHR, PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR => gfxGetPhysicalDeviceSurfaceCapabilitiesKHR, diff --git a/libportability/src/lib.rs b/libportability/src/lib.rs index a28e08f..bf80c8f 100644 --- a/libportability/src/lib.rs +++ b/libportability/src/lib.rs @@ -45,6 +45,18 @@ pub unsafe extern "C" fn vkGetPhysicalDeviceQueueFamilyProperties( ) } #[no_mangle] +pub unsafe extern "C" fn vkGetPhysicalDeviceQueueFamilyProperties2KHR( + adapter: VkPhysicalDevice, + pQueueFamilyPropertyCount: *mut u32, + pQueueFamilyProperties: *mut VkQueueFamilyProperties2KHR, +) { + gfxGetPhysicalDeviceQueueFamilyProperties2KHR( + adapter, + pQueueFamilyPropertyCount, + pQueueFamilyProperties, + ) +} +#[no_mangle] pub unsafe extern "C" fn vkGetPhysicalDeviceMemoryProperties( physicalDevice: VkPhysicalDevice, pMemoryProperties: *mut VkPhysicalDeviceMemoryProperties, @@ -52,6 +64,13 @@ pub unsafe extern "C" fn vkGetPhysicalDeviceMemoryProperties( gfxGetPhysicalDeviceMemoryProperties(physicalDevice, pMemoryProperties) } #[no_mangle] +pub unsafe extern "C" fn vkGetPhysicalDeviceMemoryProperties2KHR( + physicalDevice: VkPhysicalDevice, + pMemoryProperties: *mut VkPhysicalDeviceMemoryProperties2KHR, +) { + gfxGetPhysicalDeviceMemoryProperties2KHR(physicalDevice, pMemoryProperties) +} +#[no_mangle] pub unsafe extern "C" fn vkCreateDevice( adapter: VkPhysicalDevice, pCreateInfo: *const VkDeviceCreateInfo, @@ -144,6 +163,14 @@ pub unsafe extern "C" fn vkGetPhysicalDeviceFormatProperties( ) { gfxGetPhysicalDeviceFormatProperties(adapter, format, pFormatProperties) } +#[no_mangle] +pub unsafe extern "C" fn vkGetPhysicalDeviceFormatProperties2KHR( + adapter: VkPhysicalDevice, + format: VkFormat, + pFormatProperties: *mut VkFormatProperties2KHR, +) { + gfxGetPhysicalDeviceFormatProperties2KHR(adapter, format, pFormatProperties) +} #[no_mangle] pub unsafe extern "C" fn vkCreateCommandPool( @@ -173,6 +200,15 @@ pub unsafe extern "C" fn vkResetCommandPool( gfxResetCommandPool(device, commandPool, flags) } +#[no_mangle] +pub unsafe extern "C" fn vkTrimCommandPoolKHR( + device: VkDevice, + commandPool: VkCommandPool, + flags: VkCommandPoolTrimFlagsKHR, +) { + gfxTrimCommandPoolKHR(device, commandPool, flags) +} + #[no_mangle] pub unsafe extern "C" fn vkAllocateCommandBuffers( device: VkDevice, @@ -417,6 +453,18 @@ pub unsafe extern "C" fn vkGetPhysicalDeviceImageFormatProperties( ) } #[no_mangle] +pub unsafe extern "C" fn vkGetPhysicalDeviceImageFormatProperties2KHR( + physicalDevice: VkPhysicalDevice, + pImageFormatInfo: *const VkPhysicalDeviceImageFormatInfo2KHR, + pImageFormatProperties: *mut VkImageFormatProperties2KHR, +) -> VkResult { + gfxGetPhysicalDeviceImageFormatProperties2KHR( + physicalDevice, + pImageFormatInfo, + pImageFormatProperties, + ) +} +#[no_mangle] pub unsafe extern "C" fn vkGetPhysicalDeviceProperties( physicalDevice: VkPhysicalDevice, pProperties: *mut VkPhysicalDeviceProperties, @@ -541,6 +589,20 @@ pub unsafe extern "C" fn vkGetPhysicalDeviceSparseImageFormatProperties( ) } #[no_mangle] +pub unsafe extern "C" fn vkGetPhysicalDeviceSparseImageFormatProperties2KHR( + physicalDevice: VkPhysicalDevice, + pFormatInfo: *const VkPhysicalDeviceSparseImageFormatInfo2KHR, + pPropertyCount: *mut u32, + pProperties: *mut VkSparseImageFormatProperties2KHR, +) { + gfxGetPhysicalDeviceSparseImageFormatProperties2KHR( + physicalDevice, + pFormatInfo, + pPropertyCount, + pProperties, + ) +} +#[no_mangle] pub unsafe extern "C" fn vkQueueBindSparse( queue: VkQueue, bindInfoCount: u32,