Fixes: b2764cf318acc318bc5a577571bcb84678b7e1cf
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/vulkan.c | 43 ++++++++++++++++++++++------ dlls/winevulkan/vulkan.c | 60 ---------------------------------------- 2 files changed, 35 insertions(+), 68 deletions(-)
diff --git a/dlls/win32u/vulkan.c b/dlls/win32u/vulkan.c index 3bc08d17ae8..673eeb41b4e 100644 --- a/dlls/win32u/vulkan.c +++ b/dlls/win32u/vulkan.c @@ -482,20 +482,24 @@ static void win32u_vkGetDeviceBufferMemoryRequirements( VkDevice client_device, 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 ) +static void win32u_vkGetPhysicalDeviceExternalBufferProperties( VkPhysicalDevice client_physical_device, const VkPhysicalDeviceExternalBufferInfo *client_buffer_info, + VkExternalBufferProperties *buffer_properties ) { + VkPhysicalDeviceExternalBufferInfo *buffer_info = (VkPhysicalDeviceExternalBufferInfo *)client_buffer_info; /* cast away const, it 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;
- TRACE( "physical_device %p, buffer_info %p, buffer_properies %p\n", physical_device, buffer_info, buffer_properies ); + TRACE( "physical_device %p, buffer_info %p, buffer_properties %p\n", physical_device, buffer_info, buffer_properties );
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 */ + buffer_info->handleType = 0;
- return instance->p_vkGetPhysicalDeviceExternalBufferProperties( physical_device->host.physical_device, buffer_info, buffer_properies ); + instance->p_vkGetPhysicalDeviceExternalBufferProperties( physical_device->host.physical_device, buffer_info, buffer_properties ); + buffer_properties->externalMemoryProperties.externalMemoryFeatures = 0; + buffer_properties->externalMemoryProperties.exportFromImportedHandleTypes = 0; + buffer_properties->externalMemoryProperties.compatibleHandleTypes = 0; }
static VkResult win32u_vkCreateImage( VkDevice client_device, const VkImageCreateInfo *create_info, @@ -578,14 +582,15 @@ static void win32u_vkGetDeviceImageMemoryRequirements( VkDevice client_device, c }
static VkResult win32u_vkGetPhysicalDeviceImageFormatProperties2( VkPhysicalDevice client_physical_device, const VkPhysicalDeviceImageFormatInfo2 *format_info, - VkImageFormatProperties2 *format_properies ) + VkImageFormatProperties2 *format_properties ) { 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; + VkResult res;
- TRACE( "physical_device %p, format_info %p, format_properies %p\n", physical_device, format_info, format_properies ); + TRACE( "physical_device %p, format_info %p, format_properties %p\n", physical_device, format_info, format_properties );
for (next = &prev->pNext; *next; prev = *next, next = &(*next)->pNext) { @@ -608,7 +613,29 @@ static VkResult win32u_vkGetPhysicalDeviceImageFormatProperties2( VkPhysicalDevi } }
- return instance->p_vkGetPhysicalDeviceImageFormatProperties2( physical_device->host.physical_device, format_info, format_properies ); + res = instance->p_vkGetPhysicalDeviceImageFormatProperties2( physical_device->host.physical_device, format_info, format_properties ); + if (!res) for (prev = (VkBaseOutStructure *)format_properties, next = &prev->pNext; *next; prev = *next, next = &(*next)->pNext) + { + switch ((*next)->sType) + { + case VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES: + { + VkExternalImageFormatProperties *props = (VkExternalImageFormatProperties *)*next; + props->externalMemoryProperties.externalMemoryFeatures = 0; + props->externalMemoryProperties.exportFromImportedHandleTypes = 0; + props->externalMemoryProperties.compatibleHandleTypes = 0; + break; + } + case VK_STRUCTURE_TYPE_FILTER_CUBIC_IMAGE_VIEW_IMAGE_FORMAT_PROPERTIES_EXT: break; + case VK_STRUCTURE_TYPE_HOST_IMAGE_COPY_DEVICE_PERFORMANCE_QUERY: break; + case VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_PROPERTIES_EXT: break; + case VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES: break; + case VK_STRUCTURE_TYPE_TEXTURE_LOD_GATHER_FORMAT_PROPERTIES_AMD: break; + default: FIXME( "Unhandled sType %u.\n", (*next)->sType ); break; + } + } + + return res; }
static VkResult win32u_vkCreateWin32SurfaceKHR( VkInstance client_instance, const VkWin32SurfaceCreateInfoKHR *create_info, diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 417406d66df..6325fd2bb43 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -1364,66 +1364,6 @@ void wine_vkGetPhysicalDeviceExternalFencePropertiesKHR(VkPhysicalDevice client_ properties->externalFenceFeatures = 0; }
-void wine_vkGetPhysicalDeviceExternalBufferProperties(VkPhysicalDevice client_physical_device, - const VkPhysicalDeviceExternalBufferInfo *buffer_info, - VkExternalBufferProperties *properties) -{ - memset(&properties->externalMemoryProperties, 0, sizeof(properties->externalMemoryProperties)); -} - -void wine_vkGetPhysicalDeviceExternalBufferPropertiesKHR(VkPhysicalDevice client_physical_device, - const VkPhysicalDeviceExternalBufferInfo *buffer_info, - VkExternalBufferProperties *properties) -{ - memset(&properties->externalMemoryProperties, 0, sizeof(properties->externalMemoryProperties)); -} - -VkResult wine_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice client_physical_device, - const VkPhysicalDeviceImageFormatInfo2 *format_info, - VkImageFormatProperties2 *properties) -{ - struct vulkan_physical_device *physical_device = vulkan_physical_device_from_handle(client_physical_device); - struct vulkan_instance *instance = physical_device->instance; - VkExternalImageFormatProperties *external_image_properties; - VkResult res; - - res = instance->p_vkGetPhysicalDeviceImageFormatProperties2(physical_device->host.physical_device, format_info, properties); - - if ((external_image_properties = find_next_struct(properties, - VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES))) - { - VkExternalMemoryProperties *p = &external_image_properties->externalMemoryProperties; - p->externalMemoryFeatures = 0; - p->exportFromImportedHandleTypes = 0; - p->compatibleHandleTypes = 0; - } - - return res; -} - -VkResult wine_vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice client_physical_device, - const VkPhysicalDeviceImageFormatInfo2 *format_info, - VkImageFormatProperties2 *properties) -{ - struct vulkan_physical_device *physical_device = vulkan_physical_device_from_handle(client_physical_device); - struct vulkan_instance *instance = physical_device->instance; - VkExternalImageFormatProperties *external_image_properties; - VkResult res; - - res = instance->p_vkGetPhysicalDeviceImageFormatProperties2KHR(physical_device->host.physical_device, format_info, properties); - - if ((external_image_properties = find_next_struct(properties, - VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES))) - { - VkExternalMemoryProperties *p = &external_image_properties->externalMemoryProperties; - p->externalMemoryFeatures = 0; - p->exportFromImportedHandleTypes = 0; - p->compatibleHandleTypes = 0; - } - - return res; -} - /* From ntdll/unix/sync.c */ #define NANOSECONDS_IN_A_SECOND 1000000000 #define TICKSPERSEC 10000000
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/vulkan.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/dlls/win32u/vulkan.c b/dlls/win32u/vulkan.c index 673eeb41b4e..149dd760cb7 100644 --- a/dlls/win32u/vulkan.c +++ b/dlls/win32u/vulkan.c @@ -92,7 +92,7 @@ static struct swapchain *swapchain_from_handle( VkSwapchainKHR handle ) return CONTAINING_RECORD( obj, struct swapchain, obj ); }
-static VkResult allocate_external_host_memory( struct vulkan_device *device, VkMemoryAllocateInfo *alloc_info, +static VkResult allocate_external_host_memory( struct vulkan_device *device, VkMemoryAllocateInfo *alloc_info, uint32_t mem_flags, VkImportMemoryHostPointerInfoEXT *import_info ) { struct vulkan_physical_device *physical_device = device->physical_device; @@ -100,7 +100,7 @@ static VkResult allocate_external_host_memory( struct vulkan_device *device, VkM { .sType = VK_STRUCTURE_TYPE_MEMORY_HOST_POINTER_PROPERTIES_EXT, }; - uint32_t i, mem_flags, align = physical_device->external_memory_align - 1; + uint32_t i, align = physical_device->external_memory_align - 1; SIZE_T alloc_size = alloc_info->allocationSize; static int once; void *mapping; @@ -108,8 +108,6 @@ static VkResult allocate_external_host_memory( struct vulkan_device *device, VkM
if (!once++) FIXME( "Using VK_EXT_external_memory_host\n" );
- mem_flags = physical_device->memory_properties.memoryTypes[alloc_info->memoryTypeIndex].propertyFlags; - if (NtAllocateVirtualMemory( GetCurrentProcess(), &mapping, zero_bits, &alloc_size, MEM_COMMIT, PAGE_READWRITE )) { ERR( "NtAllocateVirtualMemory failed\n" ); @@ -157,10 +155,11 @@ static VkResult allocate_external_host_memory( struct vulkan_device *device, VkM return VK_SUCCESS; }
-static VkResult win32u_vkAllocateMemory( VkDevice client_device, const VkMemoryAllocateInfo *alloc_info, +static VkResult win32u_vkAllocateMemory( VkDevice client_device, const VkMemoryAllocateInfo *client_alloc_info, const VkAllocationCallbacks *allocator, VkDeviceMemory *ret ) { - VkBaseOutStructure **next, *prev = (VkBaseOutStructure *)alloc_info; /* cast away const, chain has been copied in the thunks */ + VkMemoryAllocateInfo *alloc_info = (VkMemoryAllocateInfo *)client_alloc_info; /* cast away const, chain has been copied in the thunks */ + VkBaseOutStructure **next, *prev = (VkBaseOutStructure *)alloc_info; 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; @@ -207,7 +206,7 @@ static VkResult win32u_vkAllocateMemory( VkDevice client_device, const VkMemoryA /* 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) && !pointer_info && - (res = allocate_external_host_memory( device, (VkMemoryAllocateInfo *)alloc_info, &host_pointer_info ))) + (res = allocate_external_host_memory( device, alloc_info, mem_flags, &host_pointer_info ))) return res;
if (!(memory = malloc( sizeof(*memory) ))) return VK_ERROR_OUT_OF_HOST_MEMORY;
From: Rémi Bernon rbernon@codeweavers.com
Fixes: b2764cf318acc318bc5a577571bcb84678b7e1cf --- dlls/win32u/vulkan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/win32u/vulkan.c b/dlls/win32u/vulkan.c index 149dd760cb7..da86d34732e 100644 --- a/dlls/win32u/vulkan.c +++ b/dlls/win32u/vulkan.c @@ -103,7 +103,7 @@ static VkResult allocate_external_host_memory( struct vulkan_device *device, VkM uint32_t i, align = physical_device->external_memory_align - 1; SIZE_T alloc_size = alloc_info->allocationSize; static int once; - void *mapping; + void *mapping = NULL; VkResult res;
if (!once++) FIXME( "Using VK_EXT_external_memory_host\n" );