Added winevulkan-vkGetPhysicalDeviceSurfaceCapabilitiesKHR patchset

This commit is contained in:
Alistair Leslie-Hughes 2020-06-25 10:03:16 +10:00
parent 60074b960f
commit df2fd22e4d
3 changed files with 116 additions and 0 deletions

View File

@ -305,6 +305,7 @@ patch_enable_all ()
enable_winemenubuilder_integration="$1"
enable_wineps_drv_PostScript_Fixes="$1"
enable_winepulse_PulseAudio_Support="$1"
enable_winevulkan_vkGetPhysicalDeviceSurfaceCapabilitiesKHR="$1"
enable_winex11_CandidateWindowPos="$1"
enable_winex11_DefaultDisplayFrequency="$1"
enable_winex11_MWM_Decorations="$1"
@ -1006,6 +1007,9 @@ patch_enable ()
winepulse-PulseAudio_Support)
enable_winepulse_PulseAudio_Support="$2"
;;
winevulkan-vkGetPhysicalDeviceSurfaceCapabilitiesKHR)
enable_winevulkan_vkGetPhysicalDeviceSurfaceCapabilitiesKHR="$2"
;;
winex11-CandidateWindowPos)
enable_winex11_CandidateWindowPos="$2"
;;
@ -5961,6 +5965,21 @@ if test "$enable_winepulse_PulseAudio_Support" -eq 1; then
) >> "$patchlist"
fi
# Patchset winevulkan-vkGetPhysicalDeviceSurfaceCapabilitiesKHR
# |
# | This patchset fixes the following Wine bugs:
# | * [#49298] winevulkan: Avoid returning 0 for swapchain maxImageCount.
# |
# | Modified files:
# | * dlls/winevulkan/make_vulkan, dlls/winevulkan/vulkan.c, dlls/winevulkan/vulkan_thunks.c, dlls/winevulkan/vulkan_thunks.h
# |
if test "$enable_winevulkan_vkGetPhysicalDeviceSurfaceCapabilitiesKHR" -eq 1; then
patch_apply winevulkan-vkGetPhysicalDeviceSurfaceCapabilitiesKHR/0001-winevulkan-Avoid-returning-0-for-swapchain-maxImageC.patch
(
printf '%s\n' '+ { "Józef Kucia", "winevulkan: Avoid returning 0 for swapchain maxImageCount.", 1 },';
) >> "$patchlist"
fi
# Patchset winex11-CandidateWindowPos
# |
# | This patchset fixes the following Wine bugs:

View File

