Signed-off-by: Brendan Shanks bshanks@codeweavers.com --- v2: Rebase on latest master
dlls/winemac.drv/vulkan.c | 32 ++++++++++++++++++ dlls/winevulkan/make_vulkan | 7 ++-- dlls/winevulkan/vulkan_thunks.c | 46 +++++++++++++++++++++++++ dlls/winevulkan/vulkan_thunks.h | 20 +++++++++++ dlls/winex11.drv/vulkan.c | 60 +++++++++++++++++++++++++++++++++ include/wine/vulkan.h | 38 ++++++++++++++++++--- include/wine/vulkan_driver.h | 8 ++++- 7 files changed, 204 insertions(+), 7 deletions(-)
diff --git a/dlls/winemac.drv/vulkan.c b/dlls/winemac.drv/vulkan.c index 360dd02f7b..5d15eeda2b 100644 --- a/dlls/winemac.drv/vulkan.c +++ b/dlls/winemac.drv/vulkan.c @@ -86,7 +86,9 @@ static void (*pvkDestroySwapchainKHR)(VkDevice, VkSwapchainKHR, const VkAllocati static VkResult (*pvkEnumerateInstanceExtensionProperties)(const char *, uint32_t *, VkExtensionProperties *); static void * (*pvkGetDeviceProcAddr)(VkDevice, const char *); static void * (*pvkGetInstanceProcAddr)(VkInstance, const char *); +static VkResult (*pvkGetPhysicalDeviceSurfaceCapabilities2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *, VkSurfaceCapabilities2KHR *); static VkResult (*pvkGetPhysicalDeviceSurfaceCapabilitiesKHR)(VkPhysicalDevice, VkSurfaceKHR, VkSurfaceCapabilitiesKHR *); +static VkResult (*pvkGetPhysicalDeviceSurfaceFormats2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *, uint32_t *, VkSurfaceFormat2KHR *); static VkResult (*pvkGetPhysicalDeviceSurfaceFormatsKHR)(VkPhysicalDevice, VkSurfaceKHR, uint32_t *, VkSurfaceFormatKHR *); static VkResult (*pvkGetPhysicalDeviceSurfacePresentModesKHR)(VkPhysicalDevice, VkSurfaceKHR, uint32_t *, VkPresentModeKHR *); static VkResult (*pvkGetPhysicalDeviceSurfaceSupportKHR)(VkPhysicalDevice, uint32_t, VkSurfaceKHR, VkBool32 *); @@ -122,7 +124,9 @@ static BOOL WINAPI wine_vk_init(INIT_ONCE *once, void *param, void **context) LOAD_FUNCPTR(vkEnumerateInstanceExtensionProperties) LOAD_FUNCPTR(vkGetDeviceProcAddr) LOAD_FUNCPTR(vkGetInstanceProcAddr) + LOAD_FUNCPTR(vkGetPhysicalDeviceSurfaceCapabilities2KHR) LOAD_FUNCPTR(vkGetPhysicalDeviceSurfaceCapabilitiesKHR) + LOAD_FUNCPTR(vkGetPhysicalDeviceSurfaceFormats2KHR) LOAD_FUNCPTR(vkGetPhysicalDeviceSurfaceFormatsKHR) LOAD_FUNCPTR(vkGetPhysicalDeviceSurfacePresentModesKHR) LOAD_FUNCPTR(vkGetPhysicalDeviceSurfaceSupportKHR) @@ -441,6 +445,19 @@ static void *macdrv_vkGetInstanceProcAddr(VkInstance instance, const char *name) return pvkGetInstanceProcAddr(instance, name); }
+static VkResult macdrv_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice phys_dev, + const VkPhysicalDeviceSurfaceInfo2KHR *surface_info, VkSurfaceCapabilities2KHR *capabilities) +{ + VkPhysicalDeviceSurfaceInfo2KHR surface_info_host; + + TRACE("%p, %p, %p\n", phys_dev, surface_info, capabilities); + + surface_info_host = *surface_info; + surface_info_host.surface = surface_from_handle(surface_info->surface)->surface; + + return pvkGetPhysicalDeviceSurfaceCapabilities2KHR(phys_dev, &surface_info_host, capabilities); +} + static VkResult macdrv_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice phys_dev, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *capabilities) { @@ -452,6 +469,19 @@ static VkResult macdrv_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevic capabilities); }
+static VkResult macdrv_vkGetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice phys_dev, + const VkPhysicalDeviceSurfaceInfo2KHR *surface_info, uint32_t *count, VkSurfaceFormat2KHR *formats) +{ + VkPhysicalDeviceSurfaceInfo2KHR surface_info_host; + + TRACE("%p, %p, %p, %p\n", phys_dev, surface_info, count, formats); + + surface_info_host = *surface_info; + surface_info_host.surface = surface_from_handle(surface_info->surface)->surface; + + return pvkGetPhysicalDeviceSurfaceFormats2KHR(phys_dev, &surface_info_host, count, formats); +} + static VkResult macdrv_vkGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice phys_dev, VkSurfaceKHR surface, uint32_t *count, VkSurfaceFormatKHR *formats) { @@ -542,7 +572,9 @@ static const struct vulkan_funcs vulkan_funcs = macdrv_vkGetDeviceProcAddr, macdrv_vkGetInstanceProcAddr, NULL, + macdrv_vkGetPhysicalDeviceSurfaceCapabilities2KHR, macdrv_vkGetPhysicalDeviceSurfaceCapabilitiesKHR, + macdrv_vkGetPhysicalDeviceSurfaceFormats2KHR, macdrv_vkGetPhysicalDeviceSurfaceFormatsKHR, macdrv_vkGetPhysicalDeviceSurfacePresentModesKHR, macdrv_vkGetPhysicalDeviceSurfaceSupportKHR, diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 1811d5ae10..ccbb74e626 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -96,7 +96,6 @@ BLACKLISTED_EXTENSIONS = [ "VK_EXT_validation_features", "VK_EXT_validation_flags", "VK_KHR_display", # Needs WSI work. - "VK_KHR_get_surface_capabilities2", "VK_KHR_surface_protected_capabilities",
# Device extensions @@ -139,7 +138,7 @@ CORE_EXTENSIONS = [ # Functions part of our winevulkan graphics driver interface. # DRIVER_VERSION should be bumped on any change to driver interface # in FUNCTION_OVERRIDES -DRIVER_VERSION = 7 +DRIVER_VERSION = 8
# Table of functions for which we have a special implementation. # These are regular device / instance functions for which we need @@ -186,6 +185,10 @@ FUNCTION_OVERRIDES = { "vkGetPhysicalDeviceSurfaceFormatsKHR" : {"dispatch" : True, "driver" : True, "thunk" : True}, "vkGetPhysicalDeviceSurfacePresentModesKHR" : {"dispatch" : True, "driver" : True, "thunk" : True},
+ # VK_KHR_get_surface_capabilities2 + "vkGetPhysicalDeviceSurfaceCapabilities2KHR" : {"dispatch" : True, "driver" : True, "thunk" : True}, + "vkGetPhysicalDeviceSurfaceFormats2KHR" : {"dispatch" : True, "driver" : True, "thunk" : True}, + # VK_KHR_win32_surface "vkCreateWin32SurfaceKHR" : {"dispatch" : True, "driver" : True, "thunk" : True}, "vkGetPhysicalDeviceWin32PresentationSupportKHR" : {"dispatch" : True, "driver" : True, "thunk" : True}, diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c index 8ab36b898b..ec2481c3d3 100644 --- a/dlls/winevulkan/vulkan_thunks.c +++ b/dlls/winevulkan/vulkan_thunks.c @@ -1159,6 +1159,15 @@ static inline void convert_VkPhysicalDeviceProperties2_host_to_win(const VkPhysi convert_VkPhysicalDeviceProperties_host_to_win(&in->properties, &out->properties); }
+static inline void convert_VkPhysicalDeviceSurfaceInfo2KHR_win_to_host(const VkPhysicalDeviceSurfaceInfo2KHR *in, VkPhysicalDeviceSurfaceInfo2KHR_host *out) +{ + if (!in) return; + + out->sType = in->sType; + out->pNext = in->pNext; + out->surface = in->surface; +} + static inline void convert_VkPipelineExecutableInfoKHR_win_to_host(const VkPipelineExecutableInfoKHR *in, VkPipelineExecutableInfoKHR_host *out) { if (!in) return; @@ -4533,12 +4542,46 @@ static VkResult WINAPI wine_vkGetPhysicalDeviceSupportedFramebufferMixedSamplesC return physicalDevice->instance->funcs.p_vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV(physicalDevice->phys_dev, pCombinationCount, pCombinations); }
+static VkResult WINAPI wine_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, VkSurfaceCapabilities2KHR *pSurfaceCapabilities) +{ +#if defined(USE_STRUCT_CONVERSION) + VkResult result; + VkPhysicalDeviceSurfaceInfo2KHR_host pSurfaceInfo_host; + TRACE("%p, %p, %p\n", physicalDevice, pSurfaceInfo, pSurfaceCapabilities); + + convert_VkPhysicalDeviceSurfaceInfo2KHR_win_to_host(pSurfaceInfo, &pSurfaceInfo_host); + result = physicalDevice->instance->funcs.p_vkGetPhysicalDeviceSurfaceCapabilities2KHR(physicalDevice->phys_dev, &pSurfaceInfo_host, pSurfaceCapabilities); + + return result; +#else + TRACE("%p, %p, %p\n", physicalDevice, pSurfaceInfo, pSurfaceCapabilities); + return physicalDevice->instance->funcs.p_vkGetPhysicalDeviceSurfaceCapabilities2KHR(physicalDevice->phys_dev, pSurfaceInfo, pSurfaceCapabilities); +#endif +} + VkResult WINAPI wine_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) { TRACE("%p, 0x%s, %p\n", physicalDevice, wine_dbgstr_longlong(surface), pSurfaceCapabilities); return physicalDevice->instance->funcs.p_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice->phys_dev, surface, pSurfaceCapabilities); }
+static VkResult WINAPI wine_vkGetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, uint32_t *pSurfaceFormatCount, VkSurfaceFormat2KHR *pSurfaceFormats) +{ +#if defined(USE_STRUCT_CONVERSION) + VkResult result; + VkPhysicalDeviceSurfaceInfo2KHR_host pSurfaceInfo_host; + TRACE("%p, %p, %p, %p\n", physicalDevice, pSurfaceInfo, pSurfaceFormatCount, pSurfaceFormats); + + convert_VkPhysicalDeviceSurfaceInfo2KHR_win_to_host(pSurfaceInfo, &pSurfaceInfo_host); + result = physicalDevice->instance->funcs.p_vkGetPhysicalDeviceSurfaceFormats2KHR(physicalDevice->phys_dev, &pSurfaceInfo_host, pSurfaceFormatCount, pSurfaceFormats); + + return result; +#else + TRACE("%p, %p, %p, %p\n", physicalDevice, pSurfaceInfo, pSurfaceFormatCount, pSurfaceFormats); + return physicalDevice->instance->funcs.p_vkGetPhysicalDeviceSurfaceFormats2KHR(physicalDevice->phys_dev, pSurfaceInfo, pSurfaceFormatCount, pSurfaceFormats); +#endif +} + VkResult WINAPI wine_vkGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pSurfaceFormatCount, VkSurfaceFormatKHR *pSurfaceFormats) { TRACE("%p, 0x%s, %p, %p\n", physicalDevice, wine_dbgstr_longlong(surface), pSurfaceFormatCount, pSurfaceFormats); @@ -5219,7 +5262,9 @@ static const struct vulkan_func vk_instance_dispatch_table[] = {"vkGetPhysicalDeviceSparseImageFormatProperties2", &wine_vkGetPhysicalDeviceSparseImageFormatProperties2}, {"vkGetPhysicalDeviceSparseImageFormatProperties2KHR", &wine_vkGetPhysicalDeviceSparseImageFormatProperties2KHR}, {"vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV", &wine_vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV}, + {"vkGetPhysicalDeviceSurfaceCapabilities2KHR", &wine_vkGetPhysicalDeviceSurfaceCapabilities2KHR}, {"vkGetPhysicalDeviceSurfaceCapabilitiesKHR", &wine_vkGetPhysicalDeviceSurfaceCapabilitiesKHR}, + {"vkGetPhysicalDeviceSurfaceFormats2KHR", &wine_vkGetPhysicalDeviceSurfaceFormats2KHR}, {"vkGetPhysicalDeviceSurfaceFormatsKHR", &wine_vkGetPhysicalDeviceSurfaceFormatsKHR}, {"vkGetPhysicalDeviceSurfacePresentModesKHR", &wine_vkGetPhysicalDeviceSurfacePresentModesKHR}, {"vkGetPhysicalDeviceSurfaceSupportKHR", &wine_vkGetPhysicalDeviceSurfaceSupportKHR}, @@ -5405,6 +5450,7 @@ static const char * const vk_instance_extensions[] = "VK_KHR_external_memory_capabilities", "VK_KHR_external_semaphore_capabilities", "VK_KHR_get_physical_device_properties2", + "VK_KHR_get_surface_capabilities2", "VK_KHR_surface", "VK_KHR_win32_surface", }; diff --git a/dlls/winevulkan/vulkan_thunks.h b/dlls/winevulkan/vulkan_thunks.h index b566a3728f..a5eb35333d 100644 --- a/dlls/winevulkan/vulkan_thunks.h +++ b/dlls/winevulkan/vulkan_thunks.h @@ -795,6 +795,14 @@ typedef struct VkPhysicalDeviceProperties2_host
typedef VkPhysicalDeviceProperties2 VkPhysicalDeviceProperties2KHR;
+typedef struct VkPhysicalDeviceSurfaceInfo2KHR_host +{ + VkStructureType sType; + const void *pNext; + VkSurfaceKHR surface; +} VkPhysicalDeviceSurfaceInfo2KHR_host; + + typedef struct VkPipelineExecutableInfoKHR_host { VkStructureType sType; @@ -1472,7 +1480,17 @@ struct vulkan_instance_funcs void (*p_vkGetPhysicalDeviceSparseImageFormatProperties2)(VkPhysicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2 *, uint32_t *, VkSparseImageFormatProperties2 *); void (*p_vkGetPhysicalDeviceSparseImageFormatProperties2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2 *, uint32_t *, VkSparseImageFormatProperties2 *); VkResult (*p_vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV)(VkPhysicalDevice, uint32_t *, VkFramebufferMixedSamplesCombinationNV *); +#if defined(USE_STRUCT_CONVERSION) + VkResult (*p_vkGetPhysicalDeviceSurfaceCapabilities2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR_host *, VkSurfaceCapabilities2KHR *); +#else + VkResult (*p_vkGetPhysicalDeviceSurfaceCapabilities2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *, VkSurfaceCapabilities2KHR *); +#endif VkResult (*p_vkGetPhysicalDeviceSurfaceCapabilitiesKHR)(VkPhysicalDevice, VkSurfaceKHR, VkSurfaceCapabilitiesKHR *); +#if defined(USE_STRUCT_CONVERSION) + VkResult (*p_vkGetPhysicalDeviceSurfaceFormats2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR_host *, uint32_t *, VkSurfaceFormat2KHR *); +#else + VkResult (*p_vkGetPhysicalDeviceSurfaceFormats2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *, uint32_t *, VkSurfaceFormat2KHR *); +#endif VkResult (*p_vkGetPhysicalDeviceSurfaceFormatsKHR)(VkPhysicalDevice, VkSurfaceKHR, uint32_t *, VkSurfaceFormatKHR *); VkResult (*p_vkGetPhysicalDeviceSurfacePresentModesKHR)(VkPhysicalDevice, VkSurfaceKHR, uint32_t *, VkPresentModeKHR *); VkResult (*p_vkGetPhysicalDeviceSurfaceSupportKHR)(VkPhysicalDevice, uint32_t, VkSurfaceKHR, VkBool32 *); @@ -1763,7 +1781,9 @@ struct vulkan_instance_funcs USE_VK_FUNC(vkGetPhysicalDeviceSparseImageFormatProperties2) \ USE_VK_FUNC(vkGetPhysicalDeviceSparseImageFormatProperties2KHR) \ USE_VK_FUNC(vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV) \ + USE_VK_FUNC(vkGetPhysicalDeviceSurfaceCapabilities2KHR) \ USE_VK_FUNC(vkGetPhysicalDeviceSurfaceCapabilitiesKHR) \ + USE_VK_FUNC(vkGetPhysicalDeviceSurfaceFormats2KHR) \ USE_VK_FUNC(vkGetPhysicalDeviceSurfaceFormatsKHR) \ USE_VK_FUNC(vkGetPhysicalDeviceSurfacePresentModesKHR) \ USE_VK_FUNC(vkGetPhysicalDeviceSurfaceSupportKHR) \ diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 28ae1a9e0e..caef8c9928 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -85,7 +85,9 @@ static VkResult (*pvkGetDeviceGroupSurfacePresentModesKHR)(VkDevice, VkSurfaceKH static void * (*pvkGetDeviceProcAddr)(VkDevice, const char *); static void * (*pvkGetInstanceProcAddr)(VkInstance, const char *); static VkResult (*pvkGetPhysicalDevicePresentRectanglesKHR)(VkPhysicalDevice, VkSurfaceKHR, uint32_t *, VkRect2D *); +static VkResult (*pvkGetPhysicalDeviceSurfaceCapabilities2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *, VkSurfaceCapabilities2KHR *); static VkResult (*pvkGetPhysicalDeviceSurfaceCapabilitiesKHR)(VkPhysicalDevice, VkSurfaceKHR, VkSurfaceCapabilitiesKHR *); +static VkResult (*pvkGetPhysicalDeviceSurfaceFormats2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *, uint32_t *, VkSurfaceFormat2KHR *); static VkResult (*pvkGetPhysicalDeviceSurfaceFormatsKHR)(VkPhysicalDevice, VkSurfaceKHR, uint32_t *, VkSurfaceFormatKHR *); static VkResult (*pvkGetPhysicalDeviceSurfacePresentModesKHR)(VkPhysicalDevice, VkSurfaceKHR, uint32_t *, VkPresentModeKHR *); static VkResult (*pvkGetPhysicalDeviceSurfaceSupportKHR)(VkPhysicalDevice, uint32_t, VkSurfaceKHR, VkBool32 *); @@ -122,7 +124,9 @@ static BOOL WINAPI wine_vk_init(INIT_ONCE *once, void *param, void **context) LOAD_FUNCPTR(vkEnumerateInstanceExtensionProperties) LOAD_FUNCPTR(vkGetDeviceProcAddr) LOAD_FUNCPTR(vkGetInstanceProcAddr) + LOAD_OPTIONAL_FUNCPTR(vkGetPhysicalDeviceSurfaceCapabilities2KHR) LOAD_FUNCPTR(vkGetPhysicalDeviceSurfaceCapabilitiesKHR) + LOAD_OPTIONAL_FUNCPTR(vkGetPhysicalDeviceSurfaceFormats2KHR) LOAD_FUNCPTR(vkGetPhysicalDeviceSurfaceFormatsKHR) LOAD_FUNCPTR(vkGetPhysicalDeviceSurfacePresentModesKHR) LOAD_FUNCPTR(vkGetPhysicalDeviceSurfaceSupportKHR) @@ -456,6 +460,25 @@ static VkResult X11DRV_vkGetPhysicalDevicePresentRectanglesKHR(VkPhysicalDevice return pvkGetPhysicalDevicePresentRectanglesKHR(phys_dev, x11_surface->surface, count, rects); }
+static VkResult X11DRV_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice phys_dev, + const VkPhysicalDeviceSurfaceInfo2KHR *surface_info, VkSurfaceCapabilities2KHR *capabilities) +{ + VkPhysicalDeviceSurfaceInfo2KHR surface_info_host; + TRACE("%p, %p, %p\n", phys_dev, surface_info, capabilities); + + surface_info_host = *surface_info; + surface_info_host.surface = surface_from_handle(surface_info->surface)->surface; + + if (pvkGetPhysicalDeviceSurfaceCapabilities2KHR) + return pvkGetPhysicalDeviceSurfaceCapabilities2KHR(phys_dev, &surface_info_host, capabilities); + + /* Until the loader version exporting this function is common, emulate it using the older non-2 version. */ + if (surface_info->pNext || capabilities->pNext) + FIXME("Emulating vkGetPhysicalDeviceSurfaceCapabilities2KHR with vkGetPhysicalDeviceSurfaceCapabilitiesKHR, pNext is ignored.\n"); + + return pvkGetPhysicalDeviceSurfaceCapabilitiesKHR(phys_dev, surface_info_host.surface, &capabilities->surfaceCapabilities); +} + static VkResult X11DRV_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice phys_dev, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *capabilities) { @@ -466,6 +489,41 @@ static VkResult X11DRV_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevic return pvkGetPhysicalDeviceSurfaceCapabilitiesKHR(phys_dev, x11_surface->surface, capabilities); }
+static VkResult X11DRV_vkGetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice phys_dev, + const VkPhysicalDeviceSurfaceInfo2KHR *surface_info, uint32_t *count, VkSurfaceFormat2KHR *formats) +{ + VkPhysicalDeviceSurfaceInfo2KHR surface_info_host = *surface_info; + VkSurfaceFormatKHR *formats_host; + uint32_t i; + VkResult result; + TRACE("%p, %p, %p, %p\n", phys_dev, surface_info, count, formats); + + surface_info_host = *surface_info; + surface_info_host.surface = surface_from_handle(surface_info->surface)->surface; + + if (pvkGetPhysicalDeviceSurfaceFormats2KHR) + return pvkGetPhysicalDeviceSurfaceFormats2KHR(phys_dev, &surface_info_host, count, formats); + + /* Until the loader version exporting this function is common, emulate it using the older non-2 version. */ + if (surface_info->pNext) + FIXME("Emulating vkGetPhysicalDeviceSurfaceFormats2KHR with vkGetPhysicalDeviceSurfaceFormatsKHR, pNext is ignored.\n"); + + if (!formats) + return pvkGetPhysicalDeviceSurfaceFormatsKHR(phys_dev, surface_info_host.surface, count, NULL); + + formats_host = heap_calloc(*count, sizeof(*formats_host)); + if (!formats_host) return VK_ERROR_OUT_OF_HOST_MEMORY; + result = pvkGetPhysicalDeviceSurfaceFormatsKHR(phys_dev, surface_info_host.surface, count, formats_host); + if (result == VK_SUCCESS || result == VK_INCOMPLETE) + { + for (i = 0; i < *count; i++) + formats[i].surfaceFormat = formats_host[i]; + } + + heap_free(formats_host); + return result; +} + static VkResult X11DRV_vkGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice phys_dev, VkSurfaceKHR surface, uint32_t *count, VkSurfaceFormatKHR *formats) { @@ -557,7 +615,9 @@ static const struct vulkan_funcs vulkan_funcs = X11DRV_vkGetDeviceProcAddr, X11DRV_vkGetInstanceProcAddr, X11DRV_vkGetPhysicalDevicePresentRectanglesKHR, + X11DRV_vkGetPhysicalDeviceSurfaceCapabilities2KHR, X11DRV_vkGetPhysicalDeviceSurfaceCapabilitiesKHR, + X11DRV_vkGetPhysicalDeviceSurfaceFormats2KHR, X11DRV_vkGetPhysicalDeviceSurfaceFormatsKHR, X11DRV_vkGetPhysicalDeviceSurfacePresentModesKHR, X11DRV_vkGetPhysicalDeviceSurfaceSupportKHR, diff --git a/include/wine/vulkan.h b/include/wine/vulkan.h index 257bd0c1b2..712e0473d2 100644 --- a/include/wine/vulkan.h +++ b/include/wine/vulkan.h @@ -200,6 +200,8 @@ #define VK_KHR_PERFORMANCE_QUERY_EXTENSION_NAME "VK_KHR_performance_query" #define VK_KHR_MAINTENANCE2_SPEC_VERSION 1 #define VK_KHR_MAINTENANCE2_EXTENSION_NAME "VK_KHR_maintenance2" +#define VK_KHR_GET_SURFACE_CAPABILITIES_2_SPEC_VERSION 1 +#define VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME "VK_KHR_get_surface_capabilities2" #define VK_KHR_VARIABLE_POINTERS_SPEC_VERSION 1 #define VK_KHR_VARIABLE_POINTERS_EXTENSION_NAME "VK_KHR_variable_pointers" #define VK_EXT_QUEUE_FAMILY_FOREIGN_SPEC_VERSION 1 @@ -2556,6 +2558,9 @@ typedef enum VkStructureType VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO = 1000117001, VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO = 1000117002, VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO = 1000117003, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR = 1000119000, + VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR = 1000119001, + VK_STRUCTURE_TYPE_SURFACE_FORMAT_2_KHR = 1000119002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES = 1000120000, VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS = 1000127000, VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO = 1000127001, @@ -4017,6 +4022,13 @@ typedef struct VkPhysicalDeviceSubgroupSizeControlFeaturesEXT VkBool32 computeFullSubgroups; } VkPhysicalDeviceSubgroupSizeControlFeaturesEXT;
+typedef struct VkPhysicalDeviceSurfaceInfo2KHR +{ + VkStructureType sType; + const void *pNext; + VkSurfaceKHR WINE_VK_ALIGN(8) surface; +} VkPhysicalDeviceSurfaceInfo2KHR; + typedef struct VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT { VkStructureType sType; @@ -4438,6 +4450,12 @@ typedef struct VkSubresourceLayout VkDeviceSize WINE_VK_ALIGN(8) depthPitch; } VkSubresourceLayout;
+typedef struct VkSurfaceFormatKHR +{ + VkFormat format; + VkColorSpaceKHR colorSpace; +} VkSurfaceFormatKHR; + typedef struct VkTextureLODGatherFormatPropertiesAMD { VkStructureType sType; @@ -6044,11 +6062,12 @@ typedef struct VkSubpassSampleLocationsEXT VkSampleLocationsInfoEXT sampleLocationsInfo; } VkSubpassSampleLocationsEXT;
-typedef struct VkSurfaceFormatKHR +typedef struct VkSurfaceFormat2KHR { - VkFormat format; - VkColorSpaceKHR colorSpace; -} VkSurfaceFormatKHR; + VkStructureType sType; + void *pNext; + VkSurfaceFormatKHR surfaceFormat; +} VkSurfaceFormat2KHR;
typedef struct VkVertexInputBindingDescription { @@ -6351,6 +6370,13 @@ typedef struct VkSparseImageFormatProperties2 } VkSparseImageFormatProperties2; typedef VkSparseImageFormatProperties2 VkSparseImageFormatProperties2KHR;
+typedef struct VkSurfaceCapabilities2KHR +{ + VkStructureType sType; + void *pNext; + VkSurfaceCapabilitiesKHR surfaceCapabilities; +} VkSurfaceCapabilities2KHR; + typedef struct VkValidationCacheCreateInfoEXT { VkStructureType sType; @@ -7112,7 +7138,9 @@ typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceSparseImageFormatProperties)(VkP typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceSparseImageFormatProperties2)(VkPhysicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2 *, uint32_t *, VkSparseImageFormatProperties2 *); typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2 *, uint32_t *, VkSparseImageFormatProperties2 *); typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV)(VkPhysicalDevice, uint32_t *, VkFramebufferMixedSamplesCombinationNV *); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *, VkSurfaceCapabilities2KHR *); typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR)(VkPhysicalDevice, VkSurfaceKHR, VkSurfaceCapabilitiesKHR *); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceFormats2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *, uint32_t *, VkSurfaceFormat2KHR *); typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceFormatsKHR)(VkPhysicalDevice, VkSurfaceKHR, uint32_t *, VkSurfaceFormatKHR *); typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfacePresentModesKHR)(VkPhysicalDevice, VkSurfaceKHR, uint32_t *, VkPresentModeKHR *); typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceSupportKHR)(VkPhysicalDevice, uint32_t, VkSurfaceKHR, VkBool32 *); @@ -7413,7 +7441,9 @@ void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2 *pFormatInfo, uint32_t *pPropertyCount, VkSparseImageFormatProperties2 *pProperties); void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2 *pFormatInfo, uint32_t *pPropertyCount, VkSparseImageFormatProperties2 *pProperties); VkResult VKAPI_CALL vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV(VkPhysicalDevice physicalDevice, uint32_t *pCombinationCount, VkFramebufferMixedSamplesCombinationNV *pCombinations); +VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, VkSurfaceCapabilities2KHR *pSurfaceCapabilities); VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfaceCapabilities); +VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, uint32_t *pSurfaceFormatCount, VkSurfaceFormat2KHR *pSurfaceFormats); VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pSurfaceFormatCount, VkSurfaceFormatKHR *pSurfaceFormats); VkResult VKAPI_CALL vkGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pPresentModeCount, VkPresentModeKHR *pPresentModes); VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32 *pSupported); diff --git a/include/wine/vulkan_driver.h b/include/wine/vulkan_driver.h index f8130756d1..90e5dd1804 100644 --- a/include/wine/vulkan_driver.h +++ b/include/wine/vulkan_driver.h @@ -39,7 +39,7 @@ #define __WINE_VULKAN_DRIVER_H
/* Wine internal vulkan driver version, needs to be bumped upon vulkan_funcs changes. */ -#define WINE_VULKAN_DRIVER_VERSION 7 +#define WINE_VULKAN_DRIVER_VERSION 8
struct vulkan_funcs { @@ -58,7 +58,9 @@ struct vulkan_funcs void * (*p_vkGetDeviceProcAddr)(VkDevice, const char *); void * (*p_vkGetInstanceProcAddr)(VkInstance, const char *); VkResult (*p_vkGetPhysicalDevicePresentRectanglesKHR)(VkPhysicalDevice, VkSurfaceKHR, uint32_t *, VkRect2D *); + VkResult (*p_vkGetPhysicalDeviceSurfaceCapabilities2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *, VkSurfaceCapabilities2KHR *); VkResult (*p_vkGetPhysicalDeviceSurfaceCapabilitiesKHR)(VkPhysicalDevice, VkSurfaceKHR, VkSurfaceCapabilitiesKHR *); + VkResult (*p_vkGetPhysicalDeviceSurfaceFormats2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *, uint32_t *, VkSurfaceFormat2KHR *); VkResult (*p_vkGetPhysicalDeviceSurfaceFormatsKHR)(VkPhysicalDevice, VkSurfaceKHR, uint32_t *, VkSurfaceFormatKHR *); VkResult (*p_vkGetPhysicalDeviceSurfacePresentModesKHR)(VkPhysicalDevice, VkSurfaceKHR, uint32_t *, VkPresentModeKHR *); VkResult (*p_vkGetPhysicalDeviceSurfaceSupportKHR)(VkPhysicalDevice, uint32_t, VkSurfaceKHR, VkBool32 *); @@ -116,8 +118,12 @@ static inline void *get_vulkan_driver_instance_proc_addr( return vulkan_funcs->p_vkGetInstanceProcAddr; if (!strcmp(name, "GetPhysicalDevicePresentRectanglesKHR")) return vulkan_funcs->p_vkGetPhysicalDevicePresentRectanglesKHR; + if (!strcmp(name, "GetPhysicalDeviceSurfaceCapabilities2KHR")) + return vulkan_funcs->p_vkGetPhysicalDeviceSurfaceCapabilities2KHR; if (!strcmp(name, "GetPhysicalDeviceSurfaceCapabilitiesKHR")) return vulkan_funcs->p_vkGetPhysicalDeviceSurfaceCapabilitiesKHR; + if (!strcmp(name, "GetPhysicalDeviceSurfaceFormats2KHR")) + return vulkan_funcs->p_vkGetPhysicalDeviceSurfaceFormats2KHR; if (!strcmp(name, "GetPhysicalDeviceSurfaceFormatsKHR")) return vulkan_funcs->p_vkGetPhysicalDeviceSurfaceFormatsKHR; if (!strcmp(name, "GetPhysicalDeviceSurfacePresentModesKHR"))