From 48d4ef205c9cf653653974ead139375037799a9e Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Wed, 26 Sep 2018 00:02:24 -0700 Subject: [PATCH] implementing get_proc_address --- vulkan-driver/build.rs | 48 ++++- vulkan-driver/src/api.rs | 9 + vulkan-driver/src/api_impl.rs | 377 ++++++++++++++++++++++++++++++++++ vulkan-driver/src/handle.rs | 220 ++++++++++++++++++++ vulkan-driver/src/lib.rs | 4 +- 5 files changed, 654 insertions(+), 4 deletions(-) create mode 100644 vulkan-driver/src/api_impl.rs create mode 100644 vulkan-driver/src/handle.rs diff --git a/vulkan-driver/build.rs b/vulkan-driver/build.rs index 4aa46c5..00e3f95 100644 --- a/vulkan-driver/build.rs +++ b/vulkan-driver/build.rs @@ -43,7 +43,7 @@ fn main() -> io::Result<()> { println!("cargo:rerun-if-changed=../external/Vulkan-Headers/include"); let vulkan_calling_convention = detect_vulkan_calling_convention()?; let match_calling_convention_regex = regex::Regex::new(r#"extern "([^"]+)""#).unwrap(); - let builder = bindgen::builder() + let mut builder = bindgen::builder() .header("vulkan-wrapper.h") .clang_arg("-target") .clang_arg(env::var("TARGET").unwrap()) @@ -51,8 +51,50 @@ fn main() -> io::Result<()> { .prepend_enum_name(false) .layout_tests(false) .whitelist_var("VK_.*") - .whitelist_var("ICD_LOADER_MAGIC") - .whitelist_type("Vk.*") + .whitelist_var("ICD_LOADER_MAGIC"); + for &t in &[ + "VkInstance", + "VkPhysicalDevice", + "VkDevice", + "VkQueue", + "VkCommandBuffer", + ] { + builder = builder.blacklist_type(t).blacklist_type(format!("{}_T", t)); + } + for &t in &[ + "VkSemaphore", + "VkFence", + "VkDeviceMemory", + "VkBuffer", + "VkImage", + "VkEvent", + "VkQueryPool", + "VkBufferView", + "VkImageView", + "VkShaderModule", + "VkPipelineCache", + "VkPipelineLayout", + "VkRenderPass", + "VkPipeline", + "VkDescriptorSetLayout", + "VkSampler", + "VkDescriptorPool", + "VkDescriptorSet", + "VkFramebuffer", + "VkCommandPool", + "VkSamplerYcbcrConversion", + "VkDescriptorUpdateTemplate", + "VkSurfaceKHR", + "VkSwapchainKHR", + "VkDisplayKHR", + "VkDisplayModeKHR", + "VkDebugReportCallbackEXT", + "VkDebugUtilsMessengerEXT", + "VkValidationCacheEXT", + ] { + builder = builder.blacklist_type(t).blacklist_type(format!("{}_T", t)); + } + builder = builder .whitelist_type("PFN_.*") .blacklist_type("^xcb_.*") .derive_debug(false) diff --git a/vulkan-driver/src/api.rs b/vulkan-driver/src/api.rs index ac2fce9..f80e2d8 100644 --- a/vulkan-driver/src/api.rs +++ b/vulkan-driver/src/api.rs @@ -2,6 +2,15 @@ #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(non_upper_case_globals)] +pub use handle::{ + VkBuffer, VkBufferView, VkCommandBuffer, VkCommandPool, VkDebugReportCallbackEXT, + VkDebugUtilsMessengerEXT, VkDescriptorPool, VkDescriptorSet, VkDescriptorSetLayout, + VkDescriptorUpdateTemplate, VkDevice, VkDeviceMemory, VkDisplayKHR, VkDisplayModeKHR, VkEvent, + VkFence, VkFramebuffer, VkImage, VkImageView, VkInstance, VkPhysicalDevice, VkPipeline, + VkPipelineCache, VkPipelineLayout, VkQueryPool, VkQueue, VkRenderPass, VkSampler, + VkSamplerYcbcrConversion, VkSemaphore, VkShaderModule, VkSurfaceKHR, VkSwapchainKHR, + VkValidationCacheEXT, +}; #[cfg(unix)] use xcb::ffi::{xcb_connection_t, xcb_visualid_t, xcb_window_t}; include!(concat!(env!("OUT_DIR"), "/vulkan-types.rs")); diff --git a/vulkan-driver/src/api_impl.rs b/vulkan-driver/src/api_impl.rs new file mode 100644 index 0000000..400c05c --- /dev/null +++ b/vulkan-driver/src/api_impl.rs @@ -0,0 +1,377 @@ +use api; +use handle::Handle; +use std::ffi::CStr; +use std::os::raw::c_char; + +#[derive(Copy, Clone)] +enum ProcAddressScope { + Device, + Instance, + Global, +} + +impl ProcAddressScope { + fn global(self) -> bool { + match self { + ProcAddressScope::Device | ProcAddressScope::Instance | ProcAddressScope::Global => { + true + } + } + } + fn instance(self) -> bool { + match self { + ProcAddressScope::Device | ProcAddressScope::Instance => true, + _ => false, + } + } + fn device(self) -> bool { + match self { + ProcAddressScope::Device => true, + _ => false, + } + } +} + +struct Extensions {} + +impl Default for Extensions { + fn default() -> Self { + Self {} + } +} + +fn get_proc_address( + name: *const c_char, + scope: ProcAddressScope, + extensions: &Extensions, +) -> api::PFN_vkVoidFunction { + let name = unsafe { CStr::from_ptr(name) }.to_str().ok()?; + use api::*; + use std::mem::transmute; + macro_rules! proc_address { + ($name:ident, $pfn_name:ident, $required_scope:ident, $required_extension:expr) => { + if scope.$required_scope() && $required_extension && stringify!($name) == name { + let f: $pfn_name = Some($name); + return unsafe { transmute(f) }; + } + }; + } + #[cfg_attr(rustfmt, rustfmt_skip)] + { + proc_address!(vkAcquireNextImage2KHR, PFN_vkAcquireNextImage2KHR, unknown, unknown); + proc_address!(vkAcquireNextImageKHR, PFN_vkAcquireNextImageKHR, unknown, unknown); + proc_address!(vkAllocateCommandBuffers, PFN_vkAllocateCommandBuffers, unknown, unknown); + proc_address!(vkAllocateDescriptorSets, PFN_vkAllocateDescriptorSets, unknown, unknown); + proc_address!(vkAllocateMemory, PFN_vkAllocateMemory, unknown, unknown); + proc_address!(vkBeginCommandBuffer, PFN_vkBeginCommandBuffer, unknown, unknown); + proc_address!(vkBindBufferMemory, PFN_vkBindBufferMemory, unknown, unknown); + proc_address!(vkBindBufferMemory2, PFN_vkBindBufferMemory2, unknown, unknown); + proc_address!(vkBindBufferMemory2KHR, PFN_vkBindBufferMemory2KHR, unknown, unknown); + proc_address!(vkBindImageMemory, PFN_vkBindImageMemory, unknown, unknown); + proc_address!(vkBindImageMemory2, PFN_vkBindImageMemory2, unknown, unknown); + proc_address!(vkBindImageMemory2KHR, PFN_vkBindImageMemory2KHR, unknown, unknown); + proc_address!(vkCmdBeginConditionalRenderingEXT, PFN_vkCmdBeginConditionalRenderingEXT, unknown, unknown); + proc_address!(vkCmdBeginDebugUtilsLabelEXT, PFN_vkCmdBeginDebugUtilsLabelEXT, unknown, unknown); + proc_address!(vkCmdBeginQuery, PFN_vkCmdBeginQuery, unknown, unknown); + proc_address!(vkCmdBeginRenderPass, PFN_vkCmdBeginRenderPass, unknown, unknown); + proc_address!(vkCmdBeginRenderPass2KHR, PFN_vkCmdBeginRenderPass2KHR, unknown, unknown); + proc_address!(vkCmdBindDescriptorSets, PFN_vkCmdBindDescriptorSets, unknown, unknown); + proc_address!(vkCmdBindIndexBuffer, PFN_vkCmdBindIndexBuffer, unknown, unknown); + proc_address!(vkCmdBindPipeline, PFN_vkCmdBindPipeline, unknown, unknown); + proc_address!(vkCmdBindShadingRateImageNV, PFN_vkCmdBindShadingRateImageNV, unknown, unknown); + proc_address!(vkCmdBindVertexBuffers, PFN_vkCmdBindVertexBuffers, unknown, unknown); + proc_address!(vkCmdBlitImage, PFN_vkCmdBlitImage, unknown, unknown); + proc_address!(vkCmdClearAttachments, PFN_vkCmdClearAttachments, unknown, unknown); + proc_address!(vkCmdClearColorImage, PFN_vkCmdClearColorImage, unknown, unknown); + proc_address!(vkCmdClearDepthStencilImage, PFN_vkCmdClearDepthStencilImage, unknown, unknown); + proc_address!(vkCmdCopyBuffer, PFN_vkCmdCopyBuffer, unknown, unknown); + proc_address!(vkCmdCopyBufferToImage, PFN_vkCmdCopyBufferToImage, unknown, unknown); + proc_address!(vkCmdCopyImage, PFN_vkCmdCopyImage, unknown, unknown); + proc_address!(vkCmdCopyImageToBuffer, PFN_vkCmdCopyImageToBuffer, unknown, unknown); + proc_address!(vkCmdCopyQueryPoolResults, PFN_vkCmdCopyQueryPoolResults, unknown, unknown); + proc_address!(vkCmdDebugMarkerBeginEXT, PFN_vkCmdDebugMarkerBeginEXT, unknown, unknown); + proc_address!(vkCmdDebugMarkerEndEXT, PFN_vkCmdDebugMarkerEndEXT, unknown, unknown); + proc_address!(vkCmdDebugMarkerInsertEXT, PFN_vkCmdDebugMarkerInsertEXT, unknown, unknown); + proc_address!(vkCmdDispatch, PFN_vkCmdDispatch, unknown, unknown); + proc_address!(vkCmdDispatchBase, PFN_vkCmdDispatchBase, unknown, unknown); + proc_address!(vkCmdDispatchBaseKHR, PFN_vkCmdDispatchBaseKHR, unknown, unknown); + proc_address!(vkCmdDispatchIndirect, PFN_vkCmdDispatchIndirect, unknown, unknown); + proc_address!(vkCmdDraw, PFN_vkCmdDraw, unknown, unknown); + proc_address!(vkCmdDrawIndexed, PFN_vkCmdDrawIndexed, unknown, unknown); + proc_address!(vkCmdDrawIndexedIndirect, PFN_vkCmdDrawIndexedIndirect, unknown, unknown); + proc_address!(vkCmdDrawIndexedIndirectCountAMD, PFN_vkCmdDrawIndexedIndirectCountAMD, unknown, unknown); + proc_address!(vkCmdDrawIndexedIndirectCountKHR, PFN_vkCmdDrawIndexedIndirectCountKHR, unknown, unknown); + proc_address!(vkCmdDrawIndirect, PFN_vkCmdDrawIndirect, unknown, unknown); + proc_address!(vkCmdDrawIndirectCountAMD, PFN_vkCmdDrawIndirectCountAMD, unknown, unknown); + proc_address!(vkCmdDrawIndirectCountKHR, PFN_vkCmdDrawIndirectCountKHR, unknown, unknown); + proc_address!(vkCmdDrawMeshTasksIndirectCountNV, PFN_vkCmdDrawMeshTasksIndirectCountNV, unknown, unknown); + proc_address!(vkCmdDrawMeshTasksIndirectNV, PFN_vkCmdDrawMeshTasksIndirectNV, unknown, unknown); + proc_address!(vkCmdDrawMeshTasksNV, PFN_vkCmdDrawMeshTasksNV, unknown, unknown); + proc_address!(vkCmdEndConditionalRenderingEXT, PFN_vkCmdEndConditionalRenderingEXT, unknown, unknown); + proc_address!(vkCmdEndDebugUtilsLabelEXT, PFN_vkCmdEndDebugUtilsLabelEXT, unknown, unknown); + proc_address!(vkCmdEndQuery, PFN_vkCmdEndQuery, unknown, unknown); + proc_address!(vkCmdEndRenderPass, PFN_vkCmdEndRenderPass, unknown, unknown); + proc_address!(vkCmdEndRenderPass2KHR, PFN_vkCmdEndRenderPass2KHR, unknown, unknown); + proc_address!(vkCmdExecuteCommands, PFN_vkCmdExecuteCommands, unknown, unknown); + proc_address!(vkCmdFillBuffer, PFN_vkCmdFillBuffer, unknown, unknown); + proc_address!(vkCmdInsertDebugUtilsLabelEXT, PFN_vkCmdInsertDebugUtilsLabelEXT, unknown, unknown); + proc_address!(vkCmdNextSubpass, PFN_vkCmdNextSubpass, unknown, unknown); + proc_address!(vkCmdNextSubpass2KHR, PFN_vkCmdNextSubpass2KHR, unknown, unknown); + proc_address!(vkCmdPipelineBarrier, PFN_vkCmdPipelineBarrier, unknown, unknown); + proc_address!(vkCmdPushConstants, PFN_vkCmdPushConstants, unknown, unknown); + proc_address!(vkCmdPushDescriptorSetKHR, PFN_vkCmdPushDescriptorSetKHR, unknown, unknown); + proc_address!(vkCmdPushDescriptorSetWithTemplateKHR, PFN_vkCmdPushDescriptorSetWithTemplateKHR, unknown, unknown); + proc_address!(vkCmdResetEvent, PFN_vkCmdResetEvent, unknown, unknown); + proc_address!(vkCmdResetQueryPool, PFN_vkCmdResetQueryPool, unknown, unknown); + proc_address!(vkCmdResolveImage, PFN_vkCmdResolveImage, unknown, unknown); + proc_address!(vkCmdSetBlendConstants, PFN_vkCmdSetBlendConstants, unknown, unknown); + proc_address!(vkCmdSetCheckpointNV, PFN_vkCmdSetCheckpointNV, unknown, unknown); + proc_address!(vkCmdSetCoarseSampleOrderNV, PFN_vkCmdSetCoarseSampleOrderNV, unknown, unknown); + proc_address!(vkCmdSetDepthBias, PFN_vkCmdSetDepthBias, unknown, unknown); + proc_address!(vkCmdSetDepthBounds, PFN_vkCmdSetDepthBounds, unknown, unknown); + proc_address!(vkCmdSetDeviceMask, PFN_vkCmdSetDeviceMask, unknown, unknown); + proc_address!(vkCmdSetDeviceMaskKHR, PFN_vkCmdSetDeviceMaskKHR, unknown, unknown); + proc_address!(vkCmdSetDiscardRectangleEXT, PFN_vkCmdSetDiscardRectangleEXT, unknown, unknown); + proc_address!(vkCmdSetEvent, PFN_vkCmdSetEvent, unknown, unknown); + proc_address!(vkCmdSetExclusiveScissorNV, PFN_vkCmdSetExclusiveScissorNV, unknown, unknown); + proc_address!(vkCmdSetLineWidth, PFN_vkCmdSetLineWidth, unknown, unknown); + proc_address!(vkCmdSetSampleLocationsEXT, PFN_vkCmdSetSampleLocationsEXT, unknown, unknown); + proc_address!(vkCmdSetScissor, PFN_vkCmdSetScissor, unknown, unknown); + proc_address!(vkCmdSetStencilCompareMask, PFN_vkCmdSetStencilCompareMask, unknown, unknown); + proc_address!(vkCmdSetStencilReference, PFN_vkCmdSetStencilReference, unknown, unknown); + proc_address!(vkCmdSetStencilWriteMask, PFN_vkCmdSetStencilWriteMask, unknown, unknown); + proc_address!(vkCmdSetViewport, PFN_vkCmdSetViewport, unknown, unknown); + proc_address!(vkCmdSetViewportShadingRatePaletteNV, PFN_vkCmdSetViewportShadingRatePaletteNV, unknown, unknown); + proc_address!(vkCmdSetViewportWScalingNV, PFN_vkCmdSetViewportWScalingNV, unknown, unknown); + proc_address!(vkCmdUpdateBuffer, PFN_vkCmdUpdateBuffer, unknown, unknown); + proc_address!(vkCmdWaitEvents, PFN_vkCmdWaitEvents, unknown, unknown); + proc_address!(vkCmdWriteBufferMarkerAMD, PFN_vkCmdWriteBufferMarkerAMD, unknown, unknown); + proc_address!(vkCmdWriteTimestamp, PFN_vkCmdWriteTimestamp, unknown, unknown); + proc_address!(vkCreateBuffer, PFN_vkCreateBuffer, unknown, unknown); + proc_address!(vkCreateBufferView, PFN_vkCreateBufferView, unknown, unknown); + proc_address!(vkCreateCommandPool, PFN_vkCreateCommandPool, unknown, unknown); + proc_address!(vkCreateComputePipelines, PFN_vkCreateComputePipelines, unknown, unknown); + proc_address!(vkCreateDebugReportCallbackEXT, PFN_vkCreateDebugReportCallbackEXT, unknown, unknown); + proc_address!(vkCreateDebugUtilsMessengerEXT, PFN_vkCreateDebugUtilsMessengerEXT, unknown, unknown); + proc_address!(vkCreateDescriptorPool, PFN_vkCreateDescriptorPool, unknown, unknown); + proc_address!(vkCreateDescriptorSetLayout, PFN_vkCreateDescriptorSetLayout, unknown, unknown); + proc_address!(vkCreateDescriptorUpdateTemplate, PFN_vkCreateDescriptorUpdateTemplate, unknown, unknown); + proc_address!(vkCreateDescriptorUpdateTemplateKHR, PFN_vkCreateDescriptorUpdateTemplateKHR, unknown, unknown); + proc_address!(vkCreateDevice, PFN_vkCreateDevice, unknown, unknown); + proc_address!(vkCreateDisplayModeKHR, PFN_vkCreateDisplayModeKHR, unknown, unknown); + proc_address!(vkCreateDisplayPlaneSurfaceKHR, PFN_vkCreateDisplayPlaneSurfaceKHR, unknown, unknown); + proc_address!(vkCreateEvent, PFN_vkCreateEvent, unknown, unknown); + proc_address!(vkCreateFence, PFN_vkCreateFence, unknown, unknown); + proc_address!(vkCreateFramebuffer, PFN_vkCreateFramebuffer, unknown, unknown); + proc_address!(vkCreateGraphicsPipelines, PFN_vkCreateGraphicsPipelines, unknown, unknown); + proc_address!(vkCreateImage, PFN_vkCreateImage, unknown, unknown); + proc_address!(vkCreateImageView, PFN_vkCreateImageView, unknown, unknown); + proc_address!(vkCreateInstance, PFN_vkCreateInstance, unknown, unknown); + proc_address!(vkCreatePipelineCache, PFN_vkCreatePipelineCache, unknown, unknown); + proc_address!(vkCreatePipelineLayout, PFN_vkCreatePipelineLayout, unknown, unknown); + proc_address!(vkCreateQueryPool, PFN_vkCreateQueryPool, unknown, unknown); + proc_address!(vkCreateRenderPass, PFN_vkCreateRenderPass, unknown, unknown); + proc_address!(vkCreateRenderPass2KHR, PFN_vkCreateRenderPass2KHR, unknown, unknown); + proc_address!(vkCreateSampler, PFN_vkCreateSampler, unknown, unknown); + proc_address!(vkCreateSamplerYcbcrConversion, PFN_vkCreateSamplerYcbcrConversion, unknown, unknown); + proc_address!(vkCreateSamplerYcbcrConversionKHR, PFN_vkCreateSamplerYcbcrConversionKHR, unknown, unknown); + proc_address!(vkCreateSemaphore, PFN_vkCreateSemaphore, unknown, unknown); + proc_address!(vkCreateShaderModule, PFN_vkCreateShaderModule, unknown, unknown); + proc_address!(vkCreateSharedSwapchainsKHR, PFN_vkCreateSharedSwapchainsKHR, unknown, unknown); + proc_address!(vkCreateSwapchainKHR, PFN_vkCreateSwapchainKHR, unknown, unknown); + proc_address!(vkCreateValidationCacheEXT, PFN_vkCreateValidationCacheEXT, unknown, unknown); + proc_address!(vkCreateXcbSurfaceKHR, PFN_vkCreateXcbSurfaceKHR, unknown, unknown); + proc_address!(vkDebugMarkerSetObjectNameEXT, PFN_vkDebugMarkerSetObjectNameEXT, unknown, unknown); + proc_address!(vkDebugMarkerSetObjectTagEXT, PFN_vkDebugMarkerSetObjectTagEXT, unknown, unknown); + proc_address!(vkDebugReportCallbackEXT, PFN_vkDebugReportCallbackEXT, unknown, unknown); + proc_address!(vkDebugReportMessageEXT, PFN_vkDebugReportMessageEXT, unknown, unknown); + proc_address!(vkDebugUtilsMessengerCallbackEXT, PFN_vkDebugUtilsMessengerCallbackEXT, unknown, unknown); + proc_address!(vkDestroyBuffer, PFN_vkDestroyBuffer, unknown, unknown); + proc_address!(vkDestroyBufferView, PFN_vkDestroyBufferView, unknown, unknown); + proc_address!(vkDestroyCommandPool, PFN_vkDestroyCommandPool, unknown, unknown); + proc_address!(vkDestroyDebugReportCallbackEXT, PFN_vkDestroyDebugReportCallbackEXT, unknown, unknown); + proc_address!(vkDestroyDebugUtilsMessengerEXT, PFN_vkDestroyDebugUtilsMessengerEXT, unknown, unknown); + proc_address!(vkDestroyDescriptorPool, PFN_vkDestroyDescriptorPool, unknown, unknown); + proc_address!(vkDestroyDescriptorSetLayout, PFN_vkDestroyDescriptorSetLayout, unknown, unknown); + proc_address!(vkDestroyDescriptorUpdateTemplate, PFN_vkDestroyDescriptorUpdateTemplate, unknown, unknown); + proc_address!(vkDestroyDescriptorUpdateTemplateKHR, PFN_vkDestroyDescriptorUpdateTemplateKHR, unknown, unknown); + proc_address!(vkDestroyDevice, PFN_vkDestroyDevice, unknown, unknown); + proc_address!(vkDestroyEvent, PFN_vkDestroyEvent, unknown, unknown); + proc_address!(vkDestroyFence, PFN_vkDestroyFence, unknown, unknown); + proc_address!(vkDestroyFramebuffer, PFN_vkDestroyFramebuffer, unknown, unknown); + proc_address!(vkDestroyImage, PFN_vkDestroyImage, unknown, unknown); + proc_address!(vkDestroyImageView, PFN_vkDestroyImageView, unknown, unknown); + proc_address!(vkDestroyInstance, PFN_vkDestroyInstance, unknown, unknown); + proc_address!(vkDestroyPipeline, PFN_vkDestroyPipeline, unknown, unknown); + proc_address!(vkDestroyPipelineCache, PFN_vkDestroyPipelineCache, unknown, unknown); + proc_address!(vkDestroyPipelineLayout, PFN_vkDestroyPipelineLayout, unknown, unknown); + proc_address!(vkDestroyQueryPool, PFN_vkDestroyQueryPool, unknown, unknown); + proc_address!(vkDestroyRenderPass, PFN_vkDestroyRenderPass, unknown, unknown); + proc_address!(vkDestroySampler, PFN_vkDestroySampler, unknown, unknown); + proc_address!(vkDestroySamplerYcbcrConversion, PFN_vkDestroySamplerYcbcrConversion, unknown, unknown); + proc_address!(vkDestroySamplerYcbcrConversionKHR, PFN_vkDestroySamplerYcbcrConversionKHR, unknown, unknown); + proc_address!(vkDestroySemaphore, PFN_vkDestroySemaphore, unknown, unknown); + proc_address!(vkDestroyShaderModule, PFN_vkDestroyShaderModule, unknown, unknown); + proc_address!(vkDestroySurfaceKHR, PFN_vkDestroySurfaceKHR, unknown, unknown); + proc_address!(vkDestroySwapchainKHR, PFN_vkDestroySwapchainKHR, unknown, unknown); + proc_address!(vkDestroyValidationCacheEXT, PFN_vkDestroyValidationCacheEXT, unknown, unknown); + proc_address!(vkDeviceWaitIdle, PFN_vkDeviceWaitIdle, unknown, unknown); + proc_address!(vkDisplayPowerControlEXT, PFN_vkDisplayPowerControlEXT, unknown, unknown); + proc_address!(vkEndCommandBuffer, PFN_vkEndCommandBuffer, unknown, unknown); + proc_address!(vkEnumerateDeviceExtensionProperties, PFN_vkEnumerateDeviceExtensionProperties, unknown, unknown); + proc_address!(vkEnumerateDeviceLayerProperties, PFN_vkEnumerateDeviceLayerProperties, unknown, unknown); + proc_address!(vkEnumerateInstanceExtensionProperties, PFN_vkEnumerateInstanceExtensionProperties, unknown, unknown); + proc_address!(vkEnumerateInstanceLayerProperties, PFN_vkEnumerateInstanceLayerProperties, unknown, unknown); + proc_address!(vkEnumerateInstanceVersion, PFN_vkEnumerateInstanceVersion, unknown, unknown); + proc_address!(vkEnumeratePhysicalDeviceGroups, PFN_vkEnumeratePhysicalDeviceGroups, unknown, unknown); + proc_address!(vkEnumeratePhysicalDeviceGroupsKHR, PFN_vkEnumeratePhysicalDeviceGroupsKHR, unknown, unknown); + proc_address!(vkEnumeratePhysicalDevices, PFN_vkEnumeratePhysicalDevices, unknown, unknown); + proc_address!(vkFlushMappedMemoryRanges, PFN_vkFlushMappedMemoryRanges, unknown, unknown); + proc_address!(vkFreeCommandBuffers, PFN_vkFreeCommandBuffers, unknown, unknown); + proc_address!(vkFreeDescriptorSets, PFN_vkFreeDescriptorSets, unknown, unknown); + proc_address!(vkFreeFunction, PFN_vkFreeFunction, unknown, unknown); + proc_address!(vkFreeMemory, PFN_vkFreeMemory, unknown, unknown); + proc_address!(vkGetBufferMemoryRequirements, PFN_vkGetBufferMemoryRequirements, unknown, unknown); + proc_address!(vkGetBufferMemoryRequirements2, PFN_vkGetBufferMemoryRequirements2, unknown, unknown); + proc_address!(vkGetBufferMemoryRequirements2KHR, PFN_vkGetBufferMemoryRequirements2KHR, unknown, unknown); + proc_address!(vkGetDescriptorSetLayoutSupport, PFN_vkGetDescriptorSetLayoutSupport, unknown, unknown); + proc_address!(vkGetDescriptorSetLayoutSupportKHR, PFN_vkGetDescriptorSetLayoutSupportKHR, unknown, unknown); + proc_address!(vkGetDeviceGroupPeerMemoryFeatures, PFN_vkGetDeviceGroupPeerMemoryFeatures, unknown, unknown); + proc_address!(vkGetDeviceGroupPeerMemoryFeaturesKHR, PFN_vkGetDeviceGroupPeerMemoryFeaturesKHR, unknown, unknown); + proc_address!(vkGetDeviceGroupPresentCapabilitiesKHR, PFN_vkGetDeviceGroupPresentCapabilitiesKHR, unknown, unknown); + proc_address!(vkGetDeviceGroupSurfacePresentModesKHR, PFN_vkGetDeviceGroupSurfacePresentModesKHR, unknown, unknown); + proc_address!(vkGetDeviceMemoryCommitment, PFN_vkGetDeviceMemoryCommitment, unknown, unknown); + proc_address!(vkGetDeviceProcAddr, PFN_vkGetDeviceProcAddr, unknown, unknown); + proc_address!(vkGetDeviceQueue, PFN_vkGetDeviceQueue, unknown, unknown); + proc_address!(vkGetDeviceQueue2, PFN_vkGetDeviceQueue2, unknown, unknown); + proc_address!(vkGetDisplayModeProperties2KHR, PFN_vkGetDisplayModeProperties2KHR, unknown, unknown); + proc_address!(vkGetDisplayModePropertiesKHR, PFN_vkGetDisplayModePropertiesKHR, unknown, unknown); + proc_address!(vkGetDisplayPlaneCapabilities2KHR, PFN_vkGetDisplayPlaneCapabilities2KHR, unknown, unknown); + proc_address!(vkGetDisplayPlaneCapabilitiesKHR, PFN_vkGetDisplayPlaneCapabilitiesKHR, unknown, unknown); + proc_address!(vkGetDisplayPlaneSupportedDisplaysKHR, PFN_vkGetDisplayPlaneSupportedDisplaysKHR, unknown, unknown); + proc_address!(vkGetEventStatus, PFN_vkGetEventStatus, unknown, unknown); + proc_address!(vkGetFenceFdKHR, PFN_vkGetFenceFdKHR, unknown, unknown); + proc_address!(vkGetFenceStatus, PFN_vkGetFenceStatus, unknown, unknown); + proc_address!(vkGetImageMemoryRequirements, PFN_vkGetImageMemoryRequirements, unknown, unknown); + proc_address!(vkGetImageMemoryRequirements2, PFN_vkGetImageMemoryRequirements2, unknown, unknown); + proc_address!(vkGetImageMemoryRequirements2KHR, PFN_vkGetImageMemoryRequirements2KHR, unknown, unknown); + proc_address!(vkGetImageSparseMemoryRequirements, PFN_vkGetImageSparseMemoryRequirements, unknown, unknown); + proc_address!(vkGetImageSparseMemoryRequirements2, PFN_vkGetImageSparseMemoryRequirements2, unknown, unknown); + proc_address!(vkGetImageSparseMemoryRequirements2KHR, PFN_vkGetImageSparseMemoryRequirements2KHR, unknown, unknown); + proc_address!(vkGetImageSubresourceLayout, PFN_vkGetImageSubresourceLayout, unknown, unknown); + proc_address!(vkGetInstanceProcAddr, PFN_vkGetInstanceProcAddr, unknown, unknown); + proc_address!(vkGetMemoryFdKHR, PFN_vkGetMemoryFdKHR, unknown, unknown); + proc_address!(vkGetMemoryFdPropertiesKHR, PFN_vkGetMemoryFdPropertiesKHR, unknown, unknown); + proc_address!(vkGetMemoryHostPointerPropertiesEXT, PFN_vkGetMemoryHostPointerPropertiesEXT, unknown, unknown); + proc_address!(vkGetPastPresentationTimingGOOGLE, PFN_vkGetPastPresentationTimingGOOGLE, unknown, unknown); + proc_address!(vkGetPhysicalDeviceDisplayPlaneProperties2KHR, PFN_vkGetPhysicalDeviceDisplayPlaneProperties2KHR, unknown, unknown); + proc_address!(vkGetPhysicalDeviceDisplayPlanePropertiesKHR, PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR, unknown, unknown); + proc_address!(vkGetPhysicalDeviceDisplayProperties2KHR, PFN_vkGetPhysicalDeviceDisplayProperties2KHR, unknown, unknown); + proc_address!(vkGetPhysicalDeviceDisplayPropertiesKHR, PFN_vkGetPhysicalDeviceDisplayPropertiesKHR, unknown, unknown); + proc_address!(vkGetPhysicalDeviceExternalBufferProperties, PFN_vkGetPhysicalDeviceExternalBufferProperties, unknown, unknown); + proc_address!(vkGetPhysicalDeviceExternalBufferPropertiesKHR, PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHR, unknown, unknown); + proc_address!(vkGetPhysicalDeviceExternalFenceProperties, PFN_vkGetPhysicalDeviceExternalFenceProperties, unknown, unknown); + proc_address!(vkGetPhysicalDeviceExternalFencePropertiesKHR, PFN_vkGetPhysicalDeviceExternalFencePropertiesKHR, unknown, unknown); + proc_address!(vkGetPhysicalDeviceExternalImageFormatPropertiesNV, PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV, unknown, unknown); + proc_address!(vkGetPhysicalDeviceExternalSemaphoreProperties, PFN_vkGetPhysicalDeviceExternalSemaphoreProperties, unknown, unknown); + proc_address!(vkGetPhysicalDeviceExternalSemaphorePropertiesKHR, PFN_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR, unknown, unknown); + proc_address!(vkGetPhysicalDeviceFeatures, PFN_vkGetPhysicalDeviceFeatures, unknown, unknown); + proc_address!(vkGetPhysicalDeviceFeatures2, PFN_vkGetPhysicalDeviceFeatures2, unknown, unknown); + proc_address!(vkGetPhysicalDeviceFeatures2KHR, PFN_vkGetPhysicalDeviceFeatures2KHR, unknown, unknown); + proc_address!(vkGetPhysicalDeviceFormatProperties, PFN_vkGetPhysicalDeviceFormatProperties, unknown, unknown); + proc_address!(vkGetPhysicalDeviceFormatProperties2, PFN_vkGetPhysicalDeviceFormatProperties2, unknown, unknown); + proc_address!(vkGetPhysicalDeviceFormatProperties2KHR, PFN_vkGetPhysicalDeviceFormatProperties2KHR, unknown, unknown); + proc_address!(vkGetPhysicalDeviceImageFormatProperties, PFN_vkGetPhysicalDeviceImageFormatProperties, unknown, unknown); + proc_address!(vkGetPhysicalDeviceImageFormatProperties2, PFN_vkGetPhysicalDeviceImageFormatProperties2, unknown, unknown); + proc_address!(vkGetPhysicalDeviceImageFormatProperties2KHR, PFN_vkGetPhysicalDeviceImageFormatProperties2KHR, unknown, unknown); + proc_address!(vkGetPhysicalDeviceMemoryProperties, PFN_vkGetPhysicalDeviceMemoryProperties, unknown, unknown); + proc_address!(vkGetPhysicalDeviceMemoryProperties2, PFN_vkGetPhysicalDeviceMemoryProperties2, unknown, unknown); + proc_address!(vkGetPhysicalDeviceMemoryProperties2KHR, PFN_vkGetPhysicalDeviceMemoryProperties2KHR, unknown, unknown); + proc_address!(vkGetPhysicalDeviceMultisamplePropertiesEXT, PFN_vkGetPhysicalDeviceMultisamplePropertiesEXT, unknown, unknown); + proc_address!(vkGetPhysicalDevicePresentRectanglesKHR, PFN_vkGetPhysicalDevicePresentRectanglesKHR, unknown, unknown); + proc_address!(vkGetPhysicalDeviceProperties, PFN_vkGetPhysicalDeviceProperties, unknown, unknown); + proc_address!(vkGetPhysicalDeviceProperties2, PFN_vkGetPhysicalDeviceProperties2, unknown, unknown); + proc_address!(vkGetPhysicalDeviceProperties2KHR, PFN_vkGetPhysicalDeviceProperties2KHR, unknown, unknown); + proc_address!(vkGetPhysicalDeviceQueueFamilyProperties, PFN_vkGetPhysicalDeviceQueueFamilyProperties, unknown, unknown); + proc_address!(vkGetPhysicalDeviceQueueFamilyProperties2, PFN_vkGetPhysicalDeviceQueueFamilyProperties2, unknown, unknown); + proc_address!(vkGetPhysicalDeviceQueueFamilyProperties2KHR, PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR, unknown, unknown); + proc_address!(vkGetPhysicalDeviceSparseImageFormatProperties, PFN_vkGetPhysicalDeviceSparseImageFormatProperties, unknown, unknown); + proc_address!(vkGetPhysicalDeviceSparseImageFormatProperties2, PFN_vkGetPhysicalDeviceSparseImageFormatProperties2, unknown, unknown); + proc_address!(vkGetPhysicalDeviceSparseImageFormatProperties2KHR, PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR, unknown, unknown); + proc_address!(vkGetPhysicalDeviceSurfaceCapabilities2EXT, PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT, unknown, unknown); + proc_address!(vkGetPhysicalDeviceSurfaceCapabilities2KHR, PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR, unknown, unknown); + proc_address!(vkGetPhysicalDeviceSurfaceCapabilitiesKHR, PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR, unknown, unknown); + proc_address!(vkGetPhysicalDeviceSurfaceFormats2KHR, PFN_vkGetPhysicalDeviceSurfaceFormats2KHR, unknown, unknown); + proc_address!(vkGetPhysicalDeviceSurfaceFormatsKHR, PFN_vkGetPhysicalDeviceSurfaceFormatsKHR, unknown, unknown); + proc_address!(vkGetPhysicalDeviceSurfacePresentModesKHR, PFN_vkGetPhysicalDeviceSurfacePresentModesKHR, unknown, unknown); + proc_address!(vkGetPhysicalDeviceSurfaceSupportKHR, PFN_vkGetPhysicalDeviceSurfaceSupportKHR, unknown, unknown); + proc_address!(vkGetPhysicalDeviceXcbPresentationSupportKHR, PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR, unknown, unknown); + proc_address!(vkGetPipelineCacheData, PFN_vkGetPipelineCacheData, unknown, unknown); + proc_address!(vkGetQueryPoolResults, PFN_vkGetQueryPoolResults, unknown, unknown); + proc_address!(vkGetQueueCheckpointDataNV, PFN_vkGetQueueCheckpointDataNV, unknown, unknown); + proc_address!(vkGetRefreshCycleDurationGOOGLE, PFN_vkGetRefreshCycleDurationGOOGLE, unknown, unknown); + proc_address!(vkGetRenderAreaGranularity, PFN_vkGetRenderAreaGranularity, unknown, unknown); + proc_address!(vkGetSemaphoreFdKHR, PFN_vkGetSemaphoreFdKHR, unknown, unknown); + proc_address!(vkGetShaderInfoAMD, PFN_vkGetShaderInfoAMD, unknown, unknown); + proc_address!(vkGetSwapchainCounterEXT, PFN_vkGetSwapchainCounterEXT, unknown, unknown); + proc_address!(vkGetSwapchainImagesKHR, PFN_vkGetSwapchainImagesKHR, unknown, unknown); + proc_address!(vkGetSwapchainStatusKHR, PFN_vkGetSwapchainStatusKHR, unknown, unknown); + proc_address!(vkGetValidationCacheDataEXT, PFN_vkGetValidationCacheDataEXT, unknown, unknown); + proc_address!(vkImportFenceFdKHR, PFN_vkImportFenceFdKHR, unknown, unknown); + proc_address!(vkImportSemaphoreFdKHR, PFN_vkImportSemaphoreFdKHR, unknown, unknown); + proc_address!(vkInternalAllocationNotification, PFN_vkInternalAllocationNotification, unknown, unknown); + proc_address!(vkInternalFreeNotification, PFN_vkInternalFreeNotification, unknown, unknown); + proc_address!(vkInvalidateMappedMemoryRanges, PFN_vkInvalidateMappedMemoryRanges, unknown, unknown); + proc_address!(vkMapMemory, PFN_vkMapMemory, unknown, unknown); + proc_address!(vkMergePipelineCaches, PFN_vkMergePipelineCaches, unknown, unknown); + proc_address!(vkMergeValidationCachesEXT, PFN_vkMergeValidationCachesEXT, unknown, unknown); + proc_address!(vkNegotiateLoaderICDInterfaceVersion, PFN_vkNegotiateLoaderICDInterfaceVersion, unknown, unknown); + proc_address!(vkQueueBeginDebugUtilsLabelEXT, PFN_vkQueueBeginDebugUtilsLabelEXT, unknown, unknown); + proc_address!(vkQueueBindSparse, PFN_vkQueueBindSparse, unknown, unknown); + proc_address!(vkQueueEndDebugUtilsLabelEXT, PFN_vkQueueEndDebugUtilsLabelEXT, unknown, unknown); + proc_address!(vkQueueInsertDebugUtilsLabelEXT, PFN_vkQueueInsertDebugUtilsLabelEXT, unknown, unknown); + proc_address!(vkQueuePresentKHR, PFN_vkQueuePresentKHR, unknown, unknown); + proc_address!(vkQueueSubmit, PFN_vkQueueSubmit, unknown, unknown); + proc_address!(vkQueueWaitIdle, PFN_vkQueueWaitIdle, unknown, unknown); + proc_address!(vkReallocationFunction, PFN_vkReallocationFunction, unknown, unknown); + proc_address!(vkRegisterDeviceEventEXT, PFN_vkRegisterDeviceEventEXT, unknown, unknown); + proc_address!(vkRegisterDisplayEventEXT, PFN_vkRegisterDisplayEventEXT, unknown, unknown); + proc_address!(vkReleaseDisplayEXT, PFN_vkReleaseDisplayEXT, unknown, unknown); + proc_address!(vkResetCommandBuffer, PFN_vkResetCommandBuffer, unknown, unknown); + proc_address!(vkResetCommandPool, PFN_vkResetCommandPool, unknown, unknown); + proc_address!(vkResetDescriptorPool, PFN_vkResetDescriptorPool, unknown, unknown); + proc_address!(vkResetEvent, PFN_vkResetEvent, unknown, unknown); + proc_address!(vkResetFences, PFN_vkResetFences, unknown, unknown); + proc_address!(vkSetDebugUtilsObjectNameEXT, PFN_vkSetDebugUtilsObjectNameEXT, unknown, unknown); + proc_address!(vkSetDebugUtilsObjectTagEXT, PFN_vkSetDebugUtilsObjectTagEXT, unknown, unknown); + proc_address!(vkSetEvent, PFN_vkSetEvent, unknown, unknown); + proc_address!(vkSetHdrMetadataEXT, PFN_vkSetHdrMetadataEXT, unknown, unknown); + proc_address!(vkSubmitDebugUtilsMessageEXT, PFN_vkSubmitDebugUtilsMessageEXT, unknown, unknown); + proc_address!(vkTrimCommandPool, PFN_vkTrimCommandPool, unknown, unknown); + proc_address!(vkTrimCommandPoolKHR, PFN_vkTrimCommandPoolKHR, unknown, unknown); + proc_address!(vkUnmapMemory, PFN_vkUnmapMemory, unknown, unknown); + proc_address!(vkUpdateDescriptorSetWithTemplate, PFN_vkUpdateDescriptorSetWithTemplate, unknown, unknown); + proc_address!(vkUpdateDescriptorSetWithTemplateKHR, PFN_vkUpdateDescriptorSetWithTemplateKHR, unknown, unknown); + proc_address!(vkUpdateDescriptorSets, PFN_vkUpdateDescriptorSets, unknown, unknown); + proc_address!(vkVoidFunction, PFN_vkVoidFunction, unknown, unknown); + proc_address!(vkWaitForFences, PFN_vkWaitForFences, unknown, unknown); + } + None +} + +pub struct Instance { + enabled_extensions: Extensions, +} + +#[allow(non_snake_case)] +pub extern "system" fn vkGetInstanceProcAddr( + instance: api::VkInstance, + name: *const c_char, +) -> api::PFN_vkVoidFunction { + match instance.get() { + Some(instance) => get_proc_address(name, ProcAddressScope::Instance, unsafe { + &instance.as_ref().enabled_extensions + }), + None => get_proc_address(name, ProcAddressScope::Global, &Extensions::default()), + } +} diff --git a/vulkan-driver/src/handle.rs b/vulkan-driver/src/handle.rs new file mode 100644 index 0000000..ea1bb13 --- /dev/null +++ b/vulkan-driver/src/handle.rs @@ -0,0 +1,220 @@ +use api; +use std::marker::PhantomData; +use std::ops::Deref; +use std::ops::DerefMut; +use std::ptr::null_mut; +use std::ptr::NonNull; + +#[repr(C)] +pub struct DispatchableType { + loader_dispatch_ptr: usize, + value: T, +} + +impl DispatchableType {} + +impl From for DispatchableType { + fn from(v: T) -> Self { + Self { + loader_dispatch_ptr: api::ICD_LOADER_MAGIC as usize, + value: v, + } + } +} + +impl Deref for DispatchableType { + type Target = T; + fn deref(&self) -> &T { + &self.value + } +} + +impl DerefMut for DispatchableType { + fn deref_mut(&mut self) -> &mut T { + &mut self.value + } +} + +pub trait Handle: Clone { + type Value; + fn get(&self) -> Option>; + fn new(v: Option>) -> Self; + fn null() -> Self { + Self::new(None) + } +} + +#[repr(transparent)] +pub struct DispatchableHandle(Option>>); + +impl Clone for DispatchableHandle { + fn clone(&self) -> Self { + DispatchableHandle(self.0) + } +} + +impl Handle for DispatchableHandle { + type Value = DispatchableType; + fn get(&self) -> Option>> { + self.0 + } + fn new(v: Option>>) -> Self { + DispatchableHandle(v) + } +} + +#[repr(transparent)] +pub struct NondispatchableHandle(u64, PhantomData>>); + +impl Clone for NondispatchableHandle { + fn clone(&self) -> Self { + NondispatchableHandle(self.0, PhantomData) + } +} + +impl Handle for NondispatchableHandle { + type Value = T; + fn get(&self) -> Option> { + NonNull::new(self.0 as *mut T) + } + fn new(v: Option>) -> Self { + NondispatchableHandle( + v.map(|v| v.as_ptr()).unwrap_or(null_mut()) as u64, + PhantomData, + ) + } +} + +pub type VkInstance = DispatchableHandle<::api_impl::Instance>; + +pub struct PhysicalDevice {} + +pub type VkPhysicalDevice = DispatchableHandle; + +pub struct Device {} + +pub type VkDevice = DispatchableHandle; + +pub struct Queue {} + +pub type VkQueue = DispatchableHandle; + +pub struct CommandBuffer {} + +pub type VkCommandBuffer = DispatchableHandle; + +pub struct Semaphore {} + +pub type VkSemaphore = NondispatchableHandle; + +pub struct Fence {} + +pub type VkFence = NondispatchableHandle; + +pub struct DeviceMemory {} + +pub type VkDeviceMemory = NondispatchableHandle; + +pub struct Buffer {} + +pub type VkBuffer = NondispatchableHandle; + +pub struct Image {} + +pub type VkImage = NondispatchableHandle; + +pub struct Event {} + +pub type VkEvent = NondispatchableHandle; + +pub struct QueryPool {} + +pub type VkQueryPool = NondispatchableHandle; + +pub struct BufferView {} + +pub type VkBufferView = NondispatchableHandle; + +pub struct ImageView {} + +pub type VkImageView = NondispatchableHandle; + +pub struct ShaderModule {} + +pub type VkShaderModule = NondispatchableHandle; + +pub struct PipelineCache {} + +pub type VkPipelineCache = NondispatchableHandle; + +pub struct PipelineLayout {} + +pub type VkPipelineLayout = NondispatchableHandle; + +pub struct RenderPass {} + +pub type VkRenderPass = NondispatchableHandle; + +pub struct Pipeline {} + +pub type VkPipeline = NondispatchableHandle; + +pub struct DescriptorSetLayout {} + +pub type VkDescriptorSetLayout = NondispatchableHandle; + +pub struct Sampler {} + +pub type VkSampler = NondispatchableHandle; + +pub struct DescriptorPool {} + +pub type VkDescriptorPool = NondispatchableHandle; + +pub struct DescriptorSet {} + +pub type VkDescriptorSet = NondispatchableHandle; + +pub struct Framebuffer {} + +pub type VkFramebuffer = NondispatchableHandle; + +pub struct CommandPool {} + +pub type VkCommandPool = NondispatchableHandle; + +pub struct SamplerYcbcrConversion {} + +pub type VkSamplerYcbcrConversion = NondispatchableHandle; + +pub struct DescriptorUpdateTemplate {} + +pub type VkDescriptorUpdateTemplate = NondispatchableHandle; + +pub struct SurfaceKHR {} + +pub type VkSurfaceKHR = NondispatchableHandle; + +pub struct SwapchainKHR {} + +pub type VkSwapchainKHR = NondispatchableHandle; + +pub struct DisplayKHR {} + +pub type VkDisplayKHR = NondispatchableHandle; + +pub struct DisplayModeKHR {} + +pub type VkDisplayModeKHR = NondispatchableHandle; + +pub struct DebugReportCallbackEXT {} + +pub type VkDebugReportCallbackEXT = NondispatchableHandle; + +pub struct DebugUtilsMessengerEXT {} + +pub type VkDebugUtilsMessengerEXT = NondispatchableHandle; + +pub struct ValidationCacheEXT {} + +pub type VkValidationCacheEXT = NondispatchableHandle; diff --git a/vulkan-driver/src/lib.rs b/vulkan-driver/src/lib.rs index b66dd1d..dc985fa 100644 --- a/vulkan-driver/src/lib.rs +++ b/vulkan-driver/src/lib.rs @@ -1,6 +1,8 @@ #[cfg(unix)] extern crate xcb; mod api; +mod api_impl; +mod handle; use std::ffi::CStr; use std::os::raw::c_char; @@ -9,7 +11,7 @@ pub extern "system" fn vk_icdGetInstanceProcAddr( instance: api::VkInstance, name: *const c_char, ) -> api::PFN_vkVoidFunction { - unimplemented!() + api_impl::vkGetInstanceProcAddr(instance, name) } // note that if the following fails, then you may be encountering bindgen issue #1402 -- 2.30.2