@ -0,0 +1,96 @@
From 3f245724b06ff75421810f5069beadc6b7610f52 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B3zef=20Kucia?= <jkucia@codeweavers.com>
Date: Wed, 24 Jun 2020 17:31:03 -0600
Subject: [PATCH] winevulkan: Avoid returning 0 for swapchain maxImageCount.
Multiple games, Strange Brigade, No Man's Sky, Path of Exile, do not handle it
correctly when maxImageCount is set to 0 or undefined.DXGI_MAX_SWAP_CHAIN_BUFFERS is 16.
AMDVLK also sets this to 16 when no maxImageCount is specified.
---
dlls/winevulkan/make_vulkan | 2 +-
dlls/winevulkan/vulkan.c | 19 +++++++++++++++++++
dlls/winevulkan/vulkan_thunks.c | 3 +--
dlls/winevulkan/vulkan_thunks.h | 2 ++
4 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan
index a0bf6b0859e..c28abe8ebb4 100755
--- a/dlls/winevulkan/make_vulkan
+++ b/dlls/winevulkan/make_vulkan
@@ -183,7 +183,7 @@ FUNCTION_OVERRIDES = {
# VK_KHR_surface
"vkDestroySurfaceKHR" : {"dispatch" : True, "driver" : True, "thunk" : True},
"vkGetPhysicalDeviceSurfaceSupportKHR" : {"dispatch" : True, "driver" : True, "thunk" : True},
- "vkGetPhysicalDeviceSurfaceCapabilitiesKHR" : {"dispatch" : True, "driver" : True, "thunk" : True},
+ "vkGetPhysicalDeviceSurfaceCapabilitiesKHR" : {"dispatch" : True, "driver" : True, "thunk" : False, "private_thunk" : True},
"vkGetPhysicalDeviceSurfaceFormatsKHR" : {"dispatch" : True, "driver" : True, "thunk" : True},
"vkGetPhysicalDeviceSurfacePresentModesKHR" : {"dispatch" : True, "driver" : True, "thunk" : True},
diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c
index eb22e72ae36..543388abe8e 100644
--- a/dlls/winevulkan/vulkan.c
+++ b/dlls/winevulkan/vulkan.c
@@ -1358,6 +1358,25 @@ void WINAPI wine_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR(VkPhysicalDev
properties->externalSemaphoreFeatures = 0;
}
+VkResult WINAPI wine_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice phys_dev,
+ VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *capabilities)
+{
+ VkResult res;
+
+ TRACE("%p, 0x%s, %p\n", phys_dev, wine_dbgstr_longlong(surface), capabilities);
+
+ res = thunk_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(phys_dev, surface, capabilities);
+
+ /* HACK: It happened more than once that a Windows game didn't expect that maxImageCount can be
+ * set to 0. A value of 0 means that there is no limit on the number of images. */
+ if (res == VK_SUCCESS && capabilities->minImageCount && !capabilities->maxImageCount)
+ {
+ capabilities->maxImageCount = 16;
+ }
+
+ return res;
+}
+
BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, void *reserved)
{
TRACE("%p, %u, %p\n", hinst, reason, reserved);
diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c
index f8d171a6db3..3dcbd824a30 100644
--- a/dlls/winevulkan/vulkan_thunks.c
+++ b/dlls/winevulkan/vulkan_thunks.c
@@ -4956,9 +4956,8 @@ static VkResult WINAPI wine_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysica
#endif
}
-VkResult WINAPI wine_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfaceCapabilities)
+VkResult thunk_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfaceCapabilities)
{
- TRACE("%p, 0x%s, %p\n", physicalDevice, wine_dbgstr_longlong(surface), pSurfaceCapabilities);
return physicalDevice->instance->funcs.p_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice->phys_dev, surface, pSurfaceCapabilities);
}
diff --git a/dlls/winevulkan/vulkan_thunks.h b/dlls/winevulkan/vulkan_thunks.h
index 9580c6bbcd2..18e3ce5fe1c 100644
--- a/dlls/winevulkan/vulkan_thunks.h
+++ b/dlls/winevulkan/vulkan_thunks.h
@@ -40,6 +40,7 @@ VkResult WINAPI wine_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice
VkResult WINAPI wine_vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties) DECLSPEC_HIDDEN;
void WINAPI wine_vkGetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2 *pProperties);
void WINAPI wine_vkGetPhysicalDeviceProperties2KHR(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2 *pProperties) DECLSPEC_HIDDEN;
+VkResult WINAPI wine_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfaceCapabilities);
VkResult WINAPI wine_vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, VkFence fence);
/* Private thunks */
@@ -47,6 +48,7 @@ VkResult thunk_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physic
VkResult thunk_vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties) DECLSPEC_HIDDEN;
void thunk_vkGetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2 *pProperties) DECLSPEC_HIDDEN;
void thunk_vkGetPhysicalDeviceProperties2KHR(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2 *pProperties) DECLSPEC_HIDDEN;
+VkResult thunk_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) DECLSPEC_HIDDEN;
typedef struct VkAcquireNextImageInfoKHR_host
{
--
2.27.0

View File

@ -0,0 +1 @@
Fixes: [49298] winevulkan: Avoid returning 0 for swapchain maxImageCount.