Commit 9d7cda92 authored by Georg Lehmann's avatar Georg Lehmann Committed by Alexandre Julliard

winevulkan: Unwrap struct members with objecttype.

parent 221995a6
......@@ -242,17 +242,10 @@ FUNCTION_OVERRIDES = {
# VK_EXT_debug_utils
"vkCreateDebugUtilsMessengerEXT" : {"dispatch": True, "driver" : False, "thunk" : ThunkType.NONE},
"vkDestroyDebugUtilsMessengerEXT" : {"dispatch": True, "driver" : False, "thunk" : ThunkType.NONE},
"vkSubmitDebugUtilsMessageEXT" : {"dispatch": True, "driver" : False, "thunk" : ThunkType.PRIVATE},
"vkSetDebugUtilsObjectTagEXT" : {"dispatch": True, "driver" : False, "thunk" : ThunkType.PRIVATE},
"vkSetDebugUtilsObjectNameEXT" : {"dispatch": True, "driver" : False, "thunk" : ThunkType.PRIVATE},
# VK_EXT_debug_report
"vkCreateDebugReportCallbackEXT" : {"dispatch": True, "driver" : False, "thunk" : ThunkType.NONE},
"vkDestroyDebugReportCallbackEXT" : {"dispatch": True, "driver" : False, "thunk" : ThunkType.NONE},
# VK_EXT_debug_marker
"vkDebugMarkerSetObjectNameEXT" : {"dispatch": True, "driver" : False, "thunk" : ThunkType.PRIVATE},
"vkDebugMarkerSetObjectTagEXT" : {"dispatch": True, "driver" : False, "thunk" : ThunkType.PRIVATE},
}
STRUCT_CHAIN_CONVERSIONS = {
......@@ -1085,7 +1078,7 @@ class VkHandle(object):
class VkMember(object):
def __init__(self, const=False, struct_fwd_decl=False,_type=None, pointer=None, name=None, array_len=None,
dyn_array_len=None, optional=False, values=None):
dyn_array_len=None, optional=False, values=None, object_type=None):
self.const = const
self.struct_fwd_decl = struct_fwd_decl
self.name = name
......@@ -1096,6 +1089,7 @@ class VkMember(object):
self.dyn_array_len = dyn_array_len
self.optional = optional
self.values = values
self.object_type = object_type
def __eq__(self, other):
""" Compare member based on name against a string.
......@@ -1165,8 +1159,10 @@ class VkMember(object):
# Remove brackets around length
array_len = name_elem.tail.strip("[]")
object_type = member.get("objecttype", None)
return VkMember(const=const, struct_fwd_decl=struct_fwd_decl, _type=member_type, pointer=pointer, name=name_elem.text,
array_len=array_len, dyn_array_len=dyn_array_len, optional=optional, values=values)
array_len=array_len, dyn_array_len=dyn_array_len, optional=optional, values=values, object_type=object_type)
def copy(self, input, output, direction, conv):
""" Helper method for use by conversion logic to generate a C-code statement to copy this member.
......@@ -1194,6 +1190,11 @@ class VkMember(object):
else:
handle = self.type_info["data"]
return "{0}{1} = {2};\n".format(output, self.name, handle.driver_handle("{0}{1}".format(input, self.name)))
elif self.is_generic_handle():
if direction == Direction.OUTPUT:
LOGGER.err("OUTPUT parameter {0}.{1} cannot be unwrapped".format(self.type, self.name))
else:
return "{0}{1} = wine_vk_unwrap_handle({2}{3}, {2}{1});\n".format(output, self.name, input, self.object_type)
else:
if direction == Direction.OUTPUT:
return "convert_{0}_host_to_win(&{2}{1}, &{3}{1});\n".format(self.type, self.name, input, output)
......@@ -1288,7 +1289,7 @@ class VkMember(object):
struct.needs_struct_extensions_conversion()
direction = Direction.OUTPUT if struct.returnedonly else Direction.INPUT
elif self.is_handle():
elif self.is_handle() or self.is_generic_handle():
direction = Direction.INPUT
operand = self.type_info["data"]
......@@ -1336,6 +1337,13 @@ class VkMember(object):
def is_union(self):
return self.type_info["category"] == "union"
def is_generic_handle(self):
""" Returns True if the member is a unit64_t containing
a handle with a separate object type
"""
return self.object_type != None and self.type == "uint64_t"
def needs_alignment(self):
""" Check if this member needs alignment for 64-bit data.
Various structures need alignment on 64-bit variables due
......@@ -1378,6 +1386,9 @@ class VkMember(object):
handle = self.type_info["data"]
return handle.is_wrapped()
if self.is_generic_handle():
return True
return False
def needs_free(self):
......
......@@ -1549,55 +1549,6 @@ void WINAPI wine_vkDestroyDebugUtilsMessengerEXT(
free(object);
}
void WINAPI wine_vkSubmitDebugUtilsMessageEXT(VkInstance instance, VkDebugUtilsMessageSeverityFlagBitsEXT severity,
VkDebugUtilsMessageTypeFlagsEXT types, const VkDebugUtilsMessengerCallbackDataEXT *callback_data)
{
VkDebugUtilsMessengerCallbackDataEXT native_callback_data;
VkDebugUtilsObjectNameInfoEXT *object_names;
unsigned int i;
TRACE("%p, %#x, %#x, %p\n", instance, severity, types, callback_data);
native_callback_data = *callback_data;
object_names = calloc(callback_data->objectCount, sizeof(*object_names));
memcpy(object_names, callback_data->pObjects, callback_data->objectCount * sizeof(*object_names));
native_callback_data.pObjects = object_names;
for (i = 0; i < callback_data->objectCount; i++)
{
object_names[i].objectHandle =
wine_vk_unwrap_handle(callback_data->pObjects[i].objectType, callback_data->pObjects[i].objectHandle);
}
thunk_vkSubmitDebugUtilsMessageEXT(instance, severity, types, &native_callback_data);
free(object_names);
}
VkResult WINAPI wine_vkSetDebugUtilsObjectTagEXT(VkDevice device, const VkDebugUtilsObjectTagInfoEXT *tag_info)
{
VkDebugUtilsObjectTagInfoEXT wine_tag_info;
TRACE("%p, %p\n", device, tag_info);
wine_tag_info = *tag_info;
wine_tag_info.objectHandle = wine_vk_unwrap_handle(tag_info->objectType, tag_info->objectHandle);
return thunk_vkSetDebugUtilsObjectTagEXT(device, &wine_tag_info);
}
VkResult WINAPI wine_vkSetDebugUtilsObjectNameEXT(VkDevice device, const VkDebugUtilsObjectNameInfoEXT *name_info)
{
VkDebugUtilsObjectNameInfoEXT wine_name_info;
TRACE("%p, %p\n", device, name_info);
wine_name_info = *name_info;
wine_name_info.objectHandle = wine_vk_unwrap_handle(name_info->objectType, name_info->objectHandle);
return thunk_vkSetDebugUtilsObjectNameEXT(device, &wine_name_info);
}
VkResult WINAPI wine_vkCreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *create_info,
const VkAllocationCallbacks *allocator, VkDebugReportCallbackEXT *callback)
{
......@@ -1654,27 +1605,3 @@ void WINAPI wine_vkDestroyDebugReportCallbackEXT(
free(object);
}
VkResult WINAPI wine_vkDebugMarkerSetObjectTagEXT(VkDevice device, const VkDebugMarkerObjectTagInfoEXT *tag_info)
{
VkDebugMarkerObjectTagInfoEXT wine_tag_info;
TRACE("%p, %p\n", device, tag_info);
wine_tag_info = *tag_info;
wine_tag_info.object = wine_vk_unwrap_handle(tag_info->objectType, tag_info->object);
return thunk_vkDebugMarkerSetObjectTagEXT(device, &wine_tag_info);
}
VkResult WINAPI wine_vkDebugMarkerSetObjectNameEXT(VkDevice device, const VkDebugMarkerObjectNameInfoEXT *name_info)
{
VkDebugMarkerObjectNameInfoEXT wine_name_info;
TRACE("%p, %p\n", device, name_info);
wine_name_info = *name_info;
wine_name_info.object = wine_vk_unwrap_handle(name_info->objectType, name_info->object);
return thunk_vkDebugMarkerSetObjectNameEXT(device, &wine_name_info);
}
......@@ -22,8 +22,6 @@ VkResult WINAPI wine_vkCreateDebugUtilsMessengerEXT(VkInstance instance, const V
VkResult WINAPI wine_vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDevice *pDevice);
VkResult WINAPI wine_vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkInstance *pInstance);
VkResult WINAPI wine_vkCreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface);
VkResult WINAPI wine_vkDebugMarkerSetObjectNameEXT(VkDevice device, const VkDebugMarkerObjectNameInfoEXT *pNameInfo) DECLSPEC_HIDDEN;
VkResult WINAPI wine_vkDebugMarkerSetObjectTagEXT(VkDevice device, const VkDebugMarkerObjectTagInfoEXT *pTagInfo) DECLSPEC_HIDDEN;
void WINAPI wine_vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks *pAllocator);
void WINAPI wine_vkDestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks *pAllocator) DECLSPEC_HIDDEN;
void WINAPI wine_vkDestroyDebugUtilsMessengerEXT(VkInstance instance, VkDebugUtilsMessengerEXT messenger, const VkAllocationCallbacks *pAllocator) DECLSPEC_HIDDEN;
......@@ -55,20 +53,12 @@ VkResult WINAPI wine_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice
VkResult WINAPI wine_vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties) DECLSPEC_HIDDEN;
VkResult WINAPI wine_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, VkSurfaceCapabilities2KHR *pSurfaceCapabilities);
VkResult WINAPI wine_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfaceCapabilities);
VkResult WINAPI wine_vkSetDebugUtilsObjectNameEXT(VkDevice device, const VkDebugUtilsObjectNameInfoEXT *pNameInfo) DECLSPEC_HIDDEN;
VkResult WINAPI wine_vkSetDebugUtilsObjectTagEXT(VkDevice device, const VkDebugUtilsObjectTagInfoEXT *pTagInfo) DECLSPEC_HIDDEN;
void WINAPI wine_vkSubmitDebugUtilsMessageEXT(VkInstance instance, VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, VkDebugUtilsMessageTypeFlagsEXT messageTypes, const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData) DECLSPEC_HIDDEN;
/* Private thunks */
VkResult thunk_vkDebugMarkerSetObjectNameEXT(VkDevice device, const VkDebugMarkerObjectNameInfoEXT *pNameInfo) DECLSPEC_HIDDEN;
VkResult thunk_vkDebugMarkerSetObjectTagEXT(VkDevice device, const VkDebugMarkerObjectTagInfoEXT *pTagInfo) DECLSPEC_HIDDEN;
VkResult thunk_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties) DECLSPEC_HIDDEN;
VkResult thunk_vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties) DECLSPEC_HIDDEN;
VkResult thunk_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, VkSurfaceCapabilities2KHR *pSurfaceCapabilities) DECLSPEC_HIDDEN;
VkResult thunk_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) DECLSPEC_HIDDEN;
VkResult thunk_vkSetDebugUtilsObjectNameEXT(VkDevice device, const VkDebugUtilsObjectNameInfoEXT *pNameInfo) DECLSPEC_HIDDEN;
VkResult thunk_vkSetDebugUtilsObjectTagEXT(VkDevice device, const VkDebugUtilsObjectTagInfoEXT *pTagInfo) DECLSPEC_HIDDEN;
void thunk_vkSubmitDebugUtilsMessageEXT(VkInstance instance, VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, VkDebugUtilsMessageTypeFlagsEXT messageTypes, const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData) DECLSPEC_HIDDEN;
#if defined(USE_STRUCT_CONVERSION)
typedef struct VkAcquireNextImageInfoKHR_host
......
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