Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/winex11.drv/vulkan.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index c633579286eb..58ba5d71b1ef 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -134,7 +134,11 @@ static BOOL wine_vk_init(void) if (init_done) return (vulkan_handle != NULL); init_done = TRUE;
- if (!(vulkan_handle = wine_dlopen(SONAME_LIBVULKAN, RTLD_NOW, NULL, 0))) return FALSE; + if (!(vulkan_handle = wine_dlopen(SONAME_LIBVULKAN, RTLD_NOW, NULL, 0))) + { + ERR("Failed to load " SONAME_LIBVULKAN); + return FALSE; + }
#define LOAD_FUNCPTR(f) if ((p##f = wine_dlsym(vulkan_handle, #f, NULL, 0)) == NULL) return FALSE; LOAD_FUNCPTR(vkAcquireNextImageKHR)
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/winex11.drv/vulkan.c | 73 +++++++++++++---------------------------------- 1 file changed, 20 insertions(+), 53 deletions(-)
diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 58ba5d71b1ef..ffa91a2e2ce7 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -80,50 +80,9 @@ static VkResult (*pvkQueuePresentKHR)(VkQueue, const VkPresentInfoKHR *); static void *X11DRV_get_vk_device_proc_addr(const char *name); static void *X11DRV_get_vk_instance_proc_addr(VkInstance instance, const char *name);
-static struct VkExtensionProperties *winex11_vk_instance_extensions = NULL; -static unsigned int winex11_vk_instance_extensions_count = 0; - -static void wine_vk_load_instance_extensions(void) +static inline struct wine_vk_surface *surface_from_handle(VkSurfaceKHR handle) { - uint32_t num_properties; - VkExtensionProperties *properties; - unsigned int i; - - pvkEnumerateInstanceExtensionProperties(NULL, &num_properties, NULL); - - properties = heap_calloc(num_properties, sizeof(*properties)); - if (!properties) - return; - - /* We will return the same number of instance extensions reported by the host back to - * winevulkan. Along the way we may replace xlib extensions with their win32 equivalents. - * Winevulkan will perform more detailed filtering as it knows whether it has thunks - * for a particular extension. - */ - pvkEnumerateInstanceExtensionProperties(NULL, &num_properties, properties); - for (i = 0; i < num_properties; i++) - { - /* For now the only x11 extension we need to fixup. Long-term we may need an array. */ - if (!strcmp(properties[i].extensionName, "VK_KHR_xlib_surface")) - { - TRACE("Substituting VK_KHR_xlib_surface for VK_KHR_win32_surface\n"); - - memset(properties[i].extensionName, 0, sizeof(properties[i].extensionName)); - snprintf(properties[i].extensionName, sizeof(properties[i].extensionName), "VK_KHR_win32_surface"); - properties[i].specVersion = 6; /* Revision as of 4/24/2017 */ - } - - TRACE("Loaded extension: %s\n", properties[i].extensionName); - } - - winex11_vk_instance_extensions = properties; - winex11_vk_instance_extensions_count = num_properties; -} - -/* Helper function to convert VkSurfaceKHR (uint64_t) to a surface pointer. */ -static inline struct wine_vk_surface * surface_from_handle(VkSurfaceKHR handle) -{ - return ((struct wine_vk_surface *)(uintptr_t)handle); + return (struct wine_vk_surface *)(uintptr_t)handle; }
static BOOL wine_vk_init(void) @@ -160,8 +119,6 @@ static BOOL wine_vk_init(void) LOAD_FUNCPTR(vkQueuePresentKHR) #undef LOAD_FUNCPTR
- wine_vk_load_instance_extensions(); - return TRUE; }
@@ -376,6 +333,7 @@ static VkResult X11DRV_vkEnumerateInstanceExtensionProperties(const char *layer_ uint32_t *count, VkExtensionProperties* properties) { unsigned int i; + VkResult res;
TRACE("layer_name %p, count %p, properties %p\n", debugstr_a(layer_name), count, properties);
@@ -386,20 +344,29 @@ static VkResult X11DRV_vkEnumerateInstanceExtensionProperties(const char *layer_ return VK_ERROR_LAYER_NOT_PRESENT; }
- if (!properties) - { - *count = winex11_vk_instance_extensions_count; - return VK_SUCCESS; - } + /* We will return the same number of instance extensions reported by the host back to + * winevulkan. Along the way we may replace xlib extensions with their win32 equivalents. + * Winevulkan will perform more detailed filtering as it knows whether it has thunks + * for a particular extension. + */ + res = pvkEnumerateInstanceExtensionProperties(layer_name, count, properties); + if (!properties || res < 0) + return res;
- *count = min(*count, winex11_vk_instance_extensions_count); for (i = 0; i < *count; i++) { - properties[i] = winex11_vk_instance_extensions[i]; + /* For now the only x11 extension we need to fixup. Long-term we may need an array. */ + if (!strcmp(properties[i].extensionName, "VK_KHR_xlib_surface")) + { + TRACE("Substituting VK_KHR_xlib_surface for VK_KHR_win32_surface\n"); + + snprintf(properties[i].extensionName, sizeof(properties[i].extensionName), "VK_KHR_win32_surface"); + properties[i].specVersion = 6; /* Revision as of 4/24/2017 */ + } }
TRACE("Returning %u extensions.\n", *count); - return *count < winex11_vk_instance_extensions_count ? VK_INCOMPLETE : VK_SUCCESS; + return res; }
static void *X11DRV_vkGetDeviceProcAddr(VkDevice device, const char *name)
Signed-off-by: Roderick Colenbrander thunderbird2k@gmail.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com ---
It shouldn't matter in practice, but it is consistent with requirements specified in the Vulkan spec.
--- dlls/winex11.drv/vulkan.c | 62 ++++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 30 deletions(-)
diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index ffa91a2e2ce7..54ed3b6962ad 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -480,6 +480,35 @@ static const struct vulkan_funcs vulkan_funcs = X11DRV_vkQueuePresentKHR, };
+static void *get_vulkan_driver_device_proc_addr(const struct vulkan_funcs *vulkan_funcs, + const char *name) +{ + if (!name || name[0] != 'v' || name[1] != 'k') + return NULL; + + name += 2; + + if (!strcmp(name, "AcquireNextImageKHR")) + return vulkan_funcs->p_vkAcquireNextImageKHR; + if (!strcmp(name, "CreateSwapchainKHR")) + return vulkan_funcs->p_vkCreateSwapchainKHR; + if (!strcmp(name, "DestroySwapchainKHR")) + return vulkan_funcs->p_vkDestroySwapchainKHR; + if (!strcmp(name, "GetDeviceProcAddr")) + return vulkan_funcs->p_vkGetDeviceProcAddr; + if (!strcmp(name, "GetSwapchainImagesKHR")) + return vulkan_funcs->p_vkGetSwapchainImagesKHR; + if (!strcmp(name, "QueuePresentKHR")) + return vulkan_funcs->p_vkQueuePresentKHR; + + return NULL; +} + +static void *X11DRV_get_vk_device_proc_addr(const char *name) +{ + return get_vulkan_driver_device_proc_addr(&vulkan_funcs, name); +} + static void *get_vulkan_driver_instance_proc_addr(const struct vulkan_funcs *vulkan_funcs, VkInstance instance, const char *name) { @@ -515,7 +544,9 @@ static void *get_vulkan_driver_instance_proc_addr(const struct vulkan_funcs *vul if (!strcmp(name, "GetPhysicalDeviceWin32PresentationSupportKHR")) return vulkan_funcs->p_vkGetPhysicalDeviceWin32PresentationSupportKHR;
- return NULL; + name -= 2; + + return get_vulkan_driver_device_proc_addr(vulkan_funcs, name); }
static void *X11DRV_get_vk_instance_proc_addr(VkInstance instance, const char *name) @@ -523,35 +554,6 @@ static void *X11DRV_get_vk_instance_proc_addr(VkInstance instance, const char *n return get_vulkan_driver_instance_proc_addr(&vulkan_funcs, instance, name); }
-static void *get_vulkan_driver_device_proc_addr(const struct vulkan_funcs *vulkan_funcs, - const char *name) -{ - if (!name || name[0] != 'v' || name[1] != 'k') - return NULL; - - name += 2; - - if (!strcmp(name, "AcquireNextImageKHR")) - return vulkan_funcs->p_vkAcquireNextImageKHR; - if (!strcmp(name, "CreateSwapchainKHR")) - return vulkan_funcs->p_vkCreateSwapchainKHR; - if (!strcmp(name, "DestroySwapchainKHR")) - return vulkan_funcs->p_vkDestroySwapchainKHR; - if (!strcmp(name, "GetDeviceProcAddr")) - return vulkan_funcs->p_vkGetDeviceProcAddr; - if (!strcmp(name, "GetSwapchainImagesKHR")) - return vulkan_funcs->p_vkGetSwapchainImagesKHR; - if (!strcmp(name, "QueuePresentKHR")) - return vulkan_funcs->p_vkQueuePresentKHR; - - return NULL; -} - -static void *X11DRV_get_vk_device_proc_addr(const char *name) -{ - return get_vulkan_driver_device_proc_addr(&vulkan_funcs, name); -} - const struct vulkan_funcs *get_vulkan_driver(UINT version) { if (version != WINE_VULKAN_DRIVER_VERSION)
Signed-off-by: Roderick Colenbrander thunderbird2k@gmail.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/winevulkan/vulkan.c | 41 ++++++++++------------------------------ dlls/winevulkan/vulkan_private.h | 4 ++-- 2 files changed, 12 insertions(+), 33 deletions(-)
diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 72943830e3ea..8e04e8869f69 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -54,7 +54,7 @@ static void wine_vk_physical_device_free(struct VkPhysicalDevice_T *phys_dev) if (!phys_dev) return;
- heap_free(phys_dev->properties); + heap_free(phys_dev->extensions); heap_free(phys_dev); }
@@ -115,10 +115,9 @@ static struct VkPhysicalDevice_T *wine_vk_physical_device_alloc(struct VkInstanc
TRACE("Host supported extensions %u, Wine supported extensions %u\n", num_host_properties, num_properties);
- object->properties = heap_calloc(num_properties, sizeof(*object->properties)); - if (!object->properties) + if (!(object->extensions = heap_calloc(num_properties, sizeof(*object->extensions)))) { - ERR("Failed to allocate memory for device properties!\n"); + ERR("Failed to allocate memory for device extensions!\n"); goto err; }
@@ -126,11 +125,11 @@ static struct VkPhysicalDevice_T *wine_vk_physical_device_alloc(struct VkInstanc { if (wine_vk_device_extension_supported(host_properties[i].extensionName)) { - memcpy(&object->properties[j], &host_properties[i], sizeof(*object->properties)); + object->extensions[j] = host_properties[i]; j++; } } - object->num_properties = num_properties; + object->extension_count = num_properties;
heap_free(host_properties); return object; @@ -672,9 +671,6 @@ void WINAPI wine_vkDestroyInstance(VkInstance instance, const VkAllocationCallba VkResult WINAPI wine_vkEnumerateDeviceExtensionProperties(VkPhysicalDevice phys_dev, const char *layer_name, uint32_t *count, VkExtensionProperties *properties) { - VkResult res; - unsigned int i, num_copies; - TRACE("%p, %p, %p, %p\n", phys_dev, layer_name, count, properties);
/* This shouldn't get called with layer_name set, the ICD loader prevents it. */ @@ -686,32 +682,15 @@ VkResult WINAPI wine_vkEnumerateDeviceExtensionProperties(VkPhysicalDevice phys_
if (!properties) { - *count = phys_dev->num_properties; + *count = phys_dev->extension_count; return VK_SUCCESS; }
- if (*count < phys_dev->num_properties) - { - /* Incomplete is a type of success used to signal the application - * that not all devices got copied. - */ - num_copies = *count; - res = VK_INCOMPLETE; - } - else - { - num_copies = phys_dev->num_properties; - res = VK_SUCCESS; - } - - for (i = 0; i < num_copies; i++) - { - memcpy(&properties[i], &phys_dev->properties[i], sizeof(phys_dev->properties[i])); - } - *count = num_copies; + *count = min(*count, phys_dev->extension_count); + memcpy(properties, phys_dev->extensions, *count * sizeof(*properties));
- TRACE("Result %d, extensions copied %u\n", res, num_copies); - return res; + TRACE("Returning %u extensions.\n", *count); + return *count < phys_dev->extension_count ? VK_INCOMPLETE : VK_SUCCESS; }
VkResult WINAPI wine_vkEnumerateInstanceExtensionProperties(const char *layer_name, diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h index 419e6ac4857a..7f2f242b95d9 100644 --- a/dlls/winevulkan/vulkan_private.h +++ b/dlls/winevulkan/vulkan_private.h @@ -86,8 +86,8 @@ struct VkPhysicalDevice_T struct wine_vk_base base; struct VkInstance_T *instance; /* parent */
- uint32_t num_properties; - VkExtensionProperties *properties; + uint32_t extension_count; + VkExtensionProperties *extensions;
VkPhysicalDevice phys_dev; /* native physical device */ };
Signed-off-by: Roderick Colenbrander thunderbird2k@gmail.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/winevulkan/make_vulkan | 4 +--- dlls/winevulkan/vulkan.c | 2 +- dlls/winevulkan/vulkan_thunks.c | 46 ++++++++++++++++++++--------------------- 3 files changed, 25 insertions(+), 27 deletions(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index e781313440f8..66a7525d7be8 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -1141,10 +1141,8 @@ class VkParam(object): if self.is_static_array() or self.is_pointer(): self.format_str = "%p" else: - if self.type_info["category"] == "bitmask": + if self.type_info["category"] in ["bitmask", "enum"]: self.format_str = "%#x" - elif self.type_info["category"] == "enum": - self.format_str = "%d" elif self.is_handle(): # We use uint64_t for non-dispatchable handles as opposed to pointers # for dispatchable handles. diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 8e04e8869f69..5f674444500c 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -555,7 +555,7 @@ VkResult WINAPI wine_vkCreateDevice(VkPhysicalDevice phys_dev, phys_dev->instance->funcs.p_vkGetPhysicalDeviceQueueFamilyProperties(phys_dev->phys_dev, &max_queue_families, NULL); object->max_queue_families = max_queue_families; - TRACE("Max queue families: %d\n", object->max_queue_families); + TRACE("Max queue families: %u\n", object->max_queue_families);
object->queues = heap_calloc(max_queue_families, sizeof(*object->queues)); if (!object->queues) diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c index 15910aa7dbbf..17a2d2fe75e7 100644 --- a/dlls/winevulkan/vulkan_thunks.c +++ b/dlls/winevulkan/vulkan_thunks.c @@ -1072,32 +1072,32 @@ void WINAPI wine_vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRen { #if defined(USE_STRUCT_CONVERSION) VkRenderPassBeginInfo_host pRenderPassBegin_host; - TRACE("%p, %p, %d\n", commandBuffer, pRenderPassBegin, contents); + TRACE("%p, %p, %#x\n", commandBuffer, pRenderPassBegin, contents);
convert_VkRenderPassBeginInfo_win_to_host(pRenderPassBegin, &pRenderPassBegin_host); commandBuffer->device->funcs.p_vkCmdBeginRenderPass(commandBuffer->command_buffer, &pRenderPassBegin_host, contents);
#else - TRACE("%p, %p, %d\n", commandBuffer, pRenderPassBegin, contents); + TRACE("%p, %p, %#x\n", commandBuffer, pRenderPassBegin, contents); commandBuffer->device->funcs.p_vkCmdBeginRenderPass(commandBuffer->command_buffer, pRenderPassBegin, contents); #endif }
void WINAPI wine_vkCmdBindDescriptorSets(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet *pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t *pDynamicOffsets) { - TRACE("%p, %d, 0x%s, %u, %u, %p, %u, %p\n", commandBuffer, pipelineBindPoint, wine_dbgstr_longlong(layout), firstSet, descriptorSetCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets); + TRACE("%p, %#x, 0x%s, %u, %u, %p, %u, %p\n", commandBuffer, pipelineBindPoint, wine_dbgstr_longlong(layout), firstSet, descriptorSetCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets); commandBuffer->device->funcs.p_vkCmdBindDescriptorSets(commandBuffer->command_buffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets); }
void WINAPI wine_vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType) { - TRACE("%p, 0x%s, 0x%s, %d\n", commandBuffer, wine_dbgstr_longlong(buffer), wine_dbgstr_longlong(offset), indexType); + TRACE("%p, 0x%s, 0x%s, %#x\n", commandBuffer, wine_dbgstr_longlong(buffer), wine_dbgstr_longlong(offset), indexType); commandBuffer->device->funcs.p_vkCmdBindIndexBuffer(commandBuffer->command_buffer, buffer, offset, indexType); }
void WINAPI wine_vkCmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) { - TRACE("%p, %d, 0x%s\n", commandBuffer, pipelineBindPoint, wine_dbgstr_longlong(pipeline)); + TRACE("%p, %#x, 0x%s\n", commandBuffer, pipelineBindPoint, wine_dbgstr_longlong(pipeline)); commandBuffer->device->funcs.p_vkCmdBindPipeline(commandBuffer->command_buffer, pipelineBindPoint, pipeline); }
@@ -1109,7 +1109,7 @@ void WINAPI wine_vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t
void WINAPI wine_vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit *pRegions, VkFilter filter) { - TRACE("%p, 0x%s, %d, 0x%s, %d, %u, %p, %d\n", commandBuffer, wine_dbgstr_longlong(srcImage), srcImageLayout, wine_dbgstr_longlong(dstImage), dstImageLayout, regionCount, pRegions, filter); + TRACE("%p, 0x%s, %#x, 0x%s, %#x, %u, %p, %#x\n", commandBuffer, wine_dbgstr_longlong(srcImage), srcImageLayout, wine_dbgstr_longlong(dstImage), dstImageLayout, regionCount, pRegions, filter); commandBuffer->device->funcs.p_vkCmdBlitImage(commandBuffer->command_buffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions, filter); }
@@ -1121,13 +1121,13 @@ void WINAPI wine_vkCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t a
void WINAPI wine_vkCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue *pColor, uint32_t rangeCount, const VkImageSubresourceRange *pRanges) { - TRACE("%p, 0x%s, %d, %p, %u, %p\n", commandBuffer, wine_dbgstr_longlong(image), imageLayout, pColor, rangeCount, pRanges); + TRACE("%p, 0x%s, %#x, %p, %u, %p\n", commandBuffer, wine_dbgstr_longlong(image), imageLayout, pColor, rangeCount, pRanges); commandBuffer->device->funcs.p_vkCmdClearColorImage(commandBuffer->command_buffer, image, imageLayout, pColor, rangeCount, pRanges); }
void WINAPI wine_vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue *pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange *pRanges) { - TRACE("%p, 0x%s, %d, %p, %u, %p\n", commandBuffer, wine_dbgstr_longlong(image), imageLayout, pDepthStencil, rangeCount, pRanges); + TRACE("%p, 0x%s, %#x, %p, %u, %p\n", commandBuffer, wine_dbgstr_longlong(image), imageLayout, pDepthStencil, rangeCount, pRanges); commandBuffer->device->funcs.p_vkCmdClearDepthStencilImage(commandBuffer->command_buffer, image, imageLayout, pDepthStencil, rangeCount, pRanges); }
@@ -1151,21 +1151,21 @@ void WINAPI wine_vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer { #if defined(USE_STRUCT_CONVERSION) VkBufferImageCopy_host *pRegions_host; - TRACE("%p, 0x%s, 0x%s, %d, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcBuffer), wine_dbgstr_longlong(dstImage), dstImageLayout, regionCount, pRegions); + TRACE("%p, 0x%s, 0x%s, %#x, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcBuffer), wine_dbgstr_longlong(dstImage), dstImageLayout, regionCount, pRegions);
pRegions_host = convert_VkBufferImageCopy_array_win_to_host(pRegions, regionCount); commandBuffer->device->funcs.p_vkCmdCopyBufferToImage(commandBuffer->command_buffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions_host);
free_VkBufferImageCopy_array(pRegions_host, regionCount); #else - TRACE("%p, 0x%s, 0x%s, %d, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcBuffer), wine_dbgstr_longlong(dstImage), dstImageLayout, regionCount, pRegions); + TRACE("%p, 0x%s, 0x%s, %#x, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcBuffer), wine_dbgstr_longlong(dstImage), dstImageLayout, regionCount, pRegions); commandBuffer->device->funcs.p_vkCmdCopyBufferToImage(commandBuffer->command_buffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions); #endif }
void WINAPI wine_vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy *pRegions) { - TRACE("%p, 0x%s, %d, 0x%s, %d, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcImage), srcImageLayout, wine_dbgstr_longlong(dstImage), dstImageLayout, regionCount, pRegions); + TRACE("%p, 0x%s, %#x, 0x%s, %#x, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcImage), srcImageLayout, wine_dbgstr_longlong(dstImage), dstImageLayout, regionCount, pRegions); commandBuffer->device->funcs.p_vkCmdCopyImage(commandBuffer->command_buffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions); }
@@ -1173,14 +1173,14 @@ void WINAPI wine_vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage s { #if defined(USE_STRUCT_CONVERSION) VkBufferImageCopy_host *pRegions_host; - TRACE("%p, 0x%s, %d, 0x%s, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcImage), srcImageLayout, wine_dbgstr_longlong(dstBuffer), regionCount, pRegions); + TRACE("%p, 0x%s, %#x, 0x%s, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcImage), srcImageLayout, wine_dbgstr_longlong(dstBuffer), regionCount, pRegions);
pRegions_host = convert_VkBufferImageCopy_array_win_to_host(pRegions, regionCount); commandBuffer->device->funcs.p_vkCmdCopyImageToBuffer(commandBuffer->command_buffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions_host);
free_VkBufferImageCopy_array(pRegions_host, regionCount); #else - TRACE("%p, 0x%s, %d, 0x%s, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcImage), srcImageLayout, wine_dbgstr_longlong(dstBuffer), regionCount, pRegions); + TRACE("%p, 0x%s, %#x, 0x%s, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcImage), srcImageLayout, wine_dbgstr_longlong(dstBuffer), regionCount, pRegions); commandBuffer->device->funcs.p_vkCmdCopyImageToBuffer(commandBuffer->command_buffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions); #endif } @@ -1259,7 +1259,7 @@ void WINAPI wine_vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuff
void WINAPI wine_vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) { - TRACE("%p, %d\n", commandBuffer, contents); + TRACE("%p, %#x\n", commandBuffer, contents); commandBuffer->device->funcs.p_vkCmdNextSubpass(commandBuffer->command_buffer, contents); }
@@ -1292,14 +1292,14 @@ static void WINAPI wine_vkCmdPushDescriptorSetKHR(VkCommandBuffer commandBuffer, { #if defined(USE_STRUCT_CONVERSION) VkWriteDescriptorSet_host *pDescriptorWrites_host; - TRACE("%p, %d, 0x%s, %u, %u, %p\n", commandBuffer, pipelineBindPoint, wine_dbgstr_longlong(layout), set, descriptorWriteCount, pDescriptorWrites); + TRACE("%p, %#x, 0x%s, %u, %u, %p\n", commandBuffer, pipelineBindPoint, wine_dbgstr_longlong(layout), set, descriptorWriteCount, pDescriptorWrites);
pDescriptorWrites_host = convert_VkWriteDescriptorSet_array_win_to_host(pDescriptorWrites, descriptorWriteCount); commandBuffer->device->funcs.p_vkCmdPushDescriptorSetKHR(commandBuffer->command_buffer, pipelineBindPoint, layout, set, descriptorWriteCount, pDescriptorWrites_host);
free_VkWriteDescriptorSet_array(pDescriptorWrites_host, descriptorWriteCount); #else - TRACE("%p, %d, 0x%s, %u, %u, %p\n", commandBuffer, pipelineBindPoint, wine_dbgstr_longlong(layout), set, descriptorWriteCount, pDescriptorWrites); + TRACE("%p, %#x, 0x%s, %u, %u, %p\n", commandBuffer, pipelineBindPoint, wine_dbgstr_longlong(layout), set, descriptorWriteCount, pDescriptorWrites); commandBuffer->device->funcs.p_vkCmdPushDescriptorSetKHR(commandBuffer->command_buffer, pipelineBindPoint, layout, set, descriptorWriteCount, pDescriptorWrites); #endif } @@ -1324,7 +1324,7 @@ void WINAPI wine_vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool
void WINAPI wine_vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve *pRegions) { - TRACE("%p, 0x%s, %d, 0x%s, %d, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcImage), srcImageLayout, wine_dbgstr_longlong(dstImage), dstImageLayout, regionCount, pRegions); + TRACE("%p, 0x%s, %#x, 0x%s, %#x, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcImage), srcImageLayout, wine_dbgstr_longlong(dstImage), dstImageLayout, regionCount, pRegions); commandBuffer->device->funcs.p_vkCmdResolveImage(commandBuffer->command_buffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions); }
@@ -1427,7 +1427,7 @@ void WINAPI wine_vkCmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCo
void WINAPI wine_vkCmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t query) { - TRACE("%p, %d, 0x%s, %u\n", commandBuffer, pipelineStage, wine_dbgstr_longlong(queryPool), query); + TRACE("%p, %#x, 0x%s, %u\n", commandBuffer, pipelineStage, wine_dbgstr_longlong(queryPool), query); commandBuffer->device->funcs.p_vkCmdWriteTimestamp(commandBuffer->command_buffer, pipelineStage, queryPool, query); }
@@ -1910,13 +1910,13 @@ static void WINAPI wine_vkGetPhysicalDeviceFeatures2KHR(VkPhysicalDevice physica
void WINAPI wine_vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties *pFormatProperties) { - TRACE("%p, %d, %p\n", physicalDevice, format, pFormatProperties); + TRACE("%p, %#x, %p\n", physicalDevice, format, pFormatProperties); physicalDevice->instance->funcs.p_vkGetPhysicalDeviceFormatProperties(physicalDevice->phys_dev, format, pFormatProperties); }
static void WINAPI wine_vkGetPhysicalDeviceFormatProperties2KHR(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2KHR *pFormatProperties) { - TRACE("%p, %d, %p\n", physicalDevice, format, pFormatProperties); + TRACE("%p, %#x, %p\n", physicalDevice, format, pFormatProperties); physicalDevice->instance->funcs.p_vkGetPhysicalDeviceFormatProperties2KHR(physicalDevice->phys_dev, format, pFormatProperties); }
@@ -1925,14 +1925,14 @@ VkResult WINAPI wine_vkGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice p #if defined(USE_STRUCT_CONVERSION) VkResult result; VkImageFormatProperties_host pImageFormatProperties_host; - TRACE("%p, %d, %d, %d, %#x, %#x, %p\n", physicalDevice, format, type, tiling, usage, flags, pImageFormatProperties); + TRACE("%p, %#x, %#x, %#x, %#x, %#x, %p\n", physicalDevice, format, type, tiling, usage, flags, pImageFormatProperties);
result = physicalDevice->instance->funcs.p_vkGetPhysicalDeviceImageFormatProperties(physicalDevice->phys_dev, format, type, tiling, usage, flags, &pImageFormatProperties_host);
convert_VkImageFormatProperties_host_to_win(&pImageFormatProperties_host, pImageFormatProperties); return result; #else - TRACE("%p, %d, %d, %d, %#x, %#x, %p\n", physicalDevice, format, type, tiling, usage, flags, pImageFormatProperties); + TRACE("%p, %#x, %#x, %#x, %#x, %#x, %p\n", physicalDevice, format, type, tiling, usage, flags, pImageFormatProperties); return physicalDevice->instance->funcs.p_vkGetPhysicalDeviceImageFormatProperties(physicalDevice->phys_dev, format, type, tiling, usage, flags, pImageFormatProperties); #endif } @@ -2031,7 +2031,7 @@ static void WINAPI wine_vkGetPhysicalDeviceQueueFamilyProperties2KHR(VkPhysicalD
void WINAPI wine_vkGetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t *pPropertyCount, VkSparseImageFormatProperties *pProperties) { - TRACE("%p, %d, %d, %d, %#x, %d, %p, %p\n", physicalDevice, format, type, samples, usage, tiling, pPropertyCount, pProperties); + TRACE("%p, %#x, %#x, %#x, %#x, %#x, %p, %p\n", physicalDevice, format, type, samples, usage, tiling, pPropertyCount, pProperties); physicalDevice->instance->funcs.p_vkGetPhysicalDeviceSparseImageFormatProperties(physicalDevice->phys_dev, format, type, samples, usage, tiling, pPropertyCount, pProperties); }
Signed-off-by: Roderick Colenbrander thunderbird2k@gmail.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/winevulkan/make_vulkan | 12 ------------ dlls/winevulkan/vulkan_private.h | 11 +++++++++++ dlls/winevulkan/vulkan_thunks.h | 12 ------------ 3 files changed, 11 insertions(+), 24 deletions(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 66a7525d7be8..8cd0b49f5205 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -1913,18 +1913,6 @@ class VkGenerator(object): f.write("#ifndef __WINE_VULKAN_THUNKS_H\n") f.write("#define __WINE_VULKAN_THUNKS_H\n\n")
- f.write("/* Perform vulkan struct conversion on 32-bit x86 platforms. */\n") - f.write("#if defined(__i386__)\n") - f.write("#define USE_STRUCT_CONVERSION\n") - f.write("#endif\n\n") - - f.write("/* For use by vk_icdGetInstanceProcAddr / vkGetInstanceProcAddr */\n") - f.write("void *wine_vk_get_device_proc_addr(const char *name) DECLSPEC_HIDDEN;\n") - f.write("void *wine_vk_get_instance_proc_addr(const char *name) DECLSPEC_HIDDEN;\n\n") - - f.write("BOOL wine_vk_device_extension_supported(const char *name) DECLSPEC_HIDDEN;\n") - f.write("BOOL wine_vk_instance_extension_supported(const char *name) DECLSPEC_HIDDEN;\n\n") - # Generate prototypes for device and instance functions requiring a custom implementation. f.write("/* Functions for which we have custom implementations outside of the thunks. */\n") for vk_func in self.registry.funcs.values(): diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h index 7f2f242b95d9..a7239e7616f4 100644 --- a/dlls/winevulkan/vulkan_private.h +++ b/dlls/winevulkan/vulkan_private.h @@ -20,6 +20,11 @@ #ifndef __WINE_VULKAN_PRIVATE_H #define __WINE_VULKAN_PRIVATE_H
+/* Perform vulkan struct conversion on 32-bit x86 platforms. */ +#if defined(__i386__) +#define USE_STRUCT_CONVERSION +#endif + #include "vulkan_thunks.h"
/* Magic value defined by Vulkan ICD / Loader spec */ @@ -99,4 +104,10 @@ struct VkQueue_T VkQueue queue; /* native queue */ };
+void *wine_vk_get_device_proc_addr(const char *name) DECLSPEC_HIDDEN; +void *wine_vk_get_instance_proc_addr(const char *name) DECLSPEC_HIDDEN; + +BOOL wine_vk_device_extension_supported(const char *name) DECLSPEC_HIDDEN; +BOOL wine_vk_instance_extension_supported(const char *name) DECLSPEC_HIDDEN; + #endif /* __WINE_VULKAN_PRIVATE_H */ diff --git a/dlls/winevulkan/vulkan_thunks.h b/dlls/winevulkan/vulkan_thunks.h index 30a53aca772c..67df71d3080a 100644 --- a/dlls/winevulkan/vulkan_thunks.h +++ b/dlls/winevulkan/vulkan_thunks.h @@ -3,18 +3,6 @@ #ifndef __WINE_VULKAN_THUNKS_H #define __WINE_VULKAN_THUNKS_H
-/* Perform vulkan struct conversion on 32-bit x86 platforms. */ -#if defined(__i386__) -#define USE_STRUCT_CONVERSION -#endif - -/* For use by vk_icdGetInstanceProcAddr / vkGetInstanceProcAddr */ -void *wine_vk_get_device_proc_addr(const char *name) DECLSPEC_HIDDEN; -void *wine_vk_get_instance_proc_addr(const char *name) DECLSPEC_HIDDEN; - -BOOL wine_vk_device_extension_supported(const char *name) DECLSPEC_HIDDEN; -BOOL wine_vk_instance_extension_supported(const char *name) DECLSPEC_HIDDEN; - /* Functions for which we have custom implementations outside of the thunks. */ VkResult WINAPI wine_vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo, VkCommandBuffer *pCommandBuffers); void WINAPI wine_vkCmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer *pCommandBuffers);
Signed-off-by: Roderick Colenbrander thunderbird2k@gmail.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/winevulkan/vulkan.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 5f674444500c..9fa1d39982d2 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -47,7 +47,7 @@ struct wine_vk_structure_header
static void *wine_vk_get_global_proc_addr(const char *name);
-static const struct vulkan_funcs *vk_funcs = NULL; +static const struct vulkan_funcs *vk_funcs;
static void wine_vk_physical_device_free(struct VkPhysicalDevice_T *phys_dev) { @@ -261,17 +261,17 @@ static void wine_vk_device_free(struct VkDevice_T *device)
static BOOL wine_vk_init(void) { - HDC hdc = GetDC(0); + HDC hdc;
- vk_funcs = __wine_get_vulkan_driver(hdc, WINE_VULKAN_DRIVER_VERSION); + hdc = GetDC(0); + vk_funcs = __wine_get_vulkan_driver(hdc, WINE_VULKAN_DRIVER_VERSION); + ReleaseDC(0, hdc); if (!vk_funcs) { ERR("Failed to load Wine graphics driver supporting Vulkan.\n"); - ReleaseDC(0, hdc); return FALSE; }
- ReleaseDC(0, hdc); return TRUE; }
Signed-off-by: Roderick Colenbrander thunderbird2k@gmail.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com ---
Cleanup is a single line
--- dlls/winevulkan/vulkan.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 9fa1d39982d2..4c9874c78473 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -341,7 +341,7 @@ static void wine_vk_instance_convert_create_info(const VkInstanceCreateInfo *src static VkResult wine_vk_instance_load_physical_devices(struct VkInstance_T *instance) { VkResult res; - struct VkPhysicalDevice_T **tmp_phys_devs = NULL; + struct VkPhysicalDevice_T **tmp_phys_devs; uint32_t num_phys_devs = 0; unsigned int i;
@@ -362,13 +362,16 @@ static VkResult wine_vk_instance_load_physical_devices(struct VkInstance_T *inst
res = instance->funcs.p_vkEnumeratePhysicalDevices(instance->instance, &num_phys_devs, tmp_phys_devs); if (res != VK_SUCCESS) - goto err; + { + heap_free(tmp_phys_devs); + return res; + }
instance->phys_devs = heap_calloc(num_phys_devs, sizeof(*instance->phys_devs)); if (!instance->phys_devs) { - res = VK_ERROR_OUT_OF_HOST_MEMORY; - goto err; + heap_free(tmp_phys_devs); + return VK_ERROR_OUT_OF_HOST_MEMORY; }
/* Wrap each native physical device handle into a dispatchable object for the ICD loader. */ @@ -378,8 +381,8 @@ static VkResult wine_vk_instance_load_physical_devices(struct VkInstance_T *inst if (!phys_dev) { ERR("Unable to allocate memory for physical device!\n"); - res = VK_ERROR_OUT_OF_HOST_MEMORY; - goto err; + heap_free(tmp_phys_devs); + return VK_ERROR_OUT_OF_HOST_MEMORY; }
instance->phys_devs[i] = phys_dev; @@ -389,10 +392,6 @@ static VkResult wine_vk_instance_load_physical_devices(struct VkInstance_T *inst
heap_free(tmp_phys_devs); return VK_SUCCESS; - -err: - heap_free(tmp_phys_devs); - return res; }
/* Helper function used for freeing an instance structure. This function supports full
Signed-off-by: Roderick Colenbrander thunderbird2k@gmail.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/winevulkan/vulkan.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 4c9874c78473..7a7a334e9c38 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -531,8 +531,9 @@ VkResult WINAPI wine_vkCreateDevice(VkPhysicalDevice phys_dev, &create_info_host, NULL /* allocator */, &object->device); if (res != VK_SUCCESS) { - ERR("Failed to create device\n"); - goto err; + ERR("Failed to create device.\n"); + wine_vk_device_free(object); + return res; }
object->phys_dev = phys_dev; @@ -559,8 +560,8 @@ VkResult WINAPI wine_vkCreateDevice(VkPhysicalDevice phys_dev, object->queues = heap_calloc(max_queue_families, sizeof(*object->queues)); if (!object->queues) { - res = VK_ERROR_OUT_OF_HOST_MEMORY; - goto err; + wine_vk_device_free(object); + return VK_ERROR_OUT_OF_HOST_MEMORY; }
for (i = 0; i < create_info_host.queueCreateInfoCount; i++) @@ -573,18 +574,14 @@ VkResult WINAPI wine_vkCreateDevice(VkPhysicalDevice phys_dev, object->queues[family_index] = wine_vk_device_alloc_queues(object, family_index, queue_count); if (!object->queues[family_index]) { - res = VK_ERROR_OUT_OF_HOST_MEMORY; ERR("Failed to allocate memory for queues\n"); - goto err; + wine_vk_device_free(object); + return VK_ERROR_OUT_OF_HOST_MEMORY; } }
*device = object; return VK_SUCCESS; - -err: - wine_vk_device_free(object); - return res; }
VkResult WINAPI wine_vkCreateInstance(const VkInstanceCreateInfo *create_info,
Signed-off-by: Roderick Colenbrander thunderbird2k@gmail.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/winevulkan/vulkan.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 7a7a334e9c38..e4c04df059bd 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -596,12 +596,10 @@ VkResult WINAPI wine_vkCreateInstance(const VkInstanceCreateInfo *create_info, if (allocator) FIXME("Support for allocation callbacks not implemented yet\n");
- object = heap_alloc_zero(sizeof(*object)); - if (!object) + if (!(object = heap_alloc_zero(sizeof(*object)))) { ERR("Failed to allocate memory for instance\n"); - res = VK_ERROR_OUT_OF_HOST_MEMORY; - goto err; + return VK_ERROR_OUT_OF_HOST_MEMORY; } object->base.loader_magic = VULKAN_ICD_MAGIC_VALUE;
@@ -611,7 +609,8 @@ VkResult WINAPI wine_vkCreateInstance(const VkInstanceCreateInfo *create_info, if (res != VK_SUCCESS) { ERR("Failed to create instance, res=%d\n", res); - goto err; + wine_vk_instance_free(object); + return res; }
/* Load all instance functions we are aware of. Note the loader takes care @@ -625,23 +624,20 @@ VkResult WINAPI wine_vkCreateInstance(const VkInstanceCreateInfo *create_info,
/* Cache physical devices for vkEnumeratePhysicalDevices within the instance as * each vkPhysicalDevice is a dispatchable object, which means we need to wrap - * the native physical device and present those the application. + * the native physical devices and present those to the application. * Cleanup happens as part of wine_vkDestroyInstance. */ res = wine_vk_instance_load_physical_devices(object); if (res != VK_SUCCESS) { - ERR("Failed to cache physical devices, res=%d\n", res); - goto err; + ERR("Failed to load physical devices, res=%d\n", res); + wine_vk_instance_free(object); + return res; }
*instance = object; TRACE("Done, instance=%p native_instance=%p\n", object, object->instance); return VK_SUCCESS; - -err: - wine_vk_instance_free(object); - return res; }
void WINAPI wine_vkDestroyDevice(VkDevice device, const VkAllocationCallbacks *allocator)
Signed-off-by: Roderick Colenbrander thunderbird2k@gmail.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/winevulkan/vulkan.c | 19 ++++++++++++++----- dlls/winevulkan/vulkan_private.h | 6 ++++++ 2 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index e4c04df059bd..886b345a1510 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -580,6 +580,8 @@ VkResult WINAPI wine_vkCreateDevice(VkPhysicalDevice phys_dev, } }
+ object->quirks = phys_dev->instance->quirks; + *device = object; return VK_SUCCESS; } @@ -587,8 +589,9 @@ VkResult WINAPI wine_vkCreateDevice(VkPhysicalDevice phys_dev, VkResult WINAPI wine_vkCreateInstance(const VkInstanceCreateInfo *create_info, const VkAllocationCallbacks *allocator, VkInstance *instance) { - struct VkInstance_T *object = NULL; VkInstanceCreateInfo create_info_host; + const VkApplicationInfo *app_info; + struct VkInstance_T *object; VkResult res;
TRACE("create_info %p, allocator %p, instance %p\n", create_info, allocator, instance); @@ -635,6 +638,13 @@ VkResult WINAPI wine_vkCreateInstance(const VkInstanceCreateInfo *create_info, return res; }
+ if ((app_info = create_info->pApplicationInfo) && app_info->pApplicationName) + { + if (!strcmp(app_info->pApplicationName, "DOOM") + || !strcmp(app_info->pApplicationName, "Wolfenstein II The New Colossus")) + object->quirks |= WINEVULKAN_QUIRK_GET_DEVICE_PROC_ADDR; + } + *instance = object; TRACE("Done, instance=%p native_instance=%p\n", object, object->instance); return VK_SUCCESS; @@ -808,13 +818,12 @@ PFN_vkVoidFunction WINAPI wine_vkGetDeviceProcAddr(VkDevice device, const char * * subdevice objects. The games don't actually use the function pointers and if they * did, they would crash as VkInstance / VkPhysicalDevice parameters need unwrapping. * Khronos clarified behavior in the Vulkan spec and expects drivers to get updated, - * however it would require both driver and game fixes. Since it are major titles - * it is not clear what will happen. At least for now we need the hack below. + * however it would require both driver and game fixes. * https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/issues/2323 * https://github.com/KhronosGroup/Vulkan-Docs/issues/655 */ - func = wine_vk_get_instance_proc_addr(name); - if (func) + if (device->quirks & WINEVULKAN_QUIRK_GET_DEVICE_PROC_ADDR + && (func = wine_vk_get_instance_proc_addr(name))) { WARN("Returning instance function %s.\n", debugstr_a(name)); return func; diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h index a7239e7616f4..30ab62547f74 100644 --- a/dlls/winevulkan/vulkan_private.h +++ b/dlls/winevulkan/vulkan_private.h @@ -34,6 +34,8 @@ #define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) #endif
+#define WINEVULKAN_QUIRK_GET_DEVICE_PROC_ADDR 0x00000001 + struct vulkan_func { const char *name; @@ -70,6 +72,8 @@ struct VkDevice_T struct VkQueue_T **queues;
VkDevice device; /* native device */ + + unsigned int quirks; };
struct VkInstance_T @@ -84,6 +88,8 @@ struct VkInstance_T struct VkPhysicalDevice_T **phys_devs;
VkInstance instance; /* native instance */ + + unsigned int quirks; };
struct VkPhysicalDevice_T
Signed-off-by: Roderick Colenbrander thunderbird2k@gmail.com