Commit 60085e46 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

winevulkan: Don't try to unwrap missing optional handle struct members.

parent feab1634
......@@ -1452,10 +1452,13 @@ class VkMember(VkVariable):
# Nothing needed this yet.
LOGGER.warn("TODO: implement copying of static array for {0}.{1}".format(self.type, self.name))
elif self.is_handle() and self.needs_unwrapping():
handle = self.type_info["data"]
if direction == Direction.OUTPUT:
LOGGER.err("OUTPUT parameter {0}.{1} cannot be unwrapped".format(self.type, self.name))
elif self.optional:
return "{0}{1} = {2} ? {3} : 0;\n".format(output, self.name,
self.value(input, conv), handle.driver_handle(self.value(input, conv)))
else:
handle = self.type_info["data"]
return "{0}{1} = {2};\n".format(output, self.name, handle.driver_handle(self.value(input, conv)))
elif self.is_generic_handle():
if direction == Direction.OUTPUT:
......@@ -1849,14 +1852,19 @@ class VkParam(VkVariable):
p = self.value(params_prefix, conv)
if unwrap:
unwrap_handle = None
if self.object_type != None and self.type == "uint64_t":
return "wine_vk_unwrap_handle({0}{1}, {0}{2})".format(params_prefix, self.object_type, self.name)
unwrap_handle = "wine_vk_unwrap_handle({0}{1}, {0}{2})".format(
params_prefix, self.object_type, self.name)
# We need to pass the native handle to the native Vulkan calls and
# the wine driver's handle to calls which are wrapped by the driver.
driver_handle = self.handle.driver_handle(p) if self.is_handle() else None
if driver_handle:
return driver_handle
elif self.is_handle():
# We need to pass the native handle to the native Vulkan calls and
# the wine driver's handle to calls which are wrapped by the driver.
unwrap_handle = self.handle.driver_handle(p)
if unwrap_handle:
if self.optional:
unwrap_handle = "{0}{1} ? {2} : 0".format(params_prefix, self.name, unwrap_handle)
return unwrap_handle
return p
......
......@@ -23416,7 +23416,7 @@ static inline void convert_VkPhysicalDeviceSurfaceInfo2KHR_win64_to_host(const V
out->sType = in->sType;
out->pNext = in->pNext;
out->surface = wine_surface_from_handle(in->surface)->driver_surface;
out->surface = in->surface ? wine_surface_from_handle(in->surface)->driver_surface : 0;
}
#endif /* _WIN64 */
......@@ -23426,7 +23426,7 @@ static inline void convert_VkPhysicalDeviceSurfaceInfo2KHR_win32_to_host(const V
out->sType = in->sType;
out->pNext = NULL;
out->surface = wine_surface_from_handle(in->surface)->driver_surface;
out->surface = in->surface ? wine_surface_from_handle(in->surface)->driver_surface : 0;
if (in->pNext)
FIXME("Unexpected pNext\n");
}
......@@ -38314,7 +38314,7 @@ static NTSTATUS thunk64_vkGetPhysicalDeviceSurfaceFormatsKHR(void *args)
TRACE("%p, 0x%s, %p, %p\n", params->physicalDevice, wine_dbgstr_longlong(params->surface), params->pSurfaceFormatCount, params->pSurfaceFormats);
params->result = wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceSurfaceFormatsKHR(wine_phys_dev_from_handle(params->physicalDevice)->phys_dev, wine_surface_from_handle(params->surface)->driver_surface, params->pSurfaceFormatCount, params->pSurfaceFormats);
params->result = wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceSurfaceFormatsKHR(wine_phys_dev_from_handle(params->physicalDevice)->phys_dev, params->surface ? wine_surface_from_handle(params->surface)->driver_surface : 0, params->pSurfaceFormatCount, params->pSurfaceFormats);
return STATUS_SUCCESS;
}
#endif /* _WIN64 */
......@@ -38332,7 +38332,7 @@ static NTSTATUS thunk32_vkGetPhysicalDeviceSurfaceFormatsKHR(void *args)
TRACE("%#x, 0x%s, %#x, %#x\n", params->physicalDevice, wine_dbgstr_longlong(params->surface), params->pSurfaceFormatCount, params->pSurfaceFormats);
params->result = wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceSurfaceFormatsKHR(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->phys_dev, wine_surface_from_handle(params->surface)->driver_surface, (uint32_t *)UlongToPtr(params->pSurfaceFormatCount), (VkSurfaceFormatKHR *)UlongToPtr(params->pSurfaceFormats));
params->result = wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceSurfaceFormatsKHR(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->phys_dev, params->surface ? wine_surface_from_handle(params->surface)->driver_surface : 0, (uint32_t *)UlongToPtr(params->pSurfaceFormatCount), (VkSurfaceFormatKHR *)UlongToPtr(params->pSurfaceFormats));
return STATUS_SUCCESS;
}
......@@ -38343,7 +38343,7 @@ static NTSTATUS thunk64_vkGetPhysicalDeviceSurfacePresentModesKHR(void *args)
TRACE("%p, 0x%s, %p, %p\n", params->physicalDevice, wine_dbgstr_longlong(params->surface), params->pPresentModeCount, params->pPresentModes);
params->result = wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceSurfacePresentModesKHR(wine_phys_dev_from_handle(params->physicalDevice)->phys_dev, wine_surface_from_handle(params->surface)->driver_surface, params->pPresentModeCount, params->pPresentModes);
params->result = wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceSurfacePresentModesKHR(wine_phys_dev_from_handle(params->physicalDevice)->phys_dev, params->surface ? wine_surface_from_handle(params->surface)->driver_surface : 0, params->pPresentModeCount, params->pPresentModes);
return STATUS_SUCCESS;
}
#endif /* _WIN64 */
......@@ -38361,7 +38361,7 @@ static NTSTATUS thunk32_vkGetPhysicalDeviceSurfacePresentModesKHR(void *args)
TRACE("%#x, 0x%s, %#x, %#x\n", params->physicalDevice, wine_dbgstr_longlong(params->surface), params->pPresentModeCount, params->pPresentModes);
params->result = wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceSurfacePresentModesKHR(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->phys_dev, wine_surface_from_handle(params->surface)->driver_surface, (uint32_t *)UlongToPtr(params->pPresentModeCount), (VkPresentModeKHR *)UlongToPtr(params->pPresentModes));
params->result = wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceSurfacePresentModesKHR(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->phys_dev, params->surface ? wine_surface_from_handle(params->surface)->driver_surface : 0, (uint32_t *)UlongToPtr(params->pPresentModeCount), (VkPresentModeKHR *)UlongToPtr(params->pPresentModes));
return STATUS_SUCCESS;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment