From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/vulkan.c | 338 ++++++++++++++++++++++++++++++- dlls/winevulkan/make_vulkan | 18 +- dlls/winevulkan/vulkan.c | 311 ---------------------------- dlls/winevulkan/vulkan_private.h | 12 -- dlls/winevulkan/vulkan_thunks.c | 106 +++++----- dlls/winevulkan/vulkan_thunks.h | 8 - include/wine/vulkan_driver.h | 18 ++ 7 files changed, 411 insertions(+), 400 deletions(-)
diff --git a/dlls/win32u/vulkan.c b/dlls/win32u/vulkan.c index 9cd5a533060..1c397db76c4 100644 --- a/dlls/win32u/vulkan.c +++ b/dlls/win32u/vulkan.c @@ -46,6 +46,19 @@ WINE_DECLARE_DEBUG_CHANNEL(fps);
static const struct vulkan_driver_funcs *driver_funcs;
+struct device_memory +{ + struct vulkan_device_memory obj; + VkDeviceSize size; + void *vm_map; +}; + +static inline struct device_memory *device_memory_from_handle( VkDeviceMemory handle ) +{ + struct vulkan_device_memory *obj = vulkan_device_memory_from_handle( handle ); + return CONTAINING_RECORD( obj, struct device_memory, obj ); +} + struct surface { struct vulkan_surface obj; @@ -72,6 +85,309 @@ static struct swapchain *swapchain_from_handle( VkSwapchainKHR handle ) return CONTAINING_RECORD( obj, struct swapchain, obj ); }
+static inline const void *find_next_struct( const void *head, VkStructureType type ) +{ + const VkBaseInStructure *header; + for (header = head; header; header = header->pNext) if (header->sType == type) return header; + return NULL; +} + +static VkResult win32u_vkAllocateMemory( VkDevice client_device, const VkMemoryAllocateInfo *alloc_info, + const VkAllocationCallbacks *allocator, VkDeviceMemory *ret ) +{ + struct vulkan_device *device = vulkan_device_from_handle( client_device ); + struct vulkan_physical_device *physical_device = device->physical_device; + struct vulkan_instance *instance = device->physical_device->instance; + VkImportMemoryHostPointerInfoEXT host_pointer_info; + VkMemoryAllocateInfo info = *alloc_info; + VkDeviceMemory host_device_memory; + struct device_memory *memory; + uint32_t mem_flags; + void *mapping = NULL; + VkResult res; + + /* For host visible memory, we try to use VK_EXT_external_memory_host on wow64 to ensure that mapped pointer is 32-bit. */ + mem_flags = physical_device->memory_properties.memoryTypes[alloc_info->memoryTypeIndex].propertyFlags; + if (physical_device->external_memory_align && (mem_flags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) && + !find_next_struct( alloc_info->pNext, VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT )) + { + VkMemoryHostPointerPropertiesEXT props = + { + .sType = VK_STRUCTURE_TYPE_MEMORY_HOST_POINTER_PROPERTIES_EXT, + }; + uint32_t i, align = physical_device->external_memory_align - 1; + SIZE_T alloc_size = info.allocationSize; + static int once; + + if (!once++) FIXME( "Using VK_EXT_external_memory_host\n" ); + + if (NtAllocateVirtualMemory( GetCurrentProcess(), &mapping, zero_bits, &alloc_size, MEM_COMMIT, PAGE_READWRITE )) + { + ERR( "NtAllocateVirtualMemory failed\n" ); + return VK_ERROR_OUT_OF_HOST_MEMORY; + } + + if ((res = device->p_vkGetMemoryHostPointerPropertiesEXT( device->host.device, VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT, + mapping, &props ))) + { + ERR( "vkGetMemoryHostPointerPropertiesEXT failed: %d\n", res ); + return res; + } + + if (!(props.memoryTypeBits & (1u << info.memoryTypeIndex))) + { + /* If requested memory type is not allowed to use external memory, + * try to find a supported compatible type. */ + uint32_t mask = mem_flags & ~VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; + for (i = 0; i < physical_device->memory_properties.memoryTypeCount; i++) + { + if (!(props.memoryTypeBits & (1u << i))) continue; + if ((physical_device->memory_properties.memoryTypes[i].propertyFlags & mask) != mask) continue; + + TRACE( "Memory type not compatible with host memory, using %u instead\n", i ); + info.memoryTypeIndex = i; + break; + } + if (i == physical_device->memory_properties.memoryTypeCount) + { + FIXME( "Not found compatible memory type\n" ); + alloc_size = 0; + NtFreeVirtualMemory( GetCurrentProcess(), &mapping, &alloc_size, MEM_RELEASE ); + } + } + + if (props.memoryTypeBits & (1u << info.memoryTypeIndex)) + { + host_pointer_info.sType = VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT; + host_pointer_info.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT; + host_pointer_info.pHostPointer = mapping; + host_pointer_info.pNext = info.pNext; + info.pNext = &host_pointer_info; + + info.allocationSize = (info.allocationSize + align) & ~align; + } + } + + if (!(memory = malloc( sizeof(*memory) ))) return VK_ERROR_OUT_OF_HOST_MEMORY; + if ((res = device->p_vkAllocateMemory( device->host.device, &info, NULL, &host_device_memory ))) + { + free( memory ); + return res; + } + + vulkan_object_init( &memory->obj.obj, host_device_memory ); + memory->size = info.allocationSize; + memory->vm_map = mapping; + instance->p_insert_object( instance, &memory->obj.obj ); + + *ret = memory->obj.client.device_memory; + return VK_SUCCESS; +} + +static void win32u_vkFreeMemory( VkDevice client_device, VkDeviceMemory client_memory, const VkAllocationCallbacks *allocator ) +{ + struct vulkan_device *device = vulkan_device_from_handle( client_device ); + struct vulkan_physical_device *physical_device = device->physical_device; + struct vulkan_instance *instance = device->physical_device->instance; + struct device_memory *memory; + + if (!client_memory) return; + memory = device_memory_from_handle( client_memory ); + + if (memory->vm_map && !physical_device->external_memory_align) + { + const VkMemoryUnmapInfoKHR info = + { + .sType = VK_STRUCTURE_TYPE_MEMORY_UNMAP_INFO_KHR, + .memory = memory->obj.host.device_memory, + .flags = VK_MEMORY_UNMAP_RESERVE_BIT_EXT, + }; + device->p_vkUnmapMemory2KHR( device->host.device, &info ); + } + + device->p_vkFreeMemory( device->host.device, memory->obj.host.device_memory, NULL ); + instance->p_remove_object( instance, &memory->obj.obj ); + + if (memory->vm_map) + { + SIZE_T alloc_size = 0; + NtFreeVirtualMemory( GetCurrentProcess(), &memory->vm_map, &alloc_size, MEM_RELEASE ); + } + + free( memory ); +} + +static VkResult win32u_vkMapMemory2KHR( VkDevice client_device, const VkMemoryMapInfoKHR *map_info, void **data ) +{ + struct vulkan_device *device = vulkan_device_from_handle( client_device ); + struct vulkan_physical_device *physical_device = device->physical_device; + struct device_memory *memory = device_memory_from_handle( map_info->memory ); + VkMemoryMapInfoKHR info = *map_info; + VkMemoryMapPlacedInfoEXT placed_info = + { + .sType = VK_STRUCTURE_TYPE_MEMORY_MAP_PLACED_INFO_EXT, + }; + VkResult res; + + info.memory = memory->obj.host.device_memory; + if (memory->vm_map) + { + *data = (char *)memory->vm_map + info.offset; + TRACE( "returning %p\n", *data ); + return VK_SUCCESS; + } + + if (physical_device->map_placed_align) + { + SIZE_T alloc_size = memory->size; + + placed_info.pNext = info.pNext; + info.pNext = &placed_info; + info.offset = 0; + info.size = VK_WHOLE_SIZE; + info.flags |= VK_MEMORY_MAP_PLACED_BIT_EXT; + + if (NtAllocateVirtualMemory( GetCurrentProcess(), &placed_info.pPlacedAddress, zero_bits, + &alloc_size, MEM_COMMIT, PAGE_READWRITE )) + { + ERR( "NtAllocateVirtualMemory failed\n" ); + return VK_ERROR_OUT_OF_HOST_MEMORY; + } + } + + if (device->p_vkMapMemory2KHR) + res = device->p_vkMapMemory2KHR( device->host.device, &info, data ); + else + { + if (info.pNext) FIXME( "struct extension chain not implemented!\n" ); + res = device->p_vkMapMemory( device->host.device, info.memory, info.offset, info.size, info.flags, data ); + } + + if (placed_info.pPlacedAddress) + { + if (res != VK_SUCCESS) + { + SIZE_T alloc_size = 0; + ERR( "vkMapMemory2EXT failed: %d\n", res ); + NtFreeVirtualMemory( GetCurrentProcess(), &placed_info.pPlacedAddress, &alloc_size, MEM_RELEASE ); + return res; + } + memory->vm_map = placed_info.pPlacedAddress; + *data = (char *)memory->vm_map + map_info->offset; + TRACE( "Using placed mapping %p\n", memory->vm_map ); + } + +#ifdef _WIN64 + if (NtCurrentTeb()->WowTebOffset && res == VK_SUCCESS && (UINT_PTR)*data >> 32) + { + FIXME( "returned mapping %p does not fit 32-bit pointer\n", *data ); + device->p_vkUnmapMemory( device->host.device, memory->obj.host.device_memory ); + *data = NULL; + res = VK_ERROR_OUT_OF_HOST_MEMORY; + } +#endif + + return res; +} + +static VkResult win32u_vkMapMemory( VkDevice client_device, VkDeviceMemory client_memory, VkDeviceSize offset, + VkDeviceSize size, VkMemoryMapFlags flags, void **data ) +{ + const VkMemoryMapInfoKHR info = + { + .sType = VK_STRUCTURE_TYPE_MEMORY_MAP_INFO_KHR, + .flags = flags, + .memory = client_memory, + .offset = offset, + .size = size, + }; + + return win32u_vkMapMemory2KHR( client_device, &info, data ); +} + +static VkResult win32u_vkUnmapMemory2KHR( VkDevice client_device, const VkMemoryUnmapInfoKHR *unmap_info ) +{ + struct vulkan_device *device = vulkan_device_from_handle( client_device ); + struct vulkan_physical_device *physical_device = device->physical_device; + struct device_memory *memory = device_memory_from_handle( unmap_info->memory ); + VkMemoryUnmapInfoKHR info; + VkResult res; + + if (memory->vm_map && physical_device->external_memory_align) return VK_SUCCESS; + + if (!device->p_vkUnmapMemory2KHR) + { + if (unmap_info->pNext || memory->vm_map) FIXME( "Not implemented\n" ); + device->p_vkUnmapMemory( device->host.device, memory->obj.host.device_memory ); + return VK_SUCCESS; + } + + info = *unmap_info; + info.memory = memory->obj.host.device_memory; + if (memory->vm_map) info.flags |= VK_MEMORY_UNMAP_RESERVE_BIT_EXT; + + res = device->p_vkUnmapMemory2KHR( device->host.device, &info ); + + if (res == VK_SUCCESS && memory->vm_map) + { + SIZE_T size = 0; + NtFreeVirtualMemory( GetCurrentProcess(), &memory->vm_map, &size, MEM_RELEASE ); + memory->vm_map = NULL; + } + return res; +} + +static void win32u_vkUnmapMemory( VkDevice client_device, VkDeviceMemory client_memory ) +{ + const VkMemoryUnmapInfoKHR info = + { + .sType = VK_STRUCTURE_TYPE_MEMORY_UNMAP_INFO_KHR, + .memory = client_memory, + }; + + win32u_vkUnmapMemory2KHR( client_device, &info ); +} + +static VkResult win32u_vkCreateBuffer( VkDevice client_device, const VkBufferCreateInfo *create_info, + const VkAllocationCallbacks *allocator, VkBuffer *buffer ) +{ + struct vulkan_device *device = vulkan_device_from_handle( client_device ); + struct vulkan_physical_device *physical_device = device->physical_device; + VkExternalMemoryBufferCreateInfo external_memory_info; + VkBufferCreateInfo info = *create_info; + + if (physical_device->external_memory_align && + !find_next_struct( info.pNext, VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO )) + { + external_memory_info.sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO; + external_memory_info.pNext = info.pNext; + external_memory_info.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT; + info.pNext = &external_memory_info; + } + + return device->p_vkCreateBuffer( device->host.device, &info, NULL, buffer ); +} + +static VkResult win32u_vkCreateImage( VkDevice client_device, const VkImageCreateInfo *create_info, + const VkAllocationCallbacks *allocator, VkImage *image ) +{ + struct vulkan_device *device = vulkan_device_from_handle( client_device ); + struct vulkan_physical_device *physical_device = device->physical_device; + VkExternalMemoryImageCreateInfo external_memory_info; + VkImageCreateInfo info = *create_info; + + if (physical_device->external_memory_align && + !find_next_struct( info.pNext, VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO )) + { + external_memory_info.sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO; + external_memory_info.pNext = info.pNext; + external_memory_info.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT; + info.pNext = &external_memory_info; + } + + return device->p_vkCreateImage( device->host.device, &info, NULL, image ); +} + static VkResult win32u_vkCreateWin32SurfaceKHR( VkInstance client_instance, const VkWin32SurfaceCreateInfoKHR *create_info, const VkAllocationCallbacks *allocator, VkSurfaceKHR *ret ) { @@ -483,19 +799,27 @@ static const char *win32u_get_host_surface_extension(void)
static struct vulkan_funcs vulkan_funcs = { + .p_vkAcquireNextImage2KHR = win32u_vkAcquireNextImage2KHR, + .p_vkAcquireNextImageKHR = win32u_vkAcquireNextImageKHR, + .p_vkAllocateMemory = win32u_vkAllocateMemory, + .p_vkCreateBuffer = win32u_vkCreateBuffer, + .p_vkCreateImage = win32u_vkCreateImage, + .p_vkCreateSwapchainKHR = win32u_vkCreateSwapchainKHR, .p_vkCreateWin32SurfaceKHR = win32u_vkCreateWin32SurfaceKHR, .p_vkDestroySurfaceKHR = win32u_vkDestroySurfaceKHR, - .p_vkGetPhysicalDeviceSurfaceCapabilitiesKHR = win32u_vkGetPhysicalDeviceSurfaceCapabilitiesKHR, - .p_vkGetPhysicalDeviceSurfaceCapabilities2KHR = win32u_vkGetPhysicalDeviceSurfaceCapabilities2KHR, + .p_vkDestroySwapchainKHR = win32u_vkDestroySwapchainKHR, + .p_vkFreeMemory = win32u_vkFreeMemory, .p_vkGetPhysicalDevicePresentRectanglesKHR = win32u_vkGetPhysicalDevicePresentRectanglesKHR, - .p_vkGetPhysicalDeviceSurfaceFormatsKHR = win32u_vkGetPhysicalDeviceSurfaceFormatsKHR, + .p_vkGetPhysicalDeviceSurfaceCapabilities2KHR = win32u_vkGetPhysicalDeviceSurfaceCapabilities2KHR, + .p_vkGetPhysicalDeviceSurfaceCapabilitiesKHR = win32u_vkGetPhysicalDeviceSurfaceCapabilitiesKHR, .p_vkGetPhysicalDeviceSurfaceFormats2KHR = win32u_vkGetPhysicalDeviceSurfaceFormats2KHR, + .p_vkGetPhysicalDeviceSurfaceFormatsKHR = win32u_vkGetPhysicalDeviceSurfaceFormatsKHR, .p_vkGetPhysicalDeviceWin32PresentationSupportKHR = win32u_vkGetPhysicalDeviceWin32PresentationSupportKHR, - .p_vkCreateSwapchainKHR = win32u_vkCreateSwapchainKHR, - .p_vkDestroySwapchainKHR = win32u_vkDestroySwapchainKHR, - .p_vkAcquireNextImage2KHR = win32u_vkAcquireNextImage2KHR, - .p_vkAcquireNextImageKHR = win32u_vkAcquireNextImageKHR, + .p_vkMapMemory = win32u_vkMapMemory, + .p_vkMapMemory2KHR = win32u_vkMapMemory2KHR, .p_vkQueuePresentKHR = win32u_vkQueuePresentKHR, + .p_vkUnmapMemory = win32u_vkUnmapMemory, + .p_vkUnmapMemory2KHR = win32u_vkUnmapMemory2KHR, .p_get_host_surface_extension = win32u_get_host_surface_extension, };
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index b968b7d6e87..09d450bba71 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -213,10 +213,14 @@ FUNCTION_OVERRIDES = { USER_DRIVER_FUNCS = { "vkAcquireNextImage2KHR", "vkAcquireNextImageKHR", + "vkAllocateMemory", + "vkCreateBuffer", + "vkCreateImage", "vkCreateSwapchainKHR", "vkCreateWin32SurfaceKHR", "vkDestroySurfaceKHR", "vkDestroySwapchainKHR", + "vkFreeMemory", "vkGetDeviceProcAddr", "vkGetInstanceProcAddr", "vkGetPhysicalDevicePresentRectanglesKHR", @@ -225,20 +229,21 @@ USER_DRIVER_FUNCS = { "vkGetPhysicalDeviceSurfaceFormats2KHR", "vkGetPhysicalDeviceSurfaceFormatsKHR", "vkGetPhysicalDeviceWin32PresentationSupportKHR", + "vkMapMemory", + "vkMapMemory2KHR", "vkQueuePresentKHR", + "vkUnmapMemory", + "vkUnmapMemory2KHR", }
# functions for which the unix thunk is manually implemented MANUAL_UNIX_THUNKS = { "vkAllocateCommandBuffers", - "vkAllocateMemory", - "vkCreateBuffer", "vkCreateCommandPool", "vkCreateDebugReportCallbackEXT", "vkCreateDebugUtilsMessengerEXT", "vkCreateDeferredOperationKHR", "vkCreateDevice", - "vkCreateImage", "vkCreateInstance", "vkDestroyCommandPool", "vkDestroyDebugReportCallbackEXT", @@ -255,7 +260,6 @@ MANUAL_UNIX_THUNKS = { "vkEnumeratePhysicalDeviceGroupsKHR", "vkEnumeratePhysicalDevices", "vkFreeCommandBuffers", - "vkFreeMemory", "vkGetCalibratedTimestampsEXT", "vkGetCalibratedTimestampsKHR", "vkGetDeviceProcAddr", @@ -272,10 +276,6 @@ MANUAL_UNIX_THUNKS = { "vkGetPhysicalDeviceExternalSemaphorePropertiesKHR", "vkGetPhysicalDeviceImageFormatProperties2", "vkGetPhysicalDeviceImageFormatProperties2KHR", - "vkMapMemory", - "vkMapMemory2KHR", - "vkUnmapMemory", - "vkUnmapMemory2KHR", }
# loader functions which are entirely manually implemented @@ -1112,7 +1112,7 @@ class VkHandle(object): if self.name == "VkInstance": return "vulkan_instance_from_handle({0})->host.instance".format(name) if self.name == "VkDeviceMemory": - return "wine_device_memory_from_handle({0})->host.device_memory".format(name) + return "vulkan_device_memory_from_handle({0})->host.device_memory".format(name) if self.name == "VkPhysicalDevice": return "vulkan_physical_device_from_handle({0})->host.physical_device".format(name) if self.name == "VkQueue": diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 82cbaba5af8..38930fa302b 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -1644,317 +1644,6 @@ void wine_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR(VkPhysicalDevice cli properties->externalSemaphoreFeatures = 0; }
-VkResult wine_vkAllocateMemory(VkDevice client_device, const VkMemoryAllocateInfo *alloc_info, - const VkAllocationCallbacks *allocator, VkDeviceMemory *ret) -{ - struct vulkan_device *device = vulkan_device_from_handle(client_device); - struct vulkan_physical_device *physical_device = device->physical_device; - struct vulkan_instance *instance = device->physical_device->instance; - struct wine_device_memory *memory; - VkMemoryAllocateInfo info = *alloc_info; - VkImportMemoryHostPointerInfoEXT host_pointer_info; - VkDeviceMemory host_device_memory; - uint32_t mem_flags; - void *mapping = NULL; - VkResult result; - - /* For host visible memory, we try to use VK_EXT_external_memory_host on wow64 - * to ensure that mapped pointer is 32-bit. */ - mem_flags = physical_device->memory_properties.memoryTypes[alloc_info->memoryTypeIndex].propertyFlags; - if (physical_device->external_memory_align && (mem_flags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) && - !find_next_struct(alloc_info->pNext, VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT)) - { - VkMemoryHostPointerPropertiesEXT props = - { - .sType = VK_STRUCTURE_TYPE_MEMORY_HOST_POINTER_PROPERTIES_EXT, - }; - uint32_t i, align = physical_device->external_memory_align - 1; - SIZE_T alloc_size = info.allocationSize; - static int once; - - if (!once++) - FIXME("Using VK_EXT_external_memory_host\n"); - - if (NtAllocateVirtualMemory(GetCurrentProcess(), &mapping, zero_bits, &alloc_size, - MEM_COMMIT, PAGE_READWRITE)) - { - ERR("NtAllocateVirtualMemory failed\n"); - return VK_ERROR_OUT_OF_HOST_MEMORY; - } - - result = device->p_vkGetMemoryHostPointerPropertiesEXT(device->host.device, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT, mapping, &props); - if (result != VK_SUCCESS) - { - ERR("vkGetMemoryHostPointerPropertiesEXT failed: %d\n", result); - return result; - } - - if (!(props.memoryTypeBits & (1u << info.memoryTypeIndex))) - { - /* If requested memory type is not allowed to use external memory, - * try to find a supported compatible type. */ - uint32_t mask = mem_flags & ~VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; - for (i = 0; i < physical_device->memory_properties.memoryTypeCount; i++) - { - if (!(props.memoryTypeBits & (1u << i))) - continue; - if ((physical_device->memory_properties.memoryTypes[i].propertyFlags & mask) != mask) - continue; - - TRACE("Memory type not compatible with host memory, using %u instead\n", i); - info.memoryTypeIndex = i; - break; - } - if (i == physical_device->memory_properties.memoryTypeCount) - { - FIXME("Not found compatible memory type\n"); - alloc_size = 0; - NtFreeVirtualMemory(GetCurrentProcess(), &mapping, &alloc_size, MEM_RELEASE); - } - } - - if (props.memoryTypeBits & (1u << info.memoryTypeIndex)) - { - host_pointer_info.sType = VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT; - host_pointer_info.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT; - host_pointer_info.pHostPointer = mapping; - host_pointer_info.pNext = info.pNext; - info.pNext = &host_pointer_info; - - info.allocationSize = (info.allocationSize + align) & ~align; - } - } - - if (!(memory = malloc(sizeof(*memory)))) - return VK_ERROR_OUT_OF_HOST_MEMORY; - - result = device->p_vkAllocateMemory(device->host.device, &info, NULL, &host_device_memory); - if (result != VK_SUCCESS) - { - free(memory); - return result; - } - - vulkan_object_init(&memory->obj, host_device_memory); - memory->size = info.allocationSize; - memory->vm_map = mapping; - vulkan_instance_insert_object(instance, &memory->obj); - - *ret = memory->client.device_memory; - return VK_SUCCESS; -} - -void wine_vkFreeMemory(VkDevice client_device, VkDeviceMemory memory_handle, const VkAllocationCallbacks *allocator) -{ - struct vulkan_device *device = vulkan_device_from_handle(client_device); - struct vulkan_physical_device *physical_device = device->physical_device; - struct vulkan_instance *instance = device->physical_device->instance; - struct wine_device_memory *memory; - - if (!memory_handle) - return; - memory = wine_device_memory_from_handle(memory_handle); - - if (memory->vm_map && !physical_device->external_memory_align) - { - const VkMemoryUnmapInfoKHR info = - { - .sType = VK_STRUCTURE_TYPE_MEMORY_UNMAP_INFO_KHR, - .memory = memory->host.device_memory, - .flags = VK_MEMORY_UNMAP_RESERVE_BIT_EXT, - }; - device->p_vkUnmapMemory2KHR(device->host.device, &info); - } - - device->p_vkFreeMemory(device->host.device, memory->host.device_memory, NULL); - vulkan_instance_remove_object(instance, &memory->obj); - - if (memory->vm_map) - { - SIZE_T alloc_size = 0; - NtFreeVirtualMemory(GetCurrentProcess(), &memory->vm_map, &alloc_size, MEM_RELEASE); - } - - free(memory); -} - -VkResult wine_vkMapMemory(VkDevice client_device, VkDeviceMemory memory, VkDeviceSize offset, - VkDeviceSize size, VkMemoryMapFlags flags, void **data) -{ - const VkMemoryMapInfoKHR info = - { - .sType = VK_STRUCTURE_TYPE_MEMORY_MAP_INFO_KHR, - .flags = flags, - .memory = memory, - .offset = offset, - .size = size, - }; - - return wine_vkMapMemory2KHR(client_device, &info, data); -} - -VkResult wine_vkMapMemory2KHR(VkDevice client_device, const VkMemoryMapInfoKHR *map_info, void **data) -{ - struct vulkan_device *device = vulkan_device_from_handle(client_device); - struct vulkan_physical_device *physical_device = device->physical_device; - struct wine_device_memory *memory = wine_device_memory_from_handle(map_info->memory); - VkMemoryMapInfoKHR info = *map_info; - VkMemoryMapPlacedInfoEXT placed_info = - { - .sType = VK_STRUCTURE_TYPE_MEMORY_MAP_PLACED_INFO_EXT, - }; - VkResult result; - - info.memory = memory->host.device_memory; - if (memory->vm_map) - { - *data = (char *)memory->vm_map + info.offset; - TRACE("returning %p\n", *data); - return VK_SUCCESS; - } - - if (physical_device->map_placed_align) - { - SIZE_T alloc_size = memory->size; - - placed_info.pNext = info.pNext; - info.pNext = &placed_info; - info.offset = 0; - info.size = VK_WHOLE_SIZE; - info.flags |= VK_MEMORY_MAP_PLACED_BIT_EXT; - - if (NtAllocateVirtualMemory(GetCurrentProcess(), &placed_info.pPlacedAddress, zero_bits, &alloc_size, - MEM_COMMIT, PAGE_READWRITE)) - { - ERR("NtAllocateVirtualMemory failed\n"); - return VK_ERROR_OUT_OF_HOST_MEMORY; - } - } - - if (device->p_vkMapMemory2KHR) - { - result = device->p_vkMapMemory2KHR(device->host.device, &info, data); - } - else - { - assert(!info.pNext); - result = device->p_vkMapMemory(device->host.device, info.memory, info.offset, - info.size, info.flags, data); - } - - if (placed_info.pPlacedAddress) - { - if (result != VK_SUCCESS) - { - SIZE_T alloc_size = 0; - ERR("vkMapMemory2EXT failed: %d\n", result); - NtFreeVirtualMemory(GetCurrentProcess(), &placed_info.pPlacedAddress, &alloc_size, MEM_RELEASE); - return result; - } - memory->vm_map = placed_info.pPlacedAddress; - *data = (char *)memory->vm_map + map_info->offset; - TRACE("Using placed mapping %p\n", memory->vm_map); - } - -#ifdef _WIN64 - if (NtCurrentTeb()->WowTebOffset && result == VK_SUCCESS && (UINT_PTR)*data >> 32) - { - FIXME("returned mapping %p does not fit 32-bit pointer\n", *data); - device->p_vkUnmapMemory(device->host.device, memory->host.device_memory); - *data = NULL; - result = VK_ERROR_OUT_OF_HOST_MEMORY; - } -#endif - - return result; -} - -void wine_vkUnmapMemory(VkDevice client_device, VkDeviceMemory memory) -{ - const VkMemoryUnmapInfoKHR info = - { - .sType = VK_STRUCTURE_TYPE_MEMORY_UNMAP_INFO_KHR, - .memory = memory, - }; - - wine_vkUnmapMemory2KHR(client_device, &info); -} - -VkResult wine_vkUnmapMemory2KHR(VkDevice client_device, const VkMemoryUnmapInfoKHR *unmap_info) -{ - struct vulkan_device *device = vulkan_device_from_handle(client_device); - struct vulkan_physical_device *physical_device = device->physical_device; - struct wine_device_memory *memory = wine_device_memory_from_handle(unmap_info->memory); - VkMemoryUnmapInfoKHR info; - VkResult result; - - if (memory->vm_map && physical_device->external_memory_align) - return VK_SUCCESS; - - if (!device->p_vkUnmapMemory2KHR) - { - assert(!unmap_info->pNext && !memory->vm_map); - device->p_vkUnmapMemory(device->host.device, memory->host.device_memory); - return VK_SUCCESS; - } - - info = *unmap_info; - info.memory = memory->host.device_memory; - if (memory->vm_map) - info.flags |= VK_MEMORY_UNMAP_RESERVE_BIT_EXT; - - result = device->p_vkUnmapMemory2KHR(device->host.device, &info); - - if (result == VK_SUCCESS && memory->vm_map) - { - SIZE_T size = 0; - NtFreeVirtualMemory(GetCurrentProcess(), &memory->vm_map, &size, MEM_RELEASE); - memory->vm_map = NULL; - } - return result; -} - -VkResult wine_vkCreateBuffer(VkDevice client_device, const VkBufferCreateInfo *create_info, - const VkAllocationCallbacks *allocator, VkBuffer *buffer) -{ - struct vulkan_device *device = vulkan_device_from_handle(client_device); - struct vulkan_physical_device *physical_device = device->physical_device; - VkExternalMemoryBufferCreateInfo external_memory_info; - VkBufferCreateInfo info = *create_info; - - if (physical_device->external_memory_align && - !find_next_struct(info.pNext, VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO)) - { - external_memory_info.sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO; - external_memory_info.pNext = info.pNext; - external_memory_info.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT; - info.pNext = &external_memory_info; - } - - return device->p_vkCreateBuffer(device->host.device, &info, NULL, buffer); -} - -VkResult wine_vkCreateImage(VkDevice client_device, const VkImageCreateInfo *create_info, - const VkAllocationCallbacks *allocator, VkImage *image) -{ - struct vulkan_device *device = vulkan_device_from_handle(client_device); - struct vulkan_physical_device *physical_device = device->physical_device; - VkExternalMemoryImageCreateInfo external_memory_info; - VkImageCreateInfo info = *create_info; - - if (physical_device->external_memory_align && - !find_next_struct(info.pNext, VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO)) - { - external_memory_info.sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO; - external_memory_info.pNext = info.pNext; - external_memory_info.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT; - info.pNext = &external_memory_info; - } - - return device->p_vkCreateImage(device->host.device, &info, NULL, image); -} - VkResult wine_vkCreateDebugUtilsMessengerEXT(VkInstance client_instance, const VkDebugUtilsMessengerCreateInfoEXT *create_info, const VkAllocationCallbacks *allocator, diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h index d9ff386b469..da520433467 100644 --- a/dlls/winevulkan/vulkan_private.h +++ b/dlls/winevulkan/vulkan_private.h @@ -100,18 +100,6 @@ static inline struct wine_cmd_pool *wine_cmd_pool_from_handle(VkCommandPool hand return (struct wine_cmd_pool *)(UINT_PTR)client->unix_handle; }
-struct wine_device_memory -{ - VULKAN_OBJECT_HEADER( VkDeviceMemory, device_memory ); - VkDeviceSize size; - void *vm_map; -}; - -static inline struct wine_device_memory *wine_device_memory_from_handle(VkDeviceMemory handle) -{ - return (struct wine_device_memory *)(uintptr_t)handle; -} - struct wine_debug_utils_messenger { VULKAN_OBJECT_HEADER( VkDebugUtilsMessengerEXT, debug_messenger ); diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c index c8045fa397e..3d8882c8db0 100644 --- a/dlls/winevulkan/vulkan_thunks.c +++ b/dlls/winevulkan/vulkan_thunks.c @@ -9540,7 +9540,7 @@ static uint64_t wine_vk_unwrap_handle(uint32_t type, uint64_t handle) case VK_OBJECT_TYPE_DEVICE: return (uint64_t) (uintptr_t) vulkan_device_from_handle(((VkDevice) (uintptr_t) handle))->host.device; case VK_OBJECT_TYPE_DEVICE_MEMORY: - return (uint64_t) wine_device_memory_from_handle(handle)->host.device_memory; + return (uint64_t) vulkan_device_memory_from_handle(handle)->host.device_memory; case VK_OBJECT_TYPE_INSTANCE: return (uint64_t) (uintptr_t) vulkan_instance_from_handle(((VkInstance) (uintptr_t) handle))->host.instance; case VK_OBJECT_TYPE_PHYSICAL_DEVICE: @@ -9934,7 +9934,7 @@ static inline void convert_VkCommandBufferInheritanceInfo_win64_to_host(struct c const VkTileMemoryBindInfoQCOM *in_ext = (const VkTileMemoryBindInfoQCOM *)in_header; out_ext->sType = VK_STRUCTURE_TYPE_TILE_MEMORY_BIND_INFO_QCOM; out_ext->pNext = NULL; - out_ext->memory = wine_device_memory_from_handle(in_ext->memory)->host.device_memory; + out_ext->memory = vulkan_device_memory_from_handle(in_ext->memory)->host.device_memory; out_header->pNext = (void *)out_ext; out_header = (void *)out_ext; break; @@ -10077,7 +10077,7 @@ static inline void convert_VkCommandBufferInheritanceInfo_win32_to_host(struct c const VkTileMemoryBindInfoQCOM32 *in_ext = (const VkTileMemoryBindInfoQCOM32 *)in_header; out_ext->sType = VK_STRUCTURE_TYPE_TILE_MEMORY_BIND_INFO_QCOM; out_ext->pNext = NULL; - out_ext->memory = wine_device_memory_from_handle(in_ext->memory)->host.device_memory; + out_ext->memory = vulkan_device_memory_from_handle(in_ext->memory)->host.device_memory; out_header->pNext = (void *)out_ext; out_header = (void *)out_ext; break; @@ -10215,7 +10215,7 @@ static inline void convert_VkBindAccelerationStructureMemoryInfoNV_win64_to_host out->sType = in->sType; out->pNext = in->pNext; out->accelerationStructure = in->accelerationStructure; - out->memory = wine_device_memory_from_handle(in->memory)->host.device_memory; + out->memory = vulkan_device_memory_from_handle(in->memory)->host.device_memory; out->memoryOffset = in->memoryOffset; out->deviceIndexCount = in->deviceIndexCount; out->pDeviceIndices = in->pDeviceIndices; @@ -10229,7 +10229,7 @@ static inline void convert_VkBindAccelerationStructureMemoryInfoNV_win32_to_host out->sType = in->sType; out->pNext = NULL; out->accelerationStructure = in->accelerationStructure; - out->memory = wine_device_memory_from_handle(in->memory)->host.device_memory; + out->memory = vulkan_device_memory_from_handle(in->memory)->host.device_memory; out->memoryOffset = in->memoryOffset; out->deviceIndexCount = in->deviceIndexCount; out->pDeviceIndices = UlongToPtr(in->pDeviceIndices); @@ -10279,7 +10279,7 @@ static inline void convert_VkBindBufferMemoryInfo_win64_to_host(const VkBindBuff out->sType = in->sType; out->pNext = in->pNext; out->buffer = in->buffer; - out->memory = wine_device_memory_from_handle(in->memory)->host.device_memory; + out->memory = vulkan_device_memory_from_handle(in->memory)->host.device_memory; out->memoryOffset = in->memoryOffset; } #endif /* _WIN64 */ @@ -10294,7 +10294,7 @@ static inline void convert_VkBindBufferMemoryInfo_win32_to_host(struct conversio out->sType = in->sType; out->pNext = NULL; out->buffer = in->buffer; - out->memory = wine_device_memory_from_handle(in->memory)->host.device_memory; + out->memory = vulkan_device_memory_from_handle(in->memory)->host.device_memory; out->memoryOffset = in->memoryOffset;
for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) @@ -10375,7 +10375,7 @@ static inline void convert_VkBindDataGraphPipelineSessionMemoryInfoARM_win64_to_ out->session = in->session; out->bindPoint = in->bindPoint; out->objectIndex = in->objectIndex; - out->memory = wine_device_memory_from_handle(in->memory)->host.device_memory; + out->memory = vulkan_device_memory_from_handle(in->memory)->host.device_memory; out->memoryOffset = in->memoryOffset; } #endif /* _WIN64 */ @@ -10389,7 +10389,7 @@ static inline void convert_VkBindDataGraphPipelineSessionMemoryInfoARM_win32_to_ out->session = in->session; out->bindPoint = in->bindPoint; out->objectIndex = in->objectIndex; - out->memory = wine_device_memory_from_handle(in->memory)->host.device_memory; + out->memory = vulkan_device_memory_from_handle(in->memory)->host.device_memory; out->memoryOffset = in->memoryOffset; if (in->pNext) FIXME("Unexpected pNext\n"); @@ -10440,7 +10440,7 @@ static inline void convert_VkBindImageMemoryInfo_win64_to_host(struct conversion out->sType = in->sType; out->pNext = NULL; out->image = in->image; - out->memory = wine_device_memory_from_handle(in->memory)->host.device_memory; + out->memory = vulkan_device_memory_from_handle(in->memory)->host.device_memory; out->memoryOffset = in->memoryOffset;
for (in_header = (void *)in->pNext; in_header; in_header = (void *)in_header->pNext) @@ -10513,7 +10513,7 @@ static inline void convert_VkBindImageMemoryInfo_win32_to_host(struct conversion out->sType = in->sType; out->pNext = NULL; out->image = in->image; - out->memory = wine_device_memory_from_handle(in->memory)->host.device_memory; + out->memory = vulkan_device_memory_from_handle(in->memory)->host.device_memory; out->memoryOffset = in->memoryOffset;
for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) @@ -10617,7 +10617,7 @@ static inline void convert_VkBindTensorMemoryInfoARM_win64_to_host(const VkBindT out->sType = in->sType; out->pNext = in->pNext; out->tensor = in->tensor; - out->memory = wine_device_memory_from_handle(in->memory)->host.device_memory; + out->memory = vulkan_device_memory_from_handle(in->memory)->host.device_memory; out->memoryOffset = in->memoryOffset; } #endif /* _WIN64 */ @@ -10629,7 +10629,7 @@ static inline void convert_VkBindTensorMemoryInfoARM_win32_to_host(const VkBindT out->sType = in->sType; out->pNext = NULL; out->tensor = in->tensor; - out->memory = wine_device_memory_from_handle(in->memory)->host.device_memory; + out->memory = vulkan_device_memory_from_handle(in->memory)->host.device_memory; out->memoryOffset = in->memoryOffset; if (in->pNext) FIXME("Unexpected pNext\n"); @@ -10677,7 +10677,7 @@ static inline void convert_VkBindVideoSessionMemoryInfoKHR_win64_to_host(const V out->sType = in->sType; out->pNext = in->pNext; out->memoryBindIndex = in->memoryBindIndex; - out->memory = wine_device_memory_from_handle(in->memory)->host.device_memory; + out->memory = vulkan_device_memory_from_handle(in->memory)->host.device_memory; out->memoryOffset = in->memoryOffset; out->memorySize = in->memorySize; } @@ -10690,7 +10690,7 @@ static inline void convert_VkBindVideoSessionMemoryInfoKHR_win32_to_host(const V out->sType = in->sType; out->pNext = NULL; out->memoryBindIndex = in->memoryBindIndex; - out->memory = wine_device_memory_from_handle(in->memory)->host.device_memory; + out->memory = vulkan_device_memory_from_handle(in->memory)->host.device_memory; out->memoryOffset = in->memoryOffset; out->memorySize = in->memorySize; if (in->pNext) @@ -11922,7 +11922,7 @@ static inline void convert_VkTileMemoryBindInfoQCOM_win64_to_host(const VkTileMe
out->sType = in->sType; out->pNext = in->pNext; - out->memory = wine_device_memory_from_handle(in->memory)->host.device_memory; + out->memory = vulkan_device_memory_from_handle(in->memory)->host.device_memory; } #endif /* _WIN64 */
@@ -11932,7 +11932,7 @@ static inline void convert_VkTileMemoryBindInfoQCOM_win32_to_host(const VkTileMe
out->sType = in->sType; out->pNext = NULL; - out->memory = wine_device_memory_from_handle(in->memory)->host.device_memory; + out->memory = vulkan_device_memory_from_handle(in->memory)->host.device_memory; if (in->pNext) FIXME("Unexpected pNext\n"); } @@ -26751,7 +26751,7 @@ static inline void convert_VkMappedMemoryRange_win64_to_host(const VkMappedMemor
out->sType = in->sType; out->pNext = in->pNext; - out->memory = wine_device_memory_from_handle(in->memory)->host.device_memory; + out->memory = vulkan_device_memory_from_handle(in->memory)->host.device_memory; out->offset = in->offset; out->size = in->size; } @@ -26763,7 +26763,7 @@ static inline void convert_VkMappedMemoryRange_win32_to_host(const VkMappedMemor
out->sType = in->sType; out->pNext = NULL; - out->memory = wine_device_memory_from_handle(in->memory)->host.device_memory; + out->memory = vulkan_device_memory_from_handle(in->memory)->host.device_memory; out->offset = in->offset; out->size = in->size; if (in->pNext) @@ -27804,7 +27804,7 @@ static inline void convert_VkDeviceMemoryOpaqueCaptureAddressInfo_win64_to_host(
out->sType = in->sType; out->pNext = in->pNext; - out->memory = wine_device_memory_from_handle(in->memory)->host.device_memory; + out->memory = vulkan_device_memory_from_handle(in->memory)->host.device_memory; } #endif /* _WIN64 */
@@ -27814,7 +27814,7 @@ static inline void convert_VkDeviceMemoryOpaqueCaptureAddressInfo_win32_to_host(
out->sType = in->sType; out->pNext = NULL; - out->memory = wine_device_memory_from_handle(in->memory)->host.device_memory; + out->memory = vulkan_device_memory_from_handle(in->memory)->host.device_memory; if (in->pNext) FIXME("Unexpected pNext\n"); } @@ -38466,7 +38466,7 @@ static inline void convert_VkMemoryMapInfo_win64_to_host(const VkMemoryMapInfo * out->sType = in->sType; out->pNext = in->pNext; out->flags = in->flags; - out->memory = wine_device_memory_from_handle(in->memory)->host.device_memory; + out->memory = vulkan_device_memory_from_handle(in->memory)->host.device_memory; out->offset = in->offset; out->size = in->size; } @@ -38482,7 +38482,7 @@ static inline void convert_VkMemoryMapInfo_win32_to_host(struct conversion_conte out->sType = in->sType; out->pNext = NULL; out->flags = in->flags; - out->memory = wine_device_memory_from_handle(in->memory)->host.device_memory; + out->memory = vulkan_device_memory_from_handle(in->memory)->host.device_memory; out->offset = in->offset; out->size = in->size;
@@ -38551,7 +38551,7 @@ static inline void convert_VkSparseMemoryBind_win64_to_host(const VkSparseMemory
out->resourceOffset = in->resourceOffset; out->size = in->size; - out->memory = in->memory ? wine_device_memory_from_handle(in->memory)->host.device_memory : 0; + out->memory = in->memory ? vulkan_device_memory_from_handle(in->memory)->host.device_memory : 0; out->memoryOffset = in->memoryOffset; out->flags = in->flags; } @@ -38563,7 +38563,7 @@ static inline void convert_VkSparseMemoryBind_win32_to_host(const VkSparseMemory
out->resourceOffset = in->resourceOffset; out->size = in->size; - out->memory = in->memory ? wine_device_memory_from_handle(in->memory)->host.device_memory : 0; + out->memory = in->memory ? vulkan_device_memory_from_handle(in->memory)->host.device_memory : 0; out->memoryOffset = in->memoryOffset; out->flags = in->flags; } @@ -38718,7 +38718,7 @@ static inline void convert_VkSparseImageMemoryBind_win64_to_host(const VkSparseI out->subresource = in->subresource; out->offset = in->offset; out->extent = in->extent; - out->memory = in->memory ? wine_device_memory_from_handle(in->memory)->host.device_memory : 0; + out->memory = in->memory ? vulkan_device_memory_from_handle(in->memory)->host.device_memory : 0; out->memoryOffset = in->memoryOffset; out->flags = in->flags; } @@ -38731,7 +38731,7 @@ static inline void convert_VkSparseImageMemoryBind_win32_to_host(const VkSparseI out->subresource = in->subresource; out->offset = in->offset; out->extent = in->extent; - out->memory = in->memory ? wine_device_memory_from_handle(in->memory)->host.device_memory : 0; + out->memory = in->memory ? vulkan_device_memory_from_handle(in->memory)->host.device_memory : 0; out->memoryOffset = in->memoryOffset; out->flags = in->flags; } @@ -39922,7 +39922,7 @@ static inline void convert_VkMemoryUnmapInfo_win64_to_host(const VkMemoryUnmapIn out->sType = in->sType; out->pNext = in->pNext; out->flags = in->flags; - out->memory = wine_device_memory_from_handle(in->memory)->host.device_memory; + out->memory = vulkan_device_memory_from_handle(in->memory)->host.device_memory; } #endif /* _WIN64 */
@@ -39933,7 +39933,7 @@ static inline void convert_VkMemoryUnmapInfo_win32_to_host(const VkMemoryUnmapIn out->sType = in->sType; out->pNext = NULL; out->flags = in->flags; - out->memory = wine_device_memory_from_handle(in->memory)->host.device_memory; + out->memory = vulkan_device_memory_from_handle(in->memory)->host.device_memory; if (in->pNext) FIXME("Unexpected pNext\n"); } @@ -40312,7 +40312,7 @@ static NTSTATUS thunk64_vkAllocateMemory(void *args)
TRACE("%p, %p, %p, %p\n", params->device, params->pAllocateInfo, params->pAllocator, params->pMemory);
- params->result = wine_vkAllocateMemory(params->device, params->pAllocateInfo, params->pAllocator, params->pMemory); + params->result = vk_funcs->p_vkAllocateMemory(params->device, params->pAllocateInfo, params->pAllocator, params->pMemory); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -40335,7 +40335,7 @@ static NTSTATUS thunk32_vkAllocateMemory(void *args)
init_conversion_context(ctx); convert_VkMemoryAllocateInfo_win32_to_host(ctx, (const VkMemoryAllocateInfo32 *)UlongToPtr(params->pAllocateInfo), &pAllocateInfo_host); - params->result = wine_vkAllocateMemory((VkDevice)UlongToPtr(params->device), &pAllocateInfo_host, (const VkAllocationCallbacks *)UlongToPtr(params->pAllocator), (VkDeviceMemory *)UlongToPtr(params->pMemory)); + params->result = vk_funcs->p_vkAllocateMemory((VkDevice)UlongToPtr(params->device), &pAllocateInfo_host, (const VkAllocationCallbacks *)UlongToPtr(params->pAllocator), (VkDeviceMemory *)UlongToPtr(params->pMemory)); free_conversion_context(ctx); return STATUS_SUCCESS; } @@ -40458,7 +40458,7 @@ static NTSTATUS thunk64_vkBindBufferMemory(void *args)
TRACE("%p, 0x%s, 0x%s, 0x%s\n", params->device, wine_dbgstr_longlong(params->buffer), wine_dbgstr_longlong(params->memory), wine_dbgstr_longlong(params->memoryOffset));
- params->result = vulkan_device_from_handle(params->device)->p_vkBindBufferMemory(vulkan_device_from_handle(params->device)->host.device, params->buffer, wine_device_memory_from_handle(params->memory)->host.device_memory, params->memoryOffset); + params->result = vulkan_device_from_handle(params->device)->p_vkBindBufferMemory(vulkan_device_from_handle(params->device)->host.device, params->buffer, vulkan_device_memory_from_handle(params->memory)->host.device_memory, params->memoryOffset); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -40476,7 +40476,7 @@ static NTSTATUS thunk32_vkBindBufferMemory(void *args)
TRACE("%#x, 0x%s, 0x%s, 0x%s\n", params->device, wine_dbgstr_longlong(params->buffer), wine_dbgstr_longlong(params->memory), wine_dbgstr_longlong(params->memoryOffset));
- params->result = vulkan_device_from_handle((VkDevice)UlongToPtr(params->device))->p_vkBindBufferMemory(vulkan_device_from_handle((VkDevice)UlongToPtr(params->device))->host.device, params->buffer, wine_device_memory_from_handle(params->memory)->host.device_memory, params->memoryOffset); + params->result = vulkan_device_from_handle((VkDevice)UlongToPtr(params->device))->p_vkBindBufferMemory(vulkan_device_from_handle((VkDevice)UlongToPtr(params->device))->host.device, params->buffer, vulkan_device_memory_from_handle(params->memory)->host.device_memory, params->memoryOffset); return STATUS_SUCCESS; }
@@ -40607,7 +40607,7 @@ static NTSTATUS thunk64_vkBindImageMemory(void *args)
TRACE("%p, 0x%s, 0x%s, 0x%s\n", params->device, wine_dbgstr_longlong(params->image), wine_dbgstr_longlong(params->memory), wine_dbgstr_longlong(params->memoryOffset));
- params->result = vulkan_device_from_handle(params->device)->p_vkBindImageMemory(vulkan_device_from_handle(params->device)->host.device, params->image, wine_device_memory_from_handle(params->memory)->host.device_memory, params->memoryOffset); + params->result = vulkan_device_from_handle(params->device)->p_vkBindImageMemory(vulkan_device_from_handle(params->device)->host.device, params->image, vulkan_device_memory_from_handle(params->memory)->host.device_memory, params->memoryOffset); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -40625,7 +40625,7 @@ static NTSTATUS thunk32_vkBindImageMemory(void *args)
TRACE("%#x, 0x%s, 0x%s, 0x%s\n", params->device, wine_dbgstr_longlong(params->image), wine_dbgstr_longlong(params->memory), wine_dbgstr_longlong(params->memoryOffset));
- params->result = vulkan_device_from_handle((VkDevice)UlongToPtr(params->device))->p_vkBindImageMemory(vulkan_device_from_handle((VkDevice)UlongToPtr(params->device))->host.device, params->image, wine_device_memory_from_handle(params->memory)->host.device_memory, params->memoryOffset); + params->result = vulkan_device_from_handle((VkDevice)UlongToPtr(params->device))->p_vkBindImageMemory(vulkan_device_from_handle((VkDevice)UlongToPtr(params->device))->host.device, params->image, vulkan_device_memory_from_handle(params->memory)->host.device_memory, params->memoryOffset); return STATUS_SUCCESS; }
@@ -47775,7 +47775,7 @@ static NTSTATUS thunk64_vkCreateBuffer(void *args)
TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pBuffer);
- params->result = wine_vkCreateBuffer(params->device, params->pCreateInfo, params->pAllocator, params->pBuffer); + params->result = vk_funcs->p_vkCreateBuffer(params->device, params->pCreateInfo, params->pAllocator, params->pBuffer); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -47798,7 +47798,7 @@ static NTSTATUS thunk32_vkCreateBuffer(void *args)
init_conversion_context(ctx); convert_VkBufferCreateInfo_win32_to_host(ctx, (const VkBufferCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_vkCreateBuffer((VkDevice)UlongToPtr(params->device), &pCreateInfo_host, (const VkAllocationCallbacks *)UlongToPtr(params->pAllocator), (VkBuffer *)UlongToPtr(params->pBuffer)); + params->result = vk_funcs->p_vkCreateBuffer((VkDevice)UlongToPtr(params->device), &pCreateInfo_host, (const VkAllocationCallbacks *)UlongToPtr(params->pAllocator), (VkBuffer *)UlongToPtr(params->pBuffer)); free_conversion_context(ctx); return STATUS_SUCCESS; } @@ -48490,7 +48490,7 @@ static NTSTATUS thunk64_vkCreateImage(void *args)
init_conversion_context(ctx); convert_VkImageCreateInfo_win64_to_host(ctx, params->pCreateInfo, &pCreateInfo_host); - params->result = wine_vkCreateImage(params->device, &pCreateInfo_host, params->pAllocator, params->pImage); + params->result = vk_funcs->p_vkCreateImage(params->device, &pCreateInfo_host, params->pAllocator, params->pImage); free_conversion_context(ctx); return STATUS_SUCCESS; } @@ -48514,7 +48514,7 @@ static NTSTATUS thunk32_vkCreateImage(void *args)
init_conversion_context(ctx); convert_VkImageCreateInfo_win32_to_host(ctx, (const VkImageCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_vkCreateImage((VkDevice)UlongToPtr(params->device), &pCreateInfo_host, (const VkAllocationCallbacks *)UlongToPtr(params->pAllocator), (VkImage *)UlongToPtr(params->pImage)); + params->result = vk_funcs->p_vkCreateImage((VkDevice)UlongToPtr(params->device), &pCreateInfo_host, (const VkAllocationCallbacks *)UlongToPtr(params->pAllocator), (VkImage *)UlongToPtr(params->pImage)); free_conversion_context(ctx); return STATUS_SUCCESS; } @@ -51461,7 +51461,7 @@ static NTSTATUS thunk64_vkFreeMemory(void *args)
TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->memory), params->pAllocator);
- wine_vkFreeMemory(params->device, params->memory, params->pAllocator); + vk_funcs->p_vkFreeMemory(params->device, params->memory, params->pAllocator); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -51477,7 +51477,7 @@ static NTSTATUS thunk32_vkFreeMemory(void *args)
TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->memory), params->pAllocator);
- wine_vkFreeMemory((VkDevice)UlongToPtr(params->device), params->memory, (const VkAllocationCallbacks *)UlongToPtr(params->pAllocator)); + vk_funcs->p_vkFreeMemory((VkDevice)UlongToPtr(params->device), params->memory, (const VkAllocationCallbacks *)UlongToPtr(params->pAllocator)); return STATUS_SUCCESS; }
@@ -52957,7 +52957,7 @@ static NTSTATUS thunk64_vkGetDeviceMemoryCommitment(void *args)
TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->memory), params->pCommittedMemoryInBytes);
- vulkan_device_from_handle(params->device)->p_vkGetDeviceMemoryCommitment(vulkan_device_from_handle(params->device)->host.device, wine_device_memory_from_handle(params->memory)->host.device_memory, params->pCommittedMemoryInBytes); + vulkan_device_from_handle(params->device)->p_vkGetDeviceMemoryCommitment(vulkan_device_from_handle(params->device)->host.device, vulkan_device_memory_from_handle(params->memory)->host.device_memory, params->pCommittedMemoryInBytes); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -52973,7 +52973,7 @@ static NTSTATUS thunk32_vkGetDeviceMemoryCommitment(void *args)
TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->memory), params->pCommittedMemoryInBytes);
- vulkan_device_from_handle((VkDevice)UlongToPtr(params->device))->p_vkGetDeviceMemoryCommitment(vulkan_device_from_handle((VkDevice)UlongToPtr(params->device))->host.device, wine_device_memory_from_handle(params->memory)->host.device_memory, (VkDeviceSize *)UlongToPtr(params->pCommittedMemoryInBytes)); + vulkan_device_from_handle((VkDevice)UlongToPtr(params->device))->p_vkGetDeviceMemoryCommitment(vulkan_device_from_handle((VkDevice)UlongToPtr(params->device))->host.device, vulkan_device_memory_from_handle(params->memory)->host.device_memory, (VkDeviceSize *)UlongToPtr(params->pCommittedMemoryInBytes)); return STATUS_SUCCESS; }
@@ -57108,7 +57108,7 @@ static NTSTATUS thunk64_vkMapMemory(void *args)
TRACE("%p, 0x%s, 0x%s, 0x%s, %#x, %p\n", params->device, wine_dbgstr_longlong(params->memory), wine_dbgstr_longlong(params->offset), wine_dbgstr_longlong(params->size), params->flags, params->ppData);
- params->result = wine_vkMapMemory(params->device, params->memory, params->offset, params->size, params->flags, params->ppData); + params->result = vk_funcs->p_vkMapMemory(params->device, params->memory, params->offset, params->size, params->flags, params->ppData); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -57130,7 +57130,7 @@ static NTSTATUS thunk32_vkMapMemory(void *args) TRACE("%#x, 0x%s, 0x%s, 0x%s, %#x, %#x\n", params->device, wine_dbgstr_longlong(params->memory), wine_dbgstr_longlong(params->offset), wine_dbgstr_longlong(params->size), params->flags, params->ppData);
ppData_host = UlongToPtr(*(PTR32 *)UlongToPtr(params->ppData)); - params->result = wine_vkMapMemory((VkDevice)UlongToPtr(params->device), params->memory, params->offset, params->size, params->flags, &ppData_host); + params->result = vk_funcs->p_vkMapMemory((VkDevice)UlongToPtr(params->device), params->memory, params->offset, params->size, params->flags, &ppData_host); *(PTR32 *)UlongToPtr(params->ppData) = PtrToUlong(ppData_host); return STATUS_SUCCESS; } @@ -57181,7 +57181,7 @@ static NTSTATUS thunk64_vkMapMemory2KHR(void *args)
TRACE("%p, %p, %p\n", params->device, params->pMemoryMapInfo, params->ppData);
- params->result = wine_vkMapMemory2KHR(params->device, params->pMemoryMapInfo, params->ppData); + params->result = vk_funcs->p_vkMapMemory2KHR(params->device, params->pMemoryMapInfo, params->ppData); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -57205,7 +57205,7 @@ static NTSTATUS thunk32_vkMapMemory2KHR(void *args) init_conversion_context(ctx); convert_VkMemoryMapInfo_win32_to_unwrapped_host(ctx, (const VkMemoryMapInfo32 *)UlongToPtr(params->pMemoryMapInfo), &pMemoryMapInfo_host); ppData_host = UlongToPtr(*(PTR32 *)UlongToPtr(params->ppData)); - params->result = wine_vkMapMemory2KHR((VkDevice)UlongToPtr(params->device), &pMemoryMapInfo_host, &ppData_host); + params->result = vk_funcs->p_vkMapMemory2KHR((VkDevice)UlongToPtr(params->device), &pMemoryMapInfo_host, &ppData_host); *(PTR32 *)UlongToPtr(params->ppData) = PtrToUlong(ppData_host); free_conversion_context(ctx); return STATUS_SUCCESS; @@ -58035,7 +58035,7 @@ static NTSTATUS thunk64_vkSetDeviceMemoryPriorityEXT(void *args)
TRACE("%p, 0x%s, %f\n", params->device, wine_dbgstr_longlong(params->memory), params->priority);
- vulkan_device_from_handle(params->device)->p_vkSetDeviceMemoryPriorityEXT(vulkan_device_from_handle(params->device)->host.device, wine_device_memory_from_handle(params->memory)->host.device_memory, params->priority); + vulkan_device_from_handle(params->device)->p_vkSetDeviceMemoryPriorityEXT(vulkan_device_from_handle(params->device)->host.device, vulkan_device_memory_from_handle(params->memory)->host.device_memory, params->priority); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -58051,7 +58051,7 @@ static NTSTATUS thunk32_vkSetDeviceMemoryPriorityEXT(void *args)
TRACE("%#x, 0x%s, %f\n", params->device, wine_dbgstr_longlong(params->memory), params->priority);
- vulkan_device_from_handle((VkDevice)UlongToPtr(params->device))->p_vkSetDeviceMemoryPriorityEXT(vulkan_device_from_handle((VkDevice)UlongToPtr(params->device))->host.device, wine_device_memory_from_handle(params->memory)->host.device_memory, params->priority); + vulkan_device_from_handle((VkDevice)UlongToPtr(params->device))->p_vkSetDeviceMemoryPriorityEXT(vulkan_device_from_handle((VkDevice)UlongToPtr(params->device))->host.device, vulkan_device_memory_from_handle(params->memory)->host.device_memory, params->priority); return STATUS_SUCCESS; }
@@ -58495,7 +58495,7 @@ static NTSTATUS thunk64_vkUnmapMemory(void *args)
TRACE("%p, 0x%s\n", params->device, wine_dbgstr_longlong(params->memory));
- wine_vkUnmapMemory(params->device, params->memory); + vk_funcs->p_vkUnmapMemory(params->device, params->memory); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -58510,7 +58510,7 @@ static NTSTATUS thunk32_vkUnmapMemory(void *args)
TRACE("%#x, 0x%s\n", params->device, wine_dbgstr_longlong(params->memory));
- wine_vkUnmapMemory((VkDevice)UlongToPtr(params->device), params->memory); + vk_funcs->p_vkUnmapMemory((VkDevice)UlongToPtr(params->device), params->memory); return STATUS_SUCCESS; }
@@ -58552,7 +58552,7 @@ static NTSTATUS thunk64_vkUnmapMemory2KHR(void *args)
TRACE("%p, %p\n", params->device, params->pMemoryUnmapInfo);
- params->result = wine_vkUnmapMemory2KHR(params->device, params->pMemoryUnmapInfo); + params->result = vk_funcs->p_vkUnmapMemory2KHR(params->device, params->pMemoryUnmapInfo); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -58570,7 +58570,7 @@ static NTSTATUS thunk32_vkUnmapMemory2KHR(void *args) TRACE("%#x, %#x\n", params->device, params->pMemoryUnmapInfo);
convert_VkMemoryUnmapInfo_win32_to_unwrapped_host((const VkMemoryUnmapInfo32 *)UlongToPtr(params->pMemoryUnmapInfo), &pMemoryUnmapInfo_host); - params->result = wine_vkUnmapMemory2KHR((VkDevice)UlongToPtr(params->device), &pMemoryUnmapInfo_host); + params->result = vk_funcs->p_vkUnmapMemory2KHR((VkDevice)UlongToPtr(params->device), &pMemoryUnmapInfo_host); return STATUS_SUCCESS; }
diff --git a/dlls/winevulkan/vulkan_thunks.h b/dlls/winevulkan/vulkan_thunks.h index 23dbf19424d..4f5abf6cabc 100644 --- a/dlls/winevulkan/vulkan_thunks.h +++ b/dlls/winevulkan/vulkan_thunks.h @@ -22,14 +22,11 @@
/* Functions for which we have custom implementations outside of the thunks. */ VkResult wine_vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo, VkCommandBuffer *pCommandBuffers); -VkResult wine_vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo, const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory); -VkResult wine_vkCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer); VkResult wine_vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkCommandPool *pCommandPool, void *client_ptr); VkResult wine_vkCreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT *pCallback); VkResult wine_vkCreateDebugUtilsMessengerEXT(VkInstance instance, const VkDebugUtilsMessengerCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDebugUtilsMessengerEXT *pMessenger); VkResult wine_vkCreateDeferredOperationKHR(VkDevice device, const VkAllocationCallbacks *pAllocator, VkDeferredOperationKHR *pDeferredOperation); VkResult wine_vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDevice *pDevice, void *client_ptr); -VkResult wine_vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkImage *pImage); VkResult wine_vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkInstance *pInstance, void *client_ptr); void wine_vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks *pAllocator); void wine_vkDestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks *pAllocator); @@ -45,7 +42,6 @@ VkResult wine_vkEnumeratePhysicalDeviceGroups(VkInstance instance, uint32_t *pPh VkResult wine_vkEnumeratePhysicalDeviceGroupsKHR(VkInstance instance, uint32_t *pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupProperties *pPhysicalDeviceGroupProperties); VkResult wine_vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, VkPhysicalDevice *pPhysicalDevices); void wine_vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer *pCommandBuffers); -void wine_vkFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks *pAllocator); VkResult wine_vkGetCalibratedTimestampsEXT(VkDevice device, uint32_t timestampCount, const VkCalibratedTimestampInfoKHR *pTimestampInfos, uint64_t *pTimestamps, uint64_t *pMaxDeviation); VkResult wine_vkGetCalibratedTimestampsKHR(VkDevice device, uint32_t timestampCount, const VkCalibratedTimestampInfoKHR *pTimestampInfos, uint64_t *pTimestamps, uint64_t *pMaxDeviation); void wine_vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue *pQueue); @@ -60,9 +56,5 @@ void wine_vkGetPhysicalDeviceExternalSemaphoreProperties(VkPhysicalDevice physic 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); -VkResult wine_vkMapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void **ppData); -VkResult wine_vkMapMemory2KHR(VkDevice device, const VkMemoryMapInfo *pMemoryMapInfo, void **ppData); -void wine_vkUnmapMemory(VkDevice device, VkDeviceMemory memory); -VkResult wine_vkUnmapMemory2KHR(VkDevice device, const VkMemoryUnmapInfo *pMemoryUnmapInfo);
#endif /* __WINE_VULKAN_THUNKS_H */ diff --git a/include/wine/vulkan_driver.h b/include/wine/vulkan_driver.h index b468046a949..c373f639451 100644 --- a/include/wine/vulkan_driver.h +++ b/include/wine/vulkan_driver.h @@ -138,6 +138,16 @@ static inline struct vulkan_queue *vulkan_queue_from_handle( VkQueue handle ) return (struct vulkan_queue *)(UINT_PTR)client->unix_handle; }
+struct vulkan_device_memory +{ + VULKAN_OBJECT_HEADER( VkDeviceMemory, device_memory ); +}; + +static inline struct vulkan_device_memory *vulkan_device_memory_from_handle( VkDeviceMemory handle ) +{ + return (struct vulkan_device_memory *)(UINT_PTR)handle; +} + struct vulkan_surface { VULKAN_OBJECT_HEADER( VkSurfaceKHR, surface ); @@ -167,10 +177,14 @@ struct vulkan_funcs */ PFN_vkAcquireNextImage2KHR p_vkAcquireNextImage2KHR; PFN_vkAcquireNextImageKHR p_vkAcquireNextImageKHR; + PFN_vkAllocateMemory p_vkAllocateMemory; + PFN_vkCreateBuffer p_vkCreateBuffer; + PFN_vkCreateImage p_vkCreateImage; PFN_vkCreateSwapchainKHR p_vkCreateSwapchainKHR; PFN_vkCreateWin32SurfaceKHR p_vkCreateWin32SurfaceKHR; PFN_vkDestroySurfaceKHR p_vkDestroySurfaceKHR; PFN_vkDestroySwapchainKHR p_vkDestroySwapchainKHR; + PFN_vkFreeMemory p_vkFreeMemory; PFN_vkGetDeviceProcAddr p_vkGetDeviceProcAddr; PFN_vkGetInstanceProcAddr p_vkGetInstanceProcAddr; PFN_vkGetPhysicalDevicePresentRectanglesKHR p_vkGetPhysicalDevicePresentRectanglesKHR; @@ -179,7 +193,11 @@ struct vulkan_funcs PFN_vkGetPhysicalDeviceSurfaceFormats2KHR p_vkGetPhysicalDeviceSurfaceFormats2KHR; PFN_vkGetPhysicalDeviceSurfaceFormatsKHR p_vkGetPhysicalDeviceSurfaceFormatsKHR; PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR p_vkGetPhysicalDeviceWin32PresentationSupportKHR; + PFN_vkMapMemory p_vkMapMemory; + PFN_vkMapMemory2KHR p_vkMapMemory2KHR; PFN_vkQueuePresentKHR p_vkQueuePresentKHR; + PFN_vkUnmapMemory p_vkUnmapMemory; + PFN_vkUnmapMemory2KHR p_vkUnmapMemory2KHR;
/* winevulkan specific functions */ const char *(*p_get_host_surface_extension)(void);