From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/vulkan.c | 170 ++++++++++++++ dlls/winevulkan/loader_thunks.c | 27 +++ dlls/winevulkan/loader_thunks.h | 19 ++ dlls/winevulkan/make_vulkan | 20 +- dlls/winevulkan/vulkan_thunks.c | 379 ++++++++++++++++++++++++++++++-- dlls/winevulkan/vulkan_thunks.h | 4 - include/wine/vulkan.h | 2 + include/wine/vulkan_driver.h | 9 + 8 files changed, 603 insertions(+), 27 deletions(-)
diff --git a/dlls/win32u/vulkan.c b/dlls/win32u/vulkan.c index a893d5d10d9..3bc08d17ae8 100644 --- a/dlls/win32u/vulkan.c +++ b/dlls/win32u/vulkan.c @@ -46,6 +46,13 @@ WINE_DECLARE_DEBUG_CHANNEL(fps);
static const struct vulkan_driver_funcs *driver_funcs;
+static const UINT EXTERNAL_MEMORY_WIN32_BITS = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT | + VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT | + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT | + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT | + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT | + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT; + struct device_memory { struct vulkan_device_memory obj; @@ -158,6 +165,7 @@ static VkResult win32u_vkAllocateMemory( VkDevice client_device, const VkMemoryA struct vulkan_physical_device *physical_device = device->physical_device; struct vulkan_instance *instance = device->physical_device->instance; VkImportMemoryHostPointerInfoEXT host_pointer_info, *pointer_info = NULL; + VkExportMemoryAllocateInfo *export_info = NULL; VkDeviceMemory host_device_memory; struct device_memory *memory; uint32_t mem_flags; @@ -170,12 +178,23 @@ static VkResult win32u_vkAllocateMemory( VkDevice client_device, const VkMemoryA { case VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV: break; case VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO: + export_info = (VkExportMemoryAllocateInfo *)*next; + if (!(export_info->handleTypes & EXTERNAL_MEMORY_WIN32_BITS)) + FIXME( "Unsupported handle types %#x\n", export_info->handleTypes ); FIXME( "VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO not implemented!\n" ); *next = (*next)->pNext; next = &prev; break; + case VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_KHR: + FIXME( "VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_KHR not implemented!\n" ); + *next = (*next)->pNext; next = &prev; + break; case VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT: pointer_info = (VkImportMemoryHostPointerInfoEXT *)*next; break; + case VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR: + FIXME( "VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR not implemented!\n" ); + *next = (*next)->pNext; next = &prev; + break; case VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO: break; case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO: break; case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_TENSOR_ARM: break; @@ -240,6 +259,25 @@ static void win32u_vkFreeMemory( VkDevice client_device, VkDeviceMemory client_m free( memory ); }
+static VkResult win32u_vkGetMemoryWin32HandleKHR( VkDevice client_device, const VkMemoryGetWin32HandleInfoKHR *handle_info, HANDLE *handle ) +{ + struct vulkan_device *device = vulkan_device_from_handle( client_device ); + + FIXME( "device %p, handle_info %p, handle %p stub!\n", device, handle_info, handle ); + + return VK_ERROR_INCOMPATIBLE_DRIVER; +} + +static VkResult win32u_vkGetMemoryWin32HandlePropertiesKHR( VkDevice client_device, VkExternalMemoryHandleTypeFlagBits handle_type, HANDLE handle, + VkMemoryWin32HandlePropertiesKHR *handle_properties ) +{ + struct vulkan_device *device = vulkan_device_from_handle( client_device ); + + FIXME( "device %p, handle_type %#x, handle %p, handle_properties %p stub!\n", device, handle_type, handle, handle_properties ); + + return VK_ERROR_INCOMPATIBLE_DRIVER; +} + static VkResult win32u_vkMapMemory2KHR( VkDevice client_device, const VkMemoryMapInfoKHR *map_info, void **data ) { struct vulkan_device *device = vulkan_device_from_handle( client_device ); @@ -389,6 +427,8 @@ static VkResult win32u_vkCreateBuffer( VkDevice client_device, const VkBufferCre case VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV: break; case VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO: external_info = (VkExternalMemoryBufferCreateInfo *)*next; + if (!(external_info->handleTypes & EXTERNAL_MEMORY_WIN32_BITS)) + FIXME( "Unsupported handle types %#x\n", external_info->handleTypes ); FIXME( "VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO not implemented!\n" ); *next = (*next)->pNext; next = &prev; break; @@ -409,6 +449,55 @@ static VkResult win32u_vkCreateBuffer( VkDevice client_device, const VkBufferCre return device->p_vkCreateBuffer( device->host.device, create_info, NULL, buffer ); }
+static void win32u_vkGetDeviceBufferMemoryRequirements( VkDevice client_device, const VkDeviceBufferMemoryRequirements *buffer_requirements, + VkMemoryRequirements2 *memory_requirements ) +{ + VkBaseOutStructure **next, *prev = (VkBaseOutStructure *)buffer_requirements->pCreateInfo; /* cast away const, chain has been copied in the thunks */ + struct vulkan_device *device = vulkan_device_from_handle( client_device ); + VkExternalMemoryBufferCreateInfo *external_info; + + TRACE( "device %p, buffer_requirements %p, memory_requirements %p\n", device, buffer_requirements, memory_requirements ); + + for (next = &prev->pNext; *next; prev = *next, next = &(*next)->pNext) + { + switch ((*next)->sType) + { + case VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_CREATE_INFO_EXT: break; + case VK_STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO: break; + case VK_STRUCTURE_TYPE_BUFFER_USAGE_FLAGS_2_CREATE_INFO: break; + case VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV: break; + case VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO: + external_info = (VkExternalMemoryBufferCreateInfo *)*next; + if (!(external_info->handleTypes & EXTERNAL_MEMORY_WIN32_BITS)) + FIXME( "Unsupported handle types %#x\n", external_info->handleTypes ); + FIXME( "VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO not implemented!\n" ); + *next = (*next)->pNext; next = &prev; + break; + case VK_STRUCTURE_TYPE_OPAQUE_CAPTURE_DESCRIPTOR_DATA_CREATE_INFO_EXT: break; + case VK_STRUCTURE_TYPE_VIDEO_PROFILE_LIST_INFO_KHR: break; + default: FIXME( "Unhandled sType %u.\n", (*next)->sType ); break; + } + } + + device->p_vkGetDeviceBufferMemoryRequirements( device->host.device, buffer_requirements, memory_requirements ); +} + +static void win32u_vkGetPhysicalDeviceExternalBufferProperties( VkPhysicalDevice client_physical_device, const VkPhysicalDeviceExternalBufferInfo *buffer_info, + VkExternalBufferProperties *buffer_properies ) +{ + struct vulkan_physical_device *physical_device = vulkan_physical_device_from_handle( client_physical_device ); + struct vulkan_instance *instance = physical_device->instance; + + TRACE( "physical_device %p, buffer_info %p, buffer_properies %p\n", physical_device, buffer_info, buffer_properies ); + + if (!(buffer_info->handleType & EXTERNAL_MEMORY_WIN32_BITS)) + FIXME( "Unsupported handle type %#x\n", buffer_info->handleType ); + FIXME( "VkPhysicalDeviceExternalBufferInfo Win32 handleType not implemented!\n" ); + ((VkPhysicalDeviceExternalBufferInfo *)buffer_info)->handleType = 0; /* cast away const, it has been copied in the thunks */ + + return instance->p_vkGetPhysicalDeviceExternalBufferProperties( physical_device->host.physical_device, buffer_info, buffer_properies ); +} + static VkResult win32u_vkCreateImage( VkDevice client_device, const VkImageCreateInfo *create_info, const VkAllocationCallbacks *allocator, VkImage *image ) { @@ -424,6 +513,8 @@ static VkResult win32u_vkCreateImage( VkDevice client_device, const VkImageCreat case VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV: break; case VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO: external_info = (VkExternalMemoryImageCreateInfo *)*next; + if (!(external_info->handleTypes & EXTERNAL_MEMORY_WIN32_BITS)) + FIXME( "Unsupported handle types %#x\n", external_info->handleTypes ); FIXME( "VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO not implemented!\n" ); *next = (*next)->pNext; next = &prev; break; @@ -450,6 +541,76 @@ static VkResult win32u_vkCreateImage( VkDevice client_device, const VkImageCreat return device->p_vkCreateImage( device->host.device, create_info, NULL, image ); }
+static void win32u_vkGetDeviceImageMemoryRequirements( VkDevice client_device, const VkDeviceImageMemoryRequirements *image_requirements, + VkMemoryRequirements2 *memory_requirements ) +{ + VkBaseOutStructure **next, *prev = (VkBaseOutStructure *)image_requirements->pCreateInfo; /* cast away const, chain has been copied in the thunks */ + struct vulkan_device *device = vulkan_device_from_handle( client_device ); + VkExternalMemoryImageCreateInfo *external_info; + + TRACE( "device %p, image_requirements %p, memory_requirements %p\n", device, image_requirements, memory_requirements ); + + for (next = &prev->pNext; *next; prev = *next, next = &(*next)->pNext) + { + switch ((*next)->sType) + { + case VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV: break; + case VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO: + external_info = (VkExternalMemoryImageCreateInfo *)*next; + if (!(external_info->handleTypes & EXTERNAL_MEMORY_WIN32_BITS)) + FIXME( "Unsupported handle types %#x\n", external_info->handleTypes ); + FIXME( "VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO not implemented!\n" ); + *next = (*next)->pNext; next = &prev; + break; + case VK_STRUCTURE_TYPE_IMAGE_ALIGNMENT_CONTROL_CREATE_INFO_MESA: break; + case VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_CONTROL_EXT: break; + case VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO: break; + case VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO: break; + case VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHR: break; + case VK_STRUCTURE_TYPE_OPAQUE_CAPTURE_DESCRIPTOR_DATA_CREATE_INFO_EXT: break; + case VK_STRUCTURE_TYPE_OPTICAL_FLOW_IMAGE_FORMAT_INFO_NV: break; + case VK_STRUCTURE_TYPE_VIDEO_PROFILE_LIST_INFO_KHR: break; + default: FIXME( "Unhandled sType %u.\n", (*next)->sType ); break; + } + } + + device->p_vkGetDeviceImageMemoryRequirements( device->host.device, image_requirements, memory_requirements ); +} + +static VkResult win32u_vkGetPhysicalDeviceImageFormatProperties2( VkPhysicalDevice client_physical_device, const VkPhysicalDeviceImageFormatInfo2 *format_info, + VkImageFormatProperties2 *format_properies ) +{ + VkBaseOutStructure **next, *prev = (VkBaseOutStructure *)format_info; /* cast away const, chain has been copied in the thunks */ + struct vulkan_physical_device *physical_device = vulkan_physical_device_from_handle( client_physical_device ); + struct vulkan_instance *instance = physical_device->instance; + VkPhysicalDeviceExternalImageFormatInfo *external_info; + + TRACE( "physical_device %p, format_info %p, format_properies %p\n", physical_device, format_info, format_properies ); + + for (next = &prev->pNext; *next; prev = *next, next = &(*next)->pNext) + { + switch ((*next)->sType) + { + case VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_CONTROL_EXT: break; + case VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO: break; + case VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO: break; + case VK_STRUCTURE_TYPE_OPTICAL_FLOW_IMAGE_FORMAT_INFO_NV: break; + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO: + external_info = (VkPhysicalDeviceExternalImageFormatInfo *)*next; + if (!(external_info->handleType & EXTERNAL_MEMORY_WIN32_BITS)) + FIXME( "Unsupported handle type %#x\n", external_info->handleType ); + FIXME( "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO not implemented!\n" ); + *next = (*next)->pNext; next = &prev; + break; + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_IMAGE_FORMAT_INFO_EXT: break; + case VK_STRUCTURE_TYPE_VIDEO_PROFILE_LIST_INFO_KHR: break; + default: FIXME( "Unhandled sType %u.\n", (*next)->sType ); break; + } + } + + return instance->p_vkGetPhysicalDeviceImageFormatProperties2( physical_device->host.physical_device, format_info, format_properies ); +} + static VkResult win32u_vkCreateWin32SurfaceKHR( VkInstance client_instance, const VkWin32SurfaceCreateInfoKHR *create_info, const VkAllocationCallbacks *allocator, VkSurfaceKHR *ret ) { @@ -871,6 +1032,15 @@ static struct vulkan_funcs vulkan_funcs = .p_vkDestroySurfaceKHR = win32u_vkDestroySurfaceKHR, .p_vkDestroySwapchainKHR = win32u_vkDestroySwapchainKHR, .p_vkFreeMemory = win32u_vkFreeMemory, + .p_vkGetDeviceBufferMemoryRequirements = win32u_vkGetDeviceBufferMemoryRequirements, + .p_vkGetDeviceBufferMemoryRequirementsKHR = win32u_vkGetDeviceBufferMemoryRequirements, + .p_vkGetDeviceImageMemoryRequirements = win32u_vkGetDeviceImageMemoryRequirements, + .p_vkGetMemoryWin32HandleKHR = win32u_vkGetMemoryWin32HandleKHR, + .p_vkGetMemoryWin32HandlePropertiesKHR = win32u_vkGetMemoryWin32HandlePropertiesKHR, + .p_vkGetPhysicalDeviceExternalBufferProperties = win32u_vkGetPhysicalDeviceExternalBufferProperties, + .p_vkGetPhysicalDeviceExternalBufferPropertiesKHR = win32u_vkGetPhysicalDeviceExternalBufferProperties, + .p_vkGetPhysicalDeviceImageFormatProperties2 = win32u_vkGetPhysicalDeviceImageFormatProperties2, + .p_vkGetPhysicalDeviceImageFormatProperties2KHR = win32u_vkGetPhysicalDeviceImageFormatProperties2, .p_vkGetPhysicalDevicePresentRectanglesKHR = win32u_vkGetPhysicalDevicePresentRectanglesKHR, .p_vkGetPhysicalDeviceSurfaceCapabilities2KHR = win32u_vkGetPhysicalDeviceSurfaceCapabilities2KHR, .p_vkGetPhysicalDeviceSurfaceCapabilitiesKHR = win32u_vkGetPhysicalDeviceSurfaceCapabilitiesKHR, diff --git a/dlls/winevulkan/loader_thunks.c b/dlls/winevulkan/loader_thunks.c index e932ec46476..3da89090ee8 100644 --- a/dlls/winevulkan/loader_thunks.c +++ b/dlls/winevulkan/loader_thunks.c @@ -5233,6 +5233,31 @@ VkResult WINAPI vkGetMemoryHostPointerPropertiesEXT(VkDevice device, VkExternalM return params.result; }
+VkResult WINAPI vkGetMemoryWin32HandleKHR(VkDevice device, const VkMemoryGetWin32HandleInfoKHR *pGetWin32HandleInfo, HANDLE *pHandle) +{ + struct vkGetMemoryWin32HandleKHR_params params; + NTSTATUS status; + params.device = device; + params.pGetWin32HandleInfo = pGetWin32HandleInfo; + params.pHandle = pHandle; + status = UNIX_CALL(vkGetMemoryWin32HandleKHR, ¶ms); + assert(!status && "vkGetMemoryWin32HandleKHR"); + return params.result; +} + +VkResult WINAPI vkGetMemoryWin32HandlePropertiesKHR(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, HANDLE handle, VkMemoryWin32HandlePropertiesKHR *pMemoryWin32HandleProperties) +{ + struct vkGetMemoryWin32HandlePropertiesKHR_params params; + NTSTATUS status; + params.device = device; + params.handleType = handleType; + params.handle = handle; + params.pMemoryWin32HandleProperties = pMemoryWin32HandleProperties; + status = UNIX_CALL(vkGetMemoryWin32HandlePropertiesKHR, ¶ms); + assert(!status && "vkGetMemoryWin32HandlePropertiesKHR"); + return params.result; +} + void WINAPI vkGetMicromapBuildSizesEXT(VkDevice device, VkAccelerationStructureBuildTypeKHR buildType, const VkMicromapBuildInfoEXT *pBuildInfo, VkMicromapBuildSizesInfoEXT *pSizeInfo) { struct vkGetMicromapBuildSizesEXT_params params; @@ -7544,6 +7569,8 @@ static const struct vulkan_func vk_device_dispatch_table[] = {"vkGetImageViewOpaqueCaptureDescriptorDataEXT", vkGetImageViewOpaqueCaptureDescriptorDataEXT}, {"vkGetLatencyTimingsNV", vkGetLatencyTimingsNV}, {"vkGetMemoryHostPointerPropertiesEXT", vkGetMemoryHostPointerPropertiesEXT}, + {"vkGetMemoryWin32HandleKHR", vkGetMemoryWin32HandleKHR}, + {"vkGetMemoryWin32HandlePropertiesKHR", vkGetMemoryWin32HandlePropertiesKHR}, {"vkGetMicromapBuildSizesEXT", vkGetMicromapBuildSizesEXT}, {"vkGetPartitionedAccelerationStructuresBuildSizesNV", vkGetPartitionedAccelerationStructuresBuildSizesNV}, {"vkGetPerformanceParameterINTEL", vkGetPerformanceParameterINTEL}, diff --git a/dlls/winevulkan/loader_thunks.h b/dlls/winevulkan/loader_thunks.h index 7bf58a83988..ebfc3dce3a8 100644 --- a/dlls/winevulkan/loader_thunks.h +++ b/dlls/winevulkan/loader_thunks.h @@ -526,6 +526,8 @@ enum unix_call unix_vkGetImageViewOpaqueCaptureDescriptorDataEXT, unix_vkGetLatencyTimingsNV, unix_vkGetMemoryHostPointerPropertiesEXT, + unix_vkGetMemoryWin32HandleKHR, + unix_vkGetMemoryWin32HandlePropertiesKHR, unix_vkGetMicromapBuildSizesEXT, unix_vkGetPartitionedAccelerationStructuresBuildSizesNV, unix_vkGetPerformanceParameterINTEL, @@ -4542,6 +4544,23 @@ struct vkGetMemoryHostPointerPropertiesEXT_params VkResult result; };
+struct vkGetMemoryWin32HandleKHR_params +{ + VkDevice device; + const VkMemoryGetWin32HandleInfoKHR *pGetWin32HandleInfo; + HANDLE *pHandle; + VkResult result; +}; + +struct vkGetMemoryWin32HandlePropertiesKHR_params +{ + VkDevice device; + VkExternalMemoryHandleTypeFlagBits handleType; + HANDLE handle; + VkMemoryWin32HandlePropertiesKHR *pMemoryWin32HandleProperties; + VkResult result; +}; + struct vkGetMicromapBuildSizesEXT_params { VkDevice device; diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index d15e40f01cf..83ec38fd520 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -127,7 +127,6 @@ UNSUPPORTED_EXTENSIONS = [ # but not expose to applications (useful for test commits) UNEXPOSED_EXTENSIONS = { "VK_EXT_map_memory_placed", - "VK_KHR_external_memory_win32", "VK_EXT_headless_surface", # Extensions for other platforms "VK_EXT_external_memory_dma_buf", @@ -191,7 +190,6 @@ FUNCTION_OVERRIDES = {
# Instance functions "vkCreateDevice" : {"extra_param" : "client_ptr"}, - "vkGetPhysicalDeviceExternalBufferProperties" : {"dispatch" : False}, "vkGetPhysicalDeviceExternalFenceProperties" : {"dispatch" : False}, "vkGetPhysicalDeviceExternalSemaphoreProperties" : {"dispatch" : False},
@@ -202,9 +200,6 @@ FUNCTION_OVERRIDES = { # VK_KHR_external_fence_capabilities "vkGetPhysicalDeviceExternalFencePropertiesKHR" : {"dispatch" : False},
- # VK_KHR_external_memory_capabilities - "vkGetPhysicalDeviceExternalBufferPropertiesKHR" : {"dispatch" : False}, - # VK_KHR_external_semaphore_capabilities "vkGetPhysicalDeviceExternalSemaphorePropertiesKHR" : {"dispatch" : False}, } @@ -221,8 +216,17 @@ USER_DRIVER_FUNCS = { "vkDestroySurfaceKHR", "vkDestroySwapchainKHR", "vkFreeMemory", + "vkGetDeviceBufferMemoryRequirements", + "vkGetDeviceBufferMemoryRequirementsKHR", + "vkGetDeviceImageMemoryRequirements", "vkGetDeviceProcAddr", "vkGetInstanceProcAddr", + "vkGetMemoryWin32HandleKHR", + "vkGetMemoryWin32HandlePropertiesKHR", + "vkGetPhysicalDeviceExternalBufferProperties", + "vkGetPhysicalDeviceExternalBufferPropertiesKHR", + "vkGetPhysicalDeviceImageFormatProperties2", + "vkGetPhysicalDeviceImageFormatProperties2KHR", "vkGetPhysicalDevicePresentRectanglesKHR", "vkGetPhysicalDeviceSurfaceCapabilities2KHR", "vkGetPhysicalDeviceSurfaceCapabilitiesKHR", @@ -268,14 +272,10 @@ MANUAL_UNIX_THUNKS = { "vkGetInstanceProcAddr", "vkGetPhysicalDeviceCalibrateableTimeDomainsEXT", "vkGetPhysicalDeviceCalibrateableTimeDomainsKHR", - "vkGetPhysicalDeviceExternalBufferProperties", - "vkGetPhysicalDeviceExternalBufferPropertiesKHR", "vkGetPhysicalDeviceExternalFenceProperties", "vkGetPhysicalDeviceExternalFencePropertiesKHR", "vkGetPhysicalDeviceExternalSemaphoreProperties", "vkGetPhysicalDeviceExternalSemaphorePropertiesKHR", - "vkGetPhysicalDeviceImageFormatProperties2", - "vkGetPhysicalDeviceImageFormatProperties2KHR", }
# loader functions which are entirely manually implemented @@ -306,6 +306,8 @@ STRUCT_CHAIN_CONVERSIONS = { "VkMemoryAllocateInfo": {}, "VkBufferCreateInfo": {}, "VkImageCreateInfo": {}, + "VkPhysicalDeviceExternalBufferInfo": {}, + "VkPhysicalDeviceImageFormatInfo2": {},
# Ignore to not confuse host loader. "VkDeviceCreateInfo": {"strip": ["VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO"]}, diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c index 99f247f4e46..816da31f22c 100644 --- a/dlls/winevulkan/vulkan_thunks.c +++ b/dlls/winevulkan/vulkan_thunks.c @@ -3102,6 +3102,15 @@ typedef struct VkExportMemoryAllocateInfo32 } VkExportMemoryAllocateInfo32; typedef VkExportMemoryAllocateInfo32 VkExportMemoryAllocateInfoKHR32;
+typedef struct VkExportMemoryWin32HandleInfoKHR32 +{ + VkStructureType sType; + PTR32 pNext; + PTR32 pAttributes; + DWORD dwAccess; + LPCWSTR name; +} VkExportMemoryWin32HandleInfoKHR32; + typedef struct VkExportSemaphoreCreateInfo32 { VkStructureType sType; @@ -3623,6 +3632,15 @@ typedef struct VkImportMemoryHostPointerInfoEXT32 PTR32 pHostPointer; } VkImportMemoryHostPointerInfoEXT32;
+typedef struct VkImportMemoryWin32HandleInfoKHR32 +{ + VkStructureType sType; + PTR32 pNext; + VkExternalMemoryHandleTypeFlagBits handleType; + HANDLE handle; + LPCWSTR name; +} VkImportMemoryWin32HandleInfoKHR32; + typedef struct VkIndirectCommandsLayoutCreateInfoEXT32 { VkStructureType sType; @@ -3781,6 +3799,14 @@ typedef struct VkMemoryDedicatedRequirements32 } VkMemoryDedicatedRequirements32; typedef VkMemoryDedicatedRequirements32 VkMemoryDedicatedRequirementsKHR32;
+typedef struct VkMemoryGetWin32HandleInfoKHR32 +{ + VkStructureType sType; + PTR32 pNext; + VkDeviceMemory DECLSPEC_ALIGN(8) memory; + VkExternalMemoryHandleTypeFlagBits handleType; +} VkMemoryGetWin32HandleInfoKHR32; + typedef struct VkMemoryHostPointerPropertiesEXT32 { VkStructureType sType; @@ -3832,6 +3858,13 @@ typedef struct VkMemoryUnmapInfo32 } VkMemoryUnmapInfo32; typedef VkMemoryUnmapInfo32 VkMemoryUnmapInfoKHR32;
+typedef struct VkMemoryWin32HandlePropertiesKHR32 +{ + VkStructureType sType; + PTR32 pNext; + uint32_t memoryTypeBits; +} VkMemoryWin32HandlePropertiesKHR32; + typedef struct VkMicromapBuildInfoEXT32 { VkStructureType sType; @@ -9658,6 +9691,19 @@ static void convert_VkMemoryAllocateInfo_win64_to_host(struct conversion_context out_header = (void *)out_ext; break; } + case VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_KHR: + { + VkExportMemoryWin32HandleInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); + const VkExportMemoryWin32HandleInfoKHR *in_ext = (const VkExportMemoryWin32HandleInfoKHR *)in_header; + out_ext->sType = VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_KHR; + out_ext->pNext = NULL; + out_ext->pAttributes = in_ext->pAttributes; + out_ext->dwAccess = in_ext->dwAccess; + out_ext->name = in_ext->name; + out_header->pNext = (void *)out_ext; + out_header = (void *)out_ext; + break; + } case VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT: { VkImportMemoryHostPointerInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); @@ -9670,6 +9716,19 @@ static void convert_VkMemoryAllocateInfo_win64_to_host(struct conversion_context out_header = (void *)out_ext; break; } + case VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR: + { + VkImportMemoryWin32HandleInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); + const VkImportMemoryWin32HandleInfoKHR *in_ext = (const VkImportMemoryWin32HandleInfoKHR *)in_header; + out_ext->sType = VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR; + out_ext->pNext = NULL; + out_ext->handleType = in_ext->handleType; + out_ext->handle = in_ext->handle; + out_ext->name = in_ext->name; + out_header->pNext = (void *)out_ext; + out_header = (void *)out_ext; + break; + } case VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO: { VkMemoryAllocateFlagsInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); @@ -9774,6 +9833,19 @@ static void convert_VkMemoryAllocateInfo_win32_to_host(struct conversion_context out_header = (void *)out_ext; break; } + case VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_KHR: + { + VkExportMemoryWin32HandleInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); + const VkExportMemoryWin32HandleInfoKHR32 *in_ext = (const VkExportMemoryWin32HandleInfoKHR32 *)in_header; + out_ext->sType = VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_KHR; + out_ext->pNext = NULL; + out_ext->pAttributes = UlongToPtr(in_ext->pAttributes); + out_ext->dwAccess = in_ext->dwAccess; + out_ext->name = in_ext->name; + out_header->pNext = (void *)out_ext; + out_header = (void *)out_ext; + break; + } case VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT: { VkImportMemoryHostPointerInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); @@ -9786,6 +9858,19 @@ static void convert_VkMemoryAllocateInfo_win32_to_host(struct conversion_context out_header = (void *)out_ext; break; } + case VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR: + { + VkImportMemoryWin32HandleInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); + const VkImportMemoryWin32HandleInfoKHR32 *in_ext = (const VkImportMemoryWin32HandleInfoKHR32 *)in_header; + out_ext->sType = VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR; + out_ext->pNext = NULL; + out_ext->handleType = in_ext->handleType; + out_ext->handle = in_ext->handle; + out_ext->name = in_ext->name; + out_header->pNext = (void *)out_ext; + out_header = (void *)out_ext; + break; + } case VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO: { VkMemoryAllocateFlagsInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); @@ -28435,6 +28520,35 @@ static void convert_VkMemoryHostPointerPropertiesEXT_host_to_win32(const VkMemor out->memoryTypeBits = in->memoryTypeBits; }
+static void convert_VkMemoryGetWin32HandleInfoKHR_win32_to_unwrapped_host(const VkMemoryGetWin32HandleInfoKHR32 *in, VkMemoryGetWin32HandleInfoKHR *out) +{ + if (!in) return; + + out->sType = in->sType; + out->pNext = NULL; + out->memory = in->memory; + out->handleType = in->handleType; + if (in->pNext) + FIXME("Unexpected pNext\n"); +} + +static void convert_VkMemoryWin32HandlePropertiesKHR_win32_to_host(const VkMemoryWin32HandlePropertiesKHR32 *in, VkMemoryWin32HandlePropertiesKHR *out) +{ + if (!in) return; + + out->sType = in->sType; + out->pNext = NULL; + if (in->pNext) + FIXME("Unexpected pNext\n"); +} + +static void convert_VkMemoryWin32HandlePropertiesKHR_host_to_win32(const VkMemoryWin32HandlePropertiesKHR *in, VkMemoryWin32HandlePropertiesKHR32 *out) +{ + if (!in) return; + + out->memoryTypeBits = in->memoryTypeBits; +} + static void convert_VkMicromapBuildSizesInfoEXT_win32_to_host(const VkMicromapBuildSizesInfoEXT32 *in, VkMicromapBuildSizesInfoEXT *out) { if (!in) return; @@ -28700,6 +28814,43 @@ static void convert_VkCooperativeVectorPropertiesNV_array_host_to_win32(const Vk } }
+#ifdef _WIN64 +static void convert_VkPhysicalDeviceExternalBufferInfo_win64_to_host(struct conversion_context *ctx, const VkPhysicalDeviceExternalBufferInfo *in, VkPhysicalDeviceExternalBufferInfo *out) +{ + const VkBaseInStructure *in_header; + VkBaseOutStructure *out_header = (void *)out; + + if (!in) return; + + out->sType = in->sType; + out->pNext = NULL; + out->flags = in->flags; + out->usage = in->usage; + out->handleType = in->handleType; + + for (in_header = (void *)in->pNext; in_header; in_header = (void *)in_header->pNext) + { + switch (in_header->sType) + { + case VK_STRUCTURE_TYPE_BUFFER_USAGE_FLAGS_2_CREATE_INFO: + { + VkBufferUsageFlags2CreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); + const VkBufferUsageFlags2CreateInfo *in_ext = (const VkBufferUsageFlags2CreateInfo *)in_header; + out_ext->sType = VK_STRUCTURE_TYPE_BUFFER_USAGE_FLAGS_2_CREATE_INFO; + out_ext->pNext = NULL; + out_ext->usage = in_ext->usage; + out_header->pNext = (void *)out_ext; + out_header = (void *)out_ext; + break; + } + default: + FIXME("Unhandled sType %u.\n", in_header->sType); + break; + } + } +} +#endif /* _WIN64 */ + static void convert_VkPhysicalDeviceExternalBufferInfo_win32_to_host(struct conversion_context *ctx, const VkPhysicalDeviceExternalBufferInfo32 *in, VkPhysicalDeviceExternalBufferInfo *out) { const VkBaseInStructure32 *in_header; @@ -33979,6 +34130,115 @@ static void convert_VkImageFormatProperties_host_to_win32(const VkImageFormatPro out->maxResourceSize = in->maxResourceSize; }
+#ifdef _WIN64 +static void convert_VkPhysicalDeviceImageFormatInfo2_win64_to_host(struct conversion_context *ctx, const VkPhysicalDeviceImageFormatInfo2 *in, VkPhysicalDeviceImageFormatInfo2 *out) +{ + const VkBaseInStructure *in_header; + VkBaseOutStructure *out_header = (void *)out; + + if (!in) return; + + out->sType = in->sType; + out->pNext = NULL; + out->format = in->format; + out->type = in->type; + out->tiling = in->tiling; + out->usage = in->usage; + out->flags = in->flags; + + for (in_header = (void *)in->pNext; in_header; in_header = (void *)in_header->pNext) + { + switch (in_header->sType) + { + case VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_CONTROL_EXT: + { + VkImageCompressionControlEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); + const VkImageCompressionControlEXT *in_ext = (const VkImageCompressionControlEXT *)in_header; + out_ext->sType = VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_CONTROL_EXT; + out_ext->pNext = NULL; + out_ext->flags = in_ext->flags; + out_ext->compressionControlPlaneCount = in_ext->compressionControlPlaneCount; + out_ext->pFixedRateFlags = in_ext->pFixedRateFlags; + out_header->pNext = (void *)out_ext; + out_header = (void *)out_ext; + break; + } + case VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO: + { + VkImageFormatListCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); + const VkImageFormatListCreateInfo *in_ext = (const VkImageFormatListCreateInfo *)in_header; + out_ext->sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO; + out_ext->pNext = NULL; + out_ext->viewFormatCount = in_ext->viewFormatCount; + out_ext->pViewFormats = in_ext->pViewFormats; + out_header->pNext = (void *)out_ext; + out_header = (void *)out_ext; + break; + } + case VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO: + { + VkImageStencilUsageCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); + const VkImageStencilUsageCreateInfo *in_ext = (const VkImageStencilUsageCreateInfo *)in_header; + out_ext->sType = VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO; + out_ext->pNext = NULL; + out_ext->stencilUsage = in_ext->stencilUsage; + out_header->pNext = (void *)out_ext; + out_header = (void *)out_ext; + break; + } + case VK_STRUCTURE_TYPE_OPTICAL_FLOW_IMAGE_FORMAT_INFO_NV: + { + VkOpticalFlowImageFormatInfoNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); + const VkOpticalFlowImageFormatInfoNV *in_ext = (const VkOpticalFlowImageFormatInfoNV *)in_header; + out_ext->sType = VK_STRUCTURE_TYPE_OPTICAL_FLOW_IMAGE_FORMAT_INFO_NV; + out_ext->pNext = NULL; + out_ext->usage = in_ext->usage; + out_header->pNext = (void *)out_ext; + out_header = (void *)out_ext; + break; + } + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO: + { + VkPhysicalDeviceExternalImageFormatInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); + const VkPhysicalDeviceExternalImageFormatInfo *in_ext = (const VkPhysicalDeviceExternalImageFormatInfo *)in_header; + out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO; + out_ext->pNext = NULL; + out_ext->handleType = in_ext->handleType; + out_header->pNext = (void *)out_ext; + out_header = (void *)out_ext; + break; + } + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_IMAGE_FORMAT_INFO_EXT: + { + VkPhysicalDeviceImageViewImageFormatInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); + const VkPhysicalDeviceImageViewImageFormatInfoEXT *in_ext = (const VkPhysicalDeviceImageViewImageFormatInfoEXT *)in_header; + out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_IMAGE_FORMAT_INFO_EXT; + out_ext->pNext = NULL; + out_ext->imageViewType = in_ext->imageViewType; + out_header->pNext = (void *)out_ext; + out_header = (void *)out_ext; + break; + } + case VK_STRUCTURE_TYPE_VIDEO_PROFILE_LIST_INFO_KHR: + { + VkVideoProfileListInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); + const VkVideoProfileListInfoKHR *in_ext = (const VkVideoProfileListInfoKHR *)in_header; + out_ext->sType = VK_STRUCTURE_TYPE_VIDEO_PROFILE_LIST_INFO_KHR; + out_ext->pNext = NULL; + out_ext->profileCount = in_ext->profileCount; + out_ext->pProfiles = in_ext->pProfiles; + out_header->pNext = (void *)out_ext; + out_header = (void *)out_ext; + break; + } + default: + FIXME("Unhandled sType %u.\n", in_header->sType); + break; + } + } +} +#endif /* _WIN64 */ + static void convert_VkPhysicalDeviceImageFormatInfo2_win32_to_host(struct conversion_context *ctx, const VkPhysicalDeviceImageFormatInfo232 *in, VkPhysicalDeviceImageFormatInfo2 *out) { const VkBaseInStructure32 *in_header; @@ -52564,7 +52824,7 @@ static NTSTATUS thunk64_vkGetDeviceBufferMemoryRequirements(void *args)
init_conversion_context(ctx); convert_VkDeviceBufferMemoryRequirements_win64_to_host(ctx, params->pInfo, &pInfo_host); - vulkan_device_from_handle(params->device)->p_vkGetDeviceBufferMemoryRequirements(vulkan_device_from_handle(params->device)->host.device, &pInfo_host, params->pMemoryRequirements); + vk_funcs->p_vkGetDeviceBufferMemoryRequirements(params->device, &pInfo_host, params->pMemoryRequirements); free_conversion_context(ctx); return STATUS_SUCCESS; } @@ -52588,7 +52848,7 @@ static NTSTATUS thunk32_vkGetDeviceBufferMemoryRequirements(void *args) init_conversion_context(ctx); convert_VkDeviceBufferMemoryRequirements_win32_to_host(ctx, (const VkDeviceBufferMemoryRequirements32 *)UlongToPtr(params->pInfo), &pInfo_host); convert_VkMemoryRequirements2_win32_to_host(ctx, (VkMemoryRequirements232 *)UlongToPtr(params->pMemoryRequirements), &pMemoryRequirements_host); - vulkan_device_from_handle((VkDevice)UlongToPtr(params->device))->p_vkGetDeviceBufferMemoryRequirements(vulkan_device_from_handle((VkDevice)UlongToPtr(params->device))->host.device, &pInfo_host, &pMemoryRequirements_host); + vk_funcs->p_vkGetDeviceBufferMemoryRequirements((VkDevice)UlongToPtr(params->device), &pInfo_host, &pMemoryRequirements_host); convert_VkMemoryRequirements2_host_to_win32(&pMemoryRequirements_host, (VkMemoryRequirements232 *)UlongToPtr(params->pMemoryRequirements)); free_conversion_context(ctx); return STATUS_SUCCESS; @@ -52606,7 +52866,7 @@ static NTSTATUS thunk64_vkGetDeviceBufferMemoryRequirementsKHR(void *args)
init_conversion_context(ctx); convert_VkDeviceBufferMemoryRequirements_win64_to_host(ctx, params->pInfo, &pInfo_host); - vulkan_device_from_handle(params->device)->p_vkGetDeviceBufferMemoryRequirementsKHR(vulkan_device_from_handle(params->device)->host.device, &pInfo_host, params->pMemoryRequirements); + vk_funcs->p_vkGetDeviceBufferMemoryRequirementsKHR(params->device, &pInfo_host, params->pMemoryRequirements); free_conversion_context(ctx); return STATUS_SUCCESS; } @@ -52630,7 +52890,7 @@ static NTSTATUS thunk32_vkGetDeviceBufferMemoryRequirementsKHR(void *args) init_conversion_context(ctx); convert_VkDeviceBufferMemoryRequirements_win32_to_host(ctx, (const VkDeviceBufferMemoryRequirements32 *)UlongToPtr(params->pInfo), &pInfo_host); convert_VkMemoryRequirements2_win32_to_host(ctx, (VkMemoryRequirements232 *)UlongToPtr(params->pMemoryRequirements), &pMemoryRequirements_host); - vulkan_device_from_handle((VkDevice)UlongToPtr(params->device))->p_vkGetDeviceBufferMemoryRequirementsKHR(vulkan_device_from_handle((VkDevice)UlongToPtr(params->device))->host.device, &pInfo_host, &pMemoryRequirements_host); + vk_funcs->p_vkGetDeviceBufferMemoryRequirementsKHR((VkDevice)UlongToPtr(params->device), &pInfo_host, &pMemoryRequirements_host); convert_VkMemoryRequirements2_host_to_win32(&pMemoryRequirements_host, (VkMemoryRequirements232 *)UlongToPtr(params->pMemoryRequirements)); free_conversion_context(ctx); return STATUS_SUCCESS; @@ -52806,7 +53066,7 @@ static NTSTATUS thunk64_vkGetDeviceImageMemoryRequirements(void *args)
init_conversion_context(ctx); convert_VkDeviceImageMemoryRequirements_win64_to_host(ctx, params->pInfo, &pInfo_host); - vulkan_device_from_handle(params->device)->p_vkGetDeviceImageMemoryRequirements(vulkan_device_from_handle(params->device)->host.device, &pInfo_host, params->pMemoryRequirements); + vk_funcs->p_vkGetDeviceImageMemoryRequirements(params->device, &pInfo_host, params->pMemoryRequirements); free_conversion_context(ctx); return STATUS_SUCCESS; } @@ -52830,7 +53090,7 @@ static NTSTATUS thunk32_vkGetDeviceImageMemoryRequirements(void *args) init_conversion_context(ctx); convert_VkDeviceImageMemoryRequirements_win32_to_host(ctx, (const VkDeviceImageMemoryRequirements32 *)UlongToPtr(params->pInfo), &pInfo_host); convert_VkMemoryRequirements2_win32_to_host(ctx, (VkMemoryRequirements232 *)UlongToPtr(params->pMemoryRequirements), &pMemoryRequirements_host); - vulkan_device_from_handle((VkDevice)UlongToPtr(params->device))->p_vkGetDeviceImageMemoryRequirements(vulkan_device_from_handle((VkDevice)UlongToPtr(params->device))->host.device, &pInfo_host, &pMemoryRequirements_host); + vk_funcs->p_vkGetDeviceImageMemoryRequirements((VkDevice)UlongToPtr(params->device), &pInfo_host, &pMemoryRequirements_host); convert_VkMemoryRequirements2_host_to_win32(&pMemoryRequirements_host, (VkMemoryRequirements232 *)UlongToPtr(params->pMemoryRequirements)); free_conversion_context(ctx); return STATUS_SUCCESS; @@ -54105,6 +54365,68 @@ static NTSTATUS thunk32_vkGetMemoryHostPointerPropertiesEXT(void *args) return STATUS_SUCCESS; }
+#ifdef _WIN64 +static NTSTATUS thunk64_vkGetMemoryWin32HandleKHR(void *args) +{ + struct vkGetMemoryWin32HandleKHR_params *params = args; + + TRACE("%p, %p, %p\n", params->device, params->pGetWin32HandleInfo, params->pHandle); + + params->result = vk_funcs->p_vkGetMemoryWin32HandleKHR(params->device, params->pGetWin32HandleInfo, params->pHandle); + return STATUS_SUCCESS; +} +#endif /* _WIN64 */ + +static NTSTATUS thunk32_vkGetMemoryWin32HandleKHR(void *args) +{ + struct + { + PTR32 device; + PTR32 pGetWin32HandleInfo; + PTR32 pHandle; + VkResult result; + } *params = args; + VkMemoryGetWin32HandleInfoKHR pGetWin32HandleInfo_host; + + TRACE("%#x, %#x, %#x\n", params->device, params->pGetWin32HandleInfo, params->pHandle); + + convert_VkMemoryGetWin32HandleInfoKHR_win32_to_unwrapped_host((const VkMemoryGetWin32HandleInfoKHR32 *)UlongToPtr(params->pGetWin32HandleInfo), &pGetWin32HandleInfo_host); + params->result = vk_funcs->p_vkGetMemoryWin32HandleKHR((VkDevice)UlongToPtr(params->device), &pGetWin32HandleInfo_host, (HANDLE *)UlongToPtr(params->pHandle)); + return STATUS_SUCCESS; +} + +#ifdef _WIN64 +static NTSTATUS thunk64_vkGetMemoryWin32HandlePropertiesKHR(void *args) +{ + struct vkGetMemoryWin32HandlePropertiesKHR_params *params = args; + + TRACE("%p, %#x, %p, %p\n", params->device, params->handleType, params->handle, params->pMemoryWin32HandleProperties); + + params->result = vk_funcs->p_vkGetMemoryWin32HandlePropertiesKHR(params->device, params->handleType, params->handle, params->pMemoryWin32HandleProperties); + return STATUS_SUCCESS; +} +#endif /* _WIN64 */ + +static NTSTATUS thunk32_vkGetMemoryWin32HandlePropertiesKHR(void *args) +{ + struct + { + PTR32 device; + VkExternalMemoryHandleTypeFlagBits handleType; + HANDLE handle; + PTR32 pMemoryWin32HandleProperties; + VkResult result; + } *params = args; + VkMemoryWin32HandlePropertiesKHR pMemoryWin32HandleProperties_host; + + TRACE("%#x, %#x, %p, %#x\n", params->device, params->handleType, params->handle, params->pMemoryWin32HandleProperties); + + convert_VkMemoryWin32HandlePropertiesKHR_win32_to_host((VkMemoryWin32HandlePropertiesKHR32 *)UlongToPtr(params->pMemoryWin32HandleProperties), &pMemoryWin32HandleProperties_host); + params->result = vk_funcs->p_vkGetMemoryWin32HandlePropertiesKHR((VkDevice)UlongToPtr(params->device), params->handleType, params->handle, &pMemoryWin32HandleProperties_host); + convert_VkMemoryWin32HandlePropertiesKHR_host_to_win32(&pMemoryWin32HandleProperties_host, (VkMemoryWin32HandlePropertiesKHR32 *)UlongToPtr(params->pMemoryWin32HandleProperties)); + return STATUS_SUCCESS; +} + #ifdef _WIN64 static NTSTATUS thunk64_vkGetMicromapBuildSizesEXT(void *args) { @@ -54409,10 +54731,16 @@ static NTSTATUS thunk32_vkGetPhysicalDeviceCooperativeVectorPropertiesNV(void *a static NTSTATUS thunk64_vkGetPhysicalDeviceExternalBufferProperties(void *args) { struct vkGetPhysicalDeviceExternalBufferProperties_params *params = args; + VkPhysicalDeviceExternalBufferInfo pExternalBufferInfo_host; + struct conversion_context local_ctx; + struct conversion_context *ctx = &local_ctx;
TRACE("%p, %p, %p\n", params->physicalDevice, params->pExternalBufferInfo, params->pExternalBufferProperties);
- wine_vkGetPhysicalDeviceExternalBufferProperties(params->physicalDevice, params->pExternalBufferInfo, params->pExternalBufferProperties); + init_conversion_context(ctx); + convert_VkPhysicalDeviceExternalBufferInfo_win64_to_host(ctx, params->pExternalBufferInfo, &pExternalBufferInfo_host); + vk_funcs->p_vkGetPhysicalDeviceExternalBufferProperties(params->physicalDevice, &pExternalBufferInfo_host, params->pExternalBufferProperties); + free_conversion_context(ctx); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -54435,7 +54763,7 @@ static NTSTATUS thunk32_vkGetPhysicalDeviceExternalBufferProperties(void *args) init_conversion_context(ctx); convert_VkPhysicalDeviceExternalBufferInfo_win32_to_host(ctx, (const VkPhysicalDeviceExternalBufferInfo32 *)UlongToPtr(params->pExternalBufferInfo), &pExternalBufferInfo_host); convert_VkExternalBufferProperties_win32_to_host((VkExternalBufferProperties32 *)UlongToPtr(params->pExternalBufferProperties), &pExternalBufferProperties_host); - wine_vkGetPhysicalDeviceExternalBufferProperties((VkPhysicalDevice)UlongToPtr(params->physicalDevice), &pExternalBufferInfo_host, &pExternalBufferProperties_host); + vk_funcs->p_vkGetPhysicalDeviceExternalBufferProperties((VkPhysicalDevice)UlongToPtr(params->physicalDevice), &pExternalBufferInfo_host, &pExternalBufferProperties_host); convert_VkExternalBufferProperties_host_to_win32(&pExternalBufferProperties_host, (VkExternalBufferProperties32 *)UlongToPtr(params->pExternalBufferProperties)); free_conversion_context(ctx); return STATUS_SUCCESS; @@ -54445,10 +54773,16 @@ static NTSTATUS thunk32_vkGetPhysicalDeviceExternalBufferProperties(void *args) static NTSTATUS thunk64_vkGetPhysicalDeviceExternalBufferPropertiesKHR(void *args) { struct vkGetPhysicalDeviceExternalBufferPropertiesKHR_params *params = args; + VkPhysicalDeviceExternalBufferInfo pExternalBufferInfo_host; + struct conversion_context local_ctx; + struct conversion_context *ctx = &local_ctx;
TRACE("%p, %p, %p\n", params->physicalDevice, params->pExternalBufferInfo, params->pExternalBufferProperties);
- wine_vkGetPhysicalDeviceExternalBufferPropertiesKHR(params->physicalDevice, params->pExternalBufferInfo, params->pExternalBufferProperties); + init_conversion_context(ctx); + convert_VkPhysicalDeviceExternalBufferInfo_win64_to_host(ctx, params->pExternalBufferInfo, &pExternalBufferInfo_host); + vk_funcs->p_vkGetPhysicalDeviceExternalBufferPropertiesKHR(params->physicalDevice, &pExternalBufferInfo_host, params->pExternalBufferProperties); + free_conversion_context(ctx); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -54471,7 +54805,7 @@ static NTSTATUS thunk32_vkGetPhysicalDeviceExternalBufferPropertiesKHR(void *arg init_conversion_context(ctx); convert_VkPhysicalDeviceExternalBufferInfo_win32_to_host(ctx, (const VkPhysicalDeviceExternalBufferInfo32 *)UlongToPtr(params->pExternalBufferInfo), &pExternalBufferInfo_host); convert_VkExternalBufferProperties_win32_to_host((VkExternalBufferProperties32 *)UlongToPtr(params->pExternalBufferProperties), &pExternalBufferProperties_host); - wine_vkGetPhysicalDeviceExternalBufferPropertiesKHR((VkPhysicalDevice)UlongToPtr(params->physicalDevice), &pExternalBufferInfo_host, &pExternalBufferProperties_host); + vk_funcs->p_vkGetPhysicalDeviceExternalBufferPropertiesKHR((VkPhysicalDevice)UlongToPtr(params->physicalDevice), &pExternalBufferInfo_host, &pExternalBufferProperties_host); convert_VkExternalBufferProperties_host_to_win32(&pExternalBufferProperties_host, (VkExternalBufferProperties32 *)UlongToPtr(params->pExternalBufferProperties)); free_conversion_context(ctx); return STATUS_SUCCESS; @@ -54909,10 +55243,16 @@ static NTSTATUS thunk32_vkGetPhysicalDeviceImageFormatProperties(void *args) static NTSTATUS thunk64_vkGetPhysicalDeviceImageFormatProperties2(void *args) { struct vkGetPhysicalDeviceImageFormatProperties2_params *params = args; + VkPhysicalDeviceImageFormatInfo2 pImageFormatInfo_host; + struct conversion_context local_ctx; + struct conversion_context *ctx = &local_ctx;
TRACE("%p, %p, %p\n", params->physicalDevice, params->pImageFormatInfo, params->pImageFormatProperties);
- params->result = wine_vkGetPhysicalDeviceImageFormatProperties2(params->physicalDevice, params->pImageFormatInfo, params->pImageFormatProperties); + init_conversion_context(ctx); + convert_VkPhysicalDeviceImageFormatInfo2_win64_to_host(ctx, params->pImageFormatInfo, &pImageFormatInfo_host); + params->result = vk_funcs->p_vkGetPhysicalDeviceImageFormatProperties2(params->physicalDevice, &pImageFormatInfo_host, params->pImageFormatProperties); + free_conversion_context(ctx); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -54936,7 +55276,7 @@ static NTSTATUS thunk32_vkGetPhysicalDeviceImageFormatProperties2(void *args) init_conversion_context(ctx); convert_VkPhysicalDeviceImageFormatInfo2_win32_to_host(ctx, (const VkPhysicalDeviceImageFormatInfo232 *)UlongToPtr(params->pImageFormatInfo), &pImageFormatInfo_host); convert_VkImageFormatProperties2_win32_to_host(ctx, (VkImageFormatProperties232 *)UlongToPtr(params->pImageFormatProperties), &pImageFormatProperties_host); - params->result = wine_vkGetPhysicalDeviceImageFormatProperties2((VkPhysicalDevice)UlongToPtr(params->physicalDevice), &pImageFormatInfo_host, &pImageFormatProperties_host); + params->result = vk_funcs->p_vkGetPhysicalDeviceImageFormatProperties2((VkPhysicalDevice)UlongToPtr(params->physicalDevice), &pImageFormatInfo_host, &pImageFormatProperties_host); convert_VkImageFormatProperties2_host_to_win32(&pImageFormatProperties_host, (VkImageFormatProperties232 *)UlongToPtr(params->pImageFormatProperties)); free_conversion_context(ctx); return STATUS_SUCCESS; @@ -54946,10 +55286,16 @@ static NTSTATUS thunk32_vkGetPhysicalDeviceImageFormatProperties2(void *args) static NTSTATUS thunk64_vkGetPhysicalDeviceImageFormatProperties2KHR(void *args) { struct vkGetPhysicalDeviceImageFormatProperties2KHR_params *params = args; + VkPhysicalDeviceImageFormatInfo2 pImageFormatInfo_host; + struct conversion_context local_ctx; + struct conversion_context *ctx = &local_ctx;
TRACE("%p, %p, %p\n", params->physicalDevice, params->pImageFormatInfo, params->pImageFormatProperties);
- params->result = wine_vkGetPhysicalDeviceImageFormatProperties2KHR(params->physicalDevice, params->pImageFormatInfo, params->pImageFormatProperties); + init_conversion_context(ctx); + convert_VkPhysicalDeviceImageFormatInfo2_win64_to_host(ctx, params->pImageFormatInfo, &pImageFormatInfo_host); + params->result = vk_funcs->p_vkGetPhysicalDeviceImageFormatProperties2KHR(params->physicalDevice, &pImageFormatInfo_host, params->pImageFormatProperties); + free_conversion_context(ctx); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -54973,7 +55319,7 @@ static NTSTATUS thunk32_vkGetPhysicalDeviceImageFormatProperties2KHR(void *args) init_conversion_context(ctx); convert_VkPhysicalDeviceImageFormatInfo2_win32_to_host(ctx, (const VkPhysicalDeviceImageFormatInfo232 *)UlongToPtr(params->pImageFormatInfo), &pImageFormatInfo_host); convert_VkImageFormatProperties2_win32_to_host(ctx, (VkImageFormatProperties232 *)UlongToPtr(params->pImageFormatProperties), &pImageFormatProperties_host); - params->result = wine_vkGetPhysicalDeviceImageFormatProperties2KHR((VkPhysicalDevice)UlongToPtr(params->physicalDevice), &pImageFormatInfo_host, &pImageFormatProperties_host); + params->result = vk_funcs->p_vkGetPhysicalDeviceImageFormatProperties2KHR((VkPhysicalDevice)UlongToPtr(params->physicalDevice), &pImageFormatInfo_host, &pImageFormatProperties_host); convert_VkImageFormatProperties2_host_to_win32(&pImageFormatProperties_host, (VkImageFormatProperties232 *)UlongToPtr(params->pImageFormatProperties)); free_conversion_context(ctx); return STATUS_SUCCESS; @@ -59240,6 +59586,7 @@ static const char * const vk_device_extensions[] = "VK_KHR_dynamic_rendering_local_read", "VK_KHR_external_fence", "VK_KHR_external_memory", + "VK_KHR_external_memory_win32", "VK_KHR_external_semaphore", "VK_KHR_format_feature_flags2", "VK_KHR_fragment_shader_barycentric", @@ -59999,6 +60346,8 @@ const unixlib_entry_t __wine_unix_call_funcs[] = thunk64_vkGetImageViewOpaqueCaptureDescriptorDataEXT, thunk64_vkGetLatencyTimingsNV, thunk64_vkGetMemoryHostPointerPropertiesEXT, + thunk64_vkGetMemoryWin32HandleKHR, + thunk64_vkGetMemoryWin32HandlePropertiesKHR, thunk64_vkGetMicromapBuildSizesEXT, thunk64_vkGetPartitionedAccelerationStructuresBuildSizesNV, thunk64_vkGetPerformanceParameterINTEL, @@ -60671,6 +61020,8 @@ const unixlib_entry_t __wine_unix_call_funcs[] = thunk32_vkGetImageViewOpaqueCaptureDescriptorDataEXT, thunk32_vkGetLatencyTimingsNV, thunk32_vkGetMemoryHostPointerPropertiesEXT, + thunk32_vkGetMemoryWin32HandleKHR, + thunk32_vkGetMemoryWin32HandlePropertiesKHR, thunk32_vkGetMicromapBuildSizesEXT, thunk32_vkGetPartitionedAccelerationStructuresBuildSizesNV, thunk32_vkGetPerformanceParameterINTEL, diff --git a/dlls/winevulkan/vulkan_thunks.h b/dlls/winevulkan/vulkan_thunks.h index 4f5abf6cabc..a7736bb7923 100644 --- a/dlls/winevulkan/vulkan_thunks.h +++ b/dlls/winevulkan/vulkan_thunks.h @@ -48,13 +48,9 @@ void wine_vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t void wine_vkGetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2 *pQueueInfo, VkQueue *pQueue); VkResult wine_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(VkPhysicalDevice physicalDevice, uint32_t *pTimeDomainCount, VkTimeDomainKHR *pTimeDomains); VkResult wine_vkGetPhysicalDeviceCalibrateableTimeDomainsKHR(VkPhysicalDevice physicalDevice, uint32_t *pTimeDomainCount, VkTimeDomainKHR *pTimeDomains); -void wine_vkGetPhysicalDeviceExternalBufferProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo *pExternalBufferInfo, VkExternalBufferProperties *pExternalBufferProperties); -void wine_vkGetPhysicalDeviceExternalBufferPropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo *pExternalBufferInfo, VkExternalBufferProperties *pExternalBufferProperties); void wine_vkGetPhysicalDeviceExternalFenceProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo, VkExternalFenceProperties *pExternalFenceProperties); void wine_vkGetPhysicalDeviceExternalFencePropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo, VkExternalFenceProperties *pExternalFenceProperties); void wine_vkGetPhysicalDeviceExternalSemaphoreProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo *pExternalSemaphoreInfo, VkExternalSemaphoreProperties *pExternalSemaphoreProperties); void wine_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo *pExternalSemaphoreInfo, VkExternalSemaphoreProperties *pExternalSemaphoreProperties); -VkResult wine_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties); -VkResult wine_vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties);
#endif /* __WINE_VULKAN_THUNKS_H */ diff --git a/include/wine/vulkan.h b/include/wine/vulkan.h index e5c44057f52..4336a154ecc 100644 --- a/include/wine/vulkan.h +++ b/include/wine/vulkan.h @@ -20707,6 +20707,8 @@ VkResult VKAPI_CALL vkWriteMicromapsPropertiesEXT(VkDevice device, uint32_t micr USE_VK_FUNC(vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR) \ USE_VK_FUNC(vkGetPhysicalDeviceCooperativeMatrixPropertiesNV) \ USE_VK_FUNC(vkGetPhysicalDeviceCooperativeVectorPropertiesNV) \ + USE_VK_FUNC(vkGetPhysicalDeviceExternalBufferProperties) \ + USE_VK_FUNC(vkGetPhysicalDeviceExternalBufferPropertiesKHR) \ USE_VK_FUNC(vkGetPhysicalDeviceExternalTensorPropertiesARM) \ USE_VK_FUNC(vkGetPhysicalDeviceFeatures) \ USE_VK_FUNC(vkGetPhysicalDeviceFeatures2) \ diff --git a/include/wine/vulkan_driver.h b/include/wine/vulkan_driver.h index c373f639451..c9c76d87171 100644 --- a/include/wine/vulkan_driver.h +++ b/include/wine/vulkan_driver.h @@ -185,8 +185,17 @@ struct vulkan_funcs PFN_vkDestroySurfaceKHR p_vkDestroySurfaceKHR; PFN_vkDestroySwapchainKHR p_vkDestroySwapchainKHR; PFN_vkFreeMemory p_vkFreeMemory; + PFN_vkGetDeviceBufferMemoryRequirements p_vkGetDeviceBufferMemoryRequirements; + PFN_vkGetDeviceBufferMemoryRequirementsKHR p_vkGetDeviceBufferMemoryRequirementsKHR; + PFN_vkGetDeviceImageMemoryRequirements p_vkGetDeviceImageMemoryRequirements; PFN_vkGetDeviceProcAddr p_vkGetDeviceProcAddr; PFN_vkGetInstanceProcAddr p_vkGetInstanceProcAddr; + PFN_vkGetMemoryWin32HandleKHR p_vkGetMemoryWin32HandleKHR; + PFN_vkGetMemoryWin32HandlePropertiesKHR p_vkGetMemoryWin32HandlePropertiesKHR; + PFN_vkGetPhysicalDeviceExternalBufferProperties p_vkGetPhysicalDeviceExternalBufferProperties; + PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHR p_vkGetPhysicalDeviceExternalBufferPropertiesKHR; + PFN_vkGetPhysicalDeviceImageFormatProperties2 p_vkGetPhysicalDeviceImageFormatProperties2; + PFN_vkGetPhysicalDeviceImageFormatProperties2KHR p_vkGetPhysicalDeviceImageFormatProperties2KHR; PFN_vkGetPhysicalDevicePresentRectanglesKHR p_vkGetPhysicalDevicePresentRectanglesKHR; PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR p_vkGetPhysicalDeviceSurfaceCapabilities2KHR; PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR p_vkGetPhysicalDeviceSurfaceCapabilitiesKHR;