We don't support any handle type yet.
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/vulkan-1/vulkan-1.spec | 2 +- dlls/winevulkan/make_vulkan | 45 ++++++++++++++++++++------ dlls/winevulkan/vulkan.c | 56 +++++++++++++++++++++++++++++++++ dlls/winevulkan/vulkan_thunks.c | 13 +++----- dlls/winevulkan/vulkan_thunks.h | 8 +++++ dlls/winevulkan/winevulkan.spec | 2 +- include/wine/vulkan.h | 6 ++++ 7 files changed, 113 insertions(+), 19 deletions(-)
diff --git a/dlls/vulkan-1/vulkan-1.spec b/dlls/vulkan-1/vulkan-1.spec index ffe6b43c841a..104d69382678 100644 --- a/dlls/vulkan-1/vulkan-1.spec +++ b/dlls/vulkan-1/vulkan-1.spec @@ -178,7 +178,7 @@ @ stdcall vkGetInstanceProcAddr(ptr str) winevulkan.wine_vkGetInstanceProcAddr @ stub vkGetPhysicalDeviceDisplayPlanePropertiesKHR @ stub vkGetPhysicalDeviceDisplayPropertiesKHR -@ stub vkGetPhysicalDeviceExternalBufferProperties +@ stdcall vkGetPhysicalDeviceExternalBufferProperties(ptr ptr ptr) winevulkan.wine_vkGetPhysicalDeviceExternalBufferProperties @ stdcall vkGetPhysicalDeviceExternalFenceProperties(ptr ptr ptr) winevulkan.wine_vkGetPhysicalDeviceExternalFenceProperties @ stub vkGetPhysicalDeviceExternalSemaphoreProperties @ stdcall vkGetPhysicalDeviceFeatures(ptr ptr) winevulkan.wine_vkGetPhysicalDeviceFeatures diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 60e0c62194cd..7a4aa4d8d675 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -89,7 +89,6 @@ BLACKLISTED_EXTENSIONS = [ "VK_EXT_validation_features", "VK_EXT_validation_flags", "VK_KHR_display", - "VK_KHR_external_memory_capabilities", "VK_KHR_get_surface_capabilities2", "VK_KHR_surface_protected_capabilities", "VK_NV_external_memory_capabilities", @@ -165,7 +164,9 @@ FUNCTION_OVERRIDES = { "vkEnumerateDeviceExtensionProperties" : {"dispatch" : True, "driver" : False, "thunk" : False}, "vkEnumeratePhysicalDeviceGroups" : {"dispatch" : True, "driver" : False, "thunk" : False}, "vkEnumeratePhysicalDevices" : {"dispatch" : True, "driver" : False, "thunk" : False}, + "vkGetPhysicalDeviceExternalBufferProperties" : {"dispatch" : False, "driver" : False, "thunk" : False}, "vkGetPhysicalDeviceExternalFenceProperties" : {"dispatch" : False, "driver" : False, "thunk" : False}, + "vkGetPhysicalDeviceImageFormatProperties2" : {"dispatch" : True, "driver" : False, "thunk" : True, "private_thunk" : True},
# Device functions "vkAllocateCommandBuffers" : {"dispatch" : True, "driver" : False, "thunk" : False}, @@ -199,6 +200,10 @@ FUNCTION_OVERRIDES = { # VK_KHR_external_fence_capabilities "vkGetPhysicalDeviceExternalFencePropertiesKHR" : {"dispatch" : False, "driver" : False, "thunk" : False},
+ # VK_KHR_external_memory_capabilities + "vkGetPhysicalDeviceExternalBufferPropertiesKHR" : {"dispatch" : False, "driver" : False, "thunk" : False}, + "vkGetPhysicalDeviceImageFormatProperties2KHR" : {"dispatch" : True, "driver" : False, "thunk" : True, "private_thunk" : True}, + # VK_KHR_device_group_creation "vkEnumeratePhysicalDeviceGroupsKHR" : {"dispatch" : True, "driver" : False, "thunk" : False},
@@ -418,9 +423,12 @@ class VkFunction(object):
# For some functions we need some extra metadata from FUNCTION_OVERRIDES. func_info = FUNCTION_OVERRIDES.get(self.name, None) - self.dispatch = func_info["dispatch"] if func_info is not None else True - self.driver = func_info["driver"] if func_info is not None else False - self.thunk_needed = func_info["thunk"] if func_info is not None else True + self.dispatch = func_info["dispatch"] if func_info else True + self.driver = func_info["driver"] if func_info else False + self.thunk_needed = func_info["thunk"] if func_info else True + self.private_thunk = func_info["private_thunk"] if func_info and "private_thunk" in func_info else False + if self.private_thunk: + self.thunk_needed = True
# Required is set while parsing which APIs and types are required # and is used by the code generation. @@ -531,6 +539,9 @@ class VkFunction(object): def needs_thunk(self): return self.thunk_needed
+ def needs_private_thunk(self): + return self.private_thunk + def pfn(self, prefix="p", call_conv=None, conv=False): """ Create function pointer. """
@@ -588,7 +599,10 @@ class VkFunction(object): return proto
def body(self): - body = " {0}".format(self.trace()) + body = "" + + if not self.needs_private_thunk(): + body += " {0}".format(self.trace())
params = ", ".join([p.variable(conv=False) for p in self.params])
@@ -617,7 +631,8 @@ class VkFunction(object): else: body += " {0}_host {1}_host;\n".format(p.type, p.name)
- body += " {0}\n".format(self.trace()) + if not self.needs_private_thunk(): + body += " {0}\n".format(self.trace())
# Call any win_to_host conversion calls. for p in self.params: @@ -1981,9 +1996,13 @@ class VkGenerator(object): continue
# Exports symbols for Core functions. - if not vk_func.is_core_func(): + if not vk_func.is_core_func() and not vk_func.needs_private_thunk(): f.write("static ") - f.write(vk_func.thunk(prefix=prefix, call_conv="WINAPI")) + + if vk_func.needs_private_thunk(): + f.write(vk_func.thunk(prefix="thunk_")) + else: + f.write(vk_func.thunk(prefix=prefix, call_conv="WINAPI"))
f.write("static const struct vulkan_func vk_device_dispatch_table[] =\n{\n") for vk_func in self.registry.device_funcs: @@ -2080,7 +2099,9 @@ class VkGenerator(object): # Generate prototypes for device and instance functions requiring a custom implementation. f.write("/* Functions for which we have custom implementations outside of the thunks. */\n") for vk_func in self.registry.funcs.values(): - if not vk_func.is_required() or vk_func.is_global_func() or vk_func.needs_thunk(): + if not vk_func.is_required() or vk_func.is_global_func(): + continue + if vk_func.needs_thunk() and not vk_func.needs_private_thunk(): continue
if vk_func.is_core_func(): @@ -2089,6 +2110,12 @@ class VkGenerator(object): f.write("{0};\n".format(vk_func.prototype("WINAPI", prefix="wine_", postfix="DECLSPEC_HIDDEN"))) f.write("\n")
+ f.write("/* Private thunks */\n") + for vk_func in self.registry.funcs.values(): + if vk_func.needs_private_thunk(): + f.write("{0};\n".format(vk_func.prototype(prefix="thunk_", postfix="DECLSPEC_HIDDEN"))) + f.write("\n") + for struct in self.host_structs: f.write(struct.definition(align=False, conv=True, postfix="_host")) f.write("\n") diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index f4e492c0e5fb..1728f3b7dcd4 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -1271,6 +1271,62 @@ void WINAPI wine_vkGetPhysicalDeviceExternalFencePropertiesKHR(VkPhysicalDevice properties->externalFenceFeatures = 0; }
+void WINAPI wine_vkGetPhysicalDeviceExternalBufferProperties(VkPhysicalDevice phys_dev, + const VkPhysicalDeviceExternalBufferInfo *buffer_info, VkExternalBufferProperties *properties) +{ + TRACE("%p, %p, %p\n", phys_dev, buffer_info, properties); + memset(&properties->externalMemoryProperties, 0, sizeof(properties->externalMemoryProperties)); +} + +void WINAPI wine_vkGetPhysicalDeviceExternalBufferPropertiesKHR(VkPhysicalDevice phys_dev, + const VkPhysicalDeviceExternalBufferInfo *buffer_info, VkExternalBufferProperties *properties) +{ + TRACE("%p, %p, %p\n", phys_dev, buffer_info, properties); + memset(&properties->externalMemoryProperties, 0, sizeof(properties->externalMemoryProperties)); +} + +VkResult WINAPI wine_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice phys_dev, + const VkPhysicalDeviceImageFormatInfo2 *format_info, VkImageFormatProperties2 *properties) +{ + VkExternalImageFormatProperties *external_image_properties; + VkResult res; + + TRACE("%p, %p, %p\n", phys_dev, format_info, properties); + + res = thunk_vkGetPhysicalDeviceImageFormatProperties2(phys_dev, format_info, properties); + + if ((external_image_properties = wine_vk_find_struct(properties, EXTERNAL_IMAGE_FORMAT_PROPERTIES))) + { + VkExternalMemoryProperties *p = &external_image_properties->externalMemoryProperties; + p->externalMemoryFeatures = 0; + p->exportFromImportedHandleTypes = 0; + p->compatibleHandleTypes = 0; + } + + return res; +} + +VkResult WINAPI wine_vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice phys_dev, + const VkPhysicalDeviceImageFormatInfo2 *format_info, VkImageFormatProperties2 *properties) +{ + VkExternalImageFormatProperties *external_image_properties; + VkResult res; + + TRACE("%p, %p, %p\n", phys_dev, format_info, properties); + + res = thunk_vkGetPhysicalDeviceImageFormatProperties2KHR(phys_dev, format_info, properties); + + if ((external_image_properties = wine_vk_find_struct(properties, EXTERNAL_IMAGE_FORMAT_PROPERTIES))) + { + VkExternalMemoryProperties *p = &external_image_properties->externalMemoryProperties; + p->externalMemoryFeatures = 0; + p->exportFromImportedHandleTypes = 0; + p->compatibleHandleTypes = 0; + } + + return res; +} + BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, void *reserved) { TRACE("%p, %u, %p\n", hinst, reason, reserved); diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c index a52dd79a52e9..225d68927ab2 100644 --- a/dlls/winevulkan/vulkan_thunks.c +++ b/dlls/winevulkan/vulkan_thunks.c @@ -2900,38 +2900,32 @@ VkResult WINAPI wine_vkGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice p #endif }
-VkResult WINAPI wine_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties) +VkResult thunk_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties) { #if defined(USE_STRUCT_CONVERSION) VkResult result; VkImageFormatProperties2_host pImageFormatProperties_host; - TRACE("%p, %p, %p\n", physicalDevice, pImageFormatInfo, pImageFormatProperties); - convert_VkImageFormatProperties2_win_to_host(pImageFormatProperties, &pImageFormatProperties_host); result = physicalDevice->instance->funcs.p_vkGetPhysicalDeviceImageFormatProperties2(physicalDevice->phys_dev, pImageFormatInfo, &pImageFormatProperties_host);
convert_VkImageFormatProperties2_host_to_win(&pImageFormatProperties_host, pImageFormatProperties); return result; #else - TRACE("%p, %p, %p\n", physicalDevice, pImageFormatInfo, pImageFormatProperties); return physicalDevice->instance->funcs.p_vkGetPhysicalDeviceImageFormatProperties2(physicalDevice->phys_dev, pImageFormatInfo, pImageFormatProperties); #endif }
-static VkResult WINAPI wine_vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties) +VkResult thunk_vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties) { #if defined(USE_STRUCT_CONVERSION) VkResult result; VkImageFormatProperties2_host pImageFormatProperties_host; - TRACE("%p, %p, %p\n", physicalDevice, pImageFormatInfo, pImageFormatProperties); - convert_VkImageFormatProperties2_win_to_host(pImageFormatProperties, &pImageFormatProperties_host); result = physicalDevice->instance->funcs.p_vkGetPhysicalDeviceImageFormatProperties2KHR(physicalDevice->phys_dev, pImageFormatInfo, &pImageFormatProperties_host);
convert_VkImageFormatProperties2_host_to_win(&pImageFormatProperties_host, pImageFormatProperties); return result; #else - TRACE("%p, %p, %p\n", physicalDevice, pImageFormatInfo, pImageFormatProperties); return physicalDevice->instance->funcs.p_vkGetPhysicalDeviceImageFormatProperties2KHR(physicalDevice->phys_dev, pImageFormatInfo, pImageFormatProperties); #endif } @@ -3544,6 +3538,8 @@ static const struct vulkan_func vk_instance_dispatch_table[] = {"vkEnumeratePhysicalDeviceGroups", &wine_vkEnumeratePhysicalDeviceGroups}, {"vkEnumeratePhysicalDeviceGroupsKHR", &wine_vkEnumeratePhysicalDeviceGroupsKHR}, {"vkEnumeratePhysicalDevices", &wine_vkEnumeratePhysicalDevices}, + {"vkGetPhysicalDeviceExternalBufferProperties", &wine_vkGetPhysicalDeviceExternalBufferProperties}, + {"vkGetPhysicalDeviceExternalBufferPropertiesKHR", &wine_vkGetPhysicalDeviceExternalBufferPropertiesKHR}, {"vkGetPhysicalDeviceExternalFenceProperties", &wine_vkGetPhysicalDeviceExternalFenceProperties}, {"vkGetPhysicalDeviceExternalFencePropertiesKHR", &wine_vkGetPhysicalDeviceExternalFencePropertiesKHR}, {"vkGetPhysicalDeviceFeatures", &wine_vkGetPhysicalDeviceFeatures}, @@ -3711,6 +3707,7 @@ static const char * const vk_instance_extensions[] = "VK_EXT_swapchain_colorspace", "VK_KHR_device_group_creation", "VK_KHR_external_fence_capabilities", + "VK_KHR_external_memory_capabilities", "VK_KHR_get_physical_device_properties2", "VK_KHR_surface", "VK_KHR_win32_surface", diff --git a/dlls/winevulkan/vulkan_thunks.h b/dlls/winevulkan/vulkan_thunks.h index d49a29a22c83..5c99ffd580cf 100644 --- a/dlls/winevulkan/vulkan_thunks.h +++ b/dlls/winevulkan/vulkan_thunks.h @@ -56,10 +56,18 @@ void WINAPI wine_vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool PFN_vkVoidFunction WINAPI wine_vkGetDeviceProcAddr(VkDevice device, const char *pName); void WINAPI wine_vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue *pQueue); void WINAPI wine_vkGetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2 *pQueueInfo, VkQueue *pQueue); +void WINAPI wine_vkGetPhysicalDeviceExternalBufferProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo *pExternalBufferInfo, VkExternalBufferProperties *pExternalBufferProperties); +void WINAPI wine_vkGetPhysicalDeviceExternalBufferPropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo *pExternalBufferInfo, VkExternalBufferProperties *pExternalBufferProperties) DECLSPEC_HIDDEN; void WINAPI wine_vkGetPhysicalDeviceExternalFenceProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo, VkExternalFenceProperties *pExternalFenceProperties); void WINAPI wine_vkGetPhysicalDeviceExternalFencePropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo, VkExternalFenceProperties *pExternalFenceProperties) DECLSPEC_HIDDEN; +VkResult WINAPI wine_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties); +VkResult WINAPI wine_vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties) DECLSPEC_HIDDEN; VkResult WINAPI wine_vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, VkFence fence);
+/* Private thunks */ +VkResult thunk_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties) DECLSPEC_HIDDEN; +VkResult thunk_vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties) DECLSPEC_HIDDEN; + typedef struct VkAcquireNextImageInfoKHR_host { VkStructureType sType; diff --git a/dlls/winevulkan/winevulkan.spec b/dlls/winevulkan/winevulkan.spec index 1c7795d9802f..626b47e4399a 100644 --- a/dlls/winevulkan/winevulkan.spec +++ b/dlls/winevulkan/winevulkan.spec @@ -181,7 +181,7 @@ @ stdcall -private wine_vkGetInstanceProcAddr(ptr str) @ stub vkGetPhysicalDeviceDisplayPlanePropertiesKHR @ stub vkGetPhysicalDeviceDisplayPropertiesKHR -@ stub vkGetPhysicalDeviceExternalBufferProperties +@ stdcall -private wine_vkGetPhysicalDeviceExternalBufferProperties(ptr ptr ptr) @ stdcall -private wine_vkGetPhysicalDeviceExternalFenceProperties(ptr ptr ptr) @ stub vkGetPhysicalDeviceExternalSemaphoreProperties @ stdcall -private wine_vkGetPhysicalDeviceFeatures(ptr ptr) diff --git a/include/wine/vulkan.h b/include/wine/vulkan.h index aedb3684791e..ae93a5d12048 100644 --- a/include/wine/vulkan.h +++ b/include/wine/vulkan.h @@ -146,6 +146,8 @@ #define VK_KHR_MAINTENANCE1_EXTENSION_NAME "VK_KHR_maintenance1" #define VK_KHR_DEVICE_GROUP_CREATION_SPEC_VERSION 1 #define VK_KHR_DEVICE_GROUP_CREATION_EXTENSION_NAME "VK_KHR_device_group_creation" +#define VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_memory_capabilities" #define VK_KHR_PUSH_DESCRIPTOR_SPEC_VERSION 2 #define VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME "VK_KHR_push_descriptor" #define VK_EXT_CONDITIONAL_RENDERING_SPEC_VERSION 1 @@ -5394,6 +5396,8 @@ typedef void (VKAPI_PTR *PFN_vkGetImageSparseMemoryRequirements2)(VkDevice, cons typedef void (VKAPI_PTR *PFN_vkGetImageSparseMemoryRequirements2KHR)(VkDevice, const VkImageSparseMemoryRequirementsInfo2 *, uint32_t *, VkSparseImageMemoryRequirements2 *); typedef void (VKAPI_PTR *PFN_vkGetImageSubresourceLayout)(VkDevice, VkImage, const VkImageSubresource *, VkSubresourceLayout *); typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vkGetInstanceProcAddr)(VkInstance, const char *); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalBufferProperties)(VkPhysicalDevice, const VkPhysicalDeviceExternalBufferInfo *, VkExternalBufferProperties *); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHR)(VkPhysicalDevice, const VkPhysicalDeviceExternalBufferInfo *, VkExternalBufferProperties *); typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalFenceProperties)(VkPhysicalDevice, const VkPhysicalDeviceExternalFenceInfo *, VkExternalFenceProperties *); typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalFencePropertiesKHR)(VkPhysicalDevice, const VkPhysicalDeviceExternalFenceInfo *, VkExternalFenceProperties *); typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFeatures)(VkPhysicalDevice, VkPhysicalDeviceFeatures *); @@ -5650,6 +5654,8 @@ void VKAPI_CALL vkGetImageSparseMemoryRequirements2(VkDevice device, const VkIma void VKAPI_CALL vkGetImageSparseMemoryRequirements2KHR(VkDevice device, const VkImageSparseMemoryRequirementsInfo2 *pInfo, uint32_t *pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2 *pSparseMemoryRequirements); void VKAPI_CALL vkGetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource *pSubresource, VkSubresourceLayout *pLayout); PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char *pName); +void VKAPI_CALL vkGetPhysicalDeviceExternalBufferProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo *pExternalBufferInfo, VkExternalBufferProperties *pExternalBufferProperties); +void VKAPI_CALL vkGetPhysicalDeviceExternalBufferPropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo *pExternalBufferInfo, VkExternalBufferProperties *pExternalBufferProperties); void VKAPI_CALL vkGetPhysicalDeviceExternalFenceProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo, VkExternalFenceProperties *pExternalFenceProperties); void VKAPI_CALL vkGetPhysicalDeviceExternalFencePropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo, VkExternalFenceProperties *pExternalFenceProperties); void VKAPI_CALL vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures *pFeatures);