winevulkan: Unwrap VkSurfaceKHR if required.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50422
Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Signed-off-by: Liam Middlebrook <lmiddlebrook@nvidia.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Georg Lehmann 2021-01-22 18:31:57 +01:00 committed by Alexandre Julliard
parent d9c9b5ea61
commit 2d4dd4252b
2 changed files with 14 additions and 3 deletions

View file

@ -955,6 +955,8 @@ class VkHandle(object):
return "wine_debug_utils_messenger_from_handle({0})->debug_messenger".format(name)
if self.name == "VkDebugReportCallbackEXT":
return "wine_debug_report_callback_from_handle({0})->debug_callback".format(name)
if self.name == "VkSurfaceKHR":
return "wine_surface_from_handle({0})->base.surface".format(name)
native_handle_name = None
@ -979,6 +981,8 @@ class VkHandle(object):
def is_wrapped(self):
return self.native_handle("test") is not None
def is_unwrapped_by_driver(self):
return self.name == "VkSurfaceKHR"
class VkMember(object):
def __init__(self, const=False, struct_fwd_decl=False,_type=None, pointer=None, name=None, array_len=None,
@ -1601,8 +1605,12 @@ class VkParam(object):
else:
return "&{0}_host".format(self.name)
else:
# We need to pass the native handle to the native Vulkan calls.
native_handle = self.handle.native_handle(self.name) if self.is_handle() else None
# We need to pass the native handle to the native Vulkan calls unless
# the wine driver unwraps the handle for us.
if self.is_handle() and not self.handle.is_unwrapped_by_driver():
native_handle = self.handle.native_handle(self.name)
else:
native_handle = None
return native_handle if native_handle else self.name

View file

@ -7262,7 +7262,8 @@ BOOL wine_vk_is_type_wrapped(VkObjectType type)
type == VK_OBJECT_TYPE_DEVICE ||
type == VK_OBJECT_TYPE_INSTANCE ||
type == VK_OBJECT_TYPE_PHYSICAL_DEVICE ||
type == VK_OBJECT_TYPE_QUEUE;
type == VK_OBJECT_TYPE_QUEUE ||
type == VK_OBJECT_TYPE_SURFACE_KHR;
}
uint64_t wine_vk_unwrap_handle(VkObjectType type, uint64_t handle)
@ -7285,6 +7286,8 @@ uint64_t wine_vk_unwrap_handle(VkObjectType type, uint64_t handle)
return (uint64_t) (uintptr_t) ((VkPhysicalDevice) (uintptr_t) handle)->phys_dev;
case VK_OBJECT_TYPE_QUEUE:
return (uint64_t) (uintptr_t) ((VkQueue) (uintptr_t) handle)->queue;
case VK_OBJECT_TYPE_SURFACE_KHR:
return (uint64_t) wine_surface_from_handle(handle)->base.surface;
default:
return handle;
}