Commit c09a4145 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

winevulkan: Pass type as uint32_t to wine_vk_unwrap_handle.

Fixes -Wenum-conversion warning when VkDebugReportObjectTypeEXT is used as a type.
parent e8af92ac
......@@ -2349,6 +2349,26 @@ class VkGenerator(object):
f.write("WINE_DEFAULT_DEBUG_CHANNEL(vulkan);\n\n")
f.write("static uint64_t wine_vk_unwrap_handle(uint32_t type, uint64_t handle)\n")
f.write("{\n")
f.write(" switch(type)\n")
f.write(" {\n")
for handle in self.registry.handles:
if not handle.is_required() or not handle.is_wrapped() or handle.is_alias():
continue
f.write(" case {}:\n".format(handle.object_type))
if handle.is_dispatchable():
f.write(" return (uint64_t) (uintptr_t) ")
f.write(handle.native_handle("(({}) (uintptr_t) handle)".format(handle.name)))
else:
f.write(" return (uint64_t) ")
f.write(handle.native_handle("handle"))
f.write(";\n");
f.write(" default:\n")
f.write(" return handle;\n")
f.write(" }\n")
f.write("}\n\n")
# Generate any conversion helper functions.
for conv in self.conversions:
f.write(conv.definition())
......@@ -2426,26 +2446,6 @@ class VkGenerator(object):
f.write(";\n")
f.write("}\n\n")
f.write("uint64_t wine_vk_unwrap_handle(VkObjectType type, uint64_t handle)\n")
f.write("{\n")
f.write(" switch(type)\n")
f.write(" {\n")
for handle in self.registry.handles:
if not handle.is_required() or not handle.is_wrapped() or handle.is_alias():
continue
f.write(" case {}:\n".format(handle.object_type))
if handle.is_dispatchable():
f.write(" return (uint64_t) (uintptr_t) ")
f.write(handle.native_handle("(({}) (uintptr_t) handle)".format(handle.name)))
else:
f.write(" return (uint64_t) ")
f.write(handle.native_handle("handle"))
f.write(";\n");
f.write(" default:\n")
f.write(" return handle;\n")
f.write(" }\n")
f.write("}\n\n")
f.write("#if !defined(USE_STRUCT_CONVERSION)\n\n")
f.write("const unixlib_entry_t __wine_unix_call_funcs[] =\n")
......
......@@ -230,7 +230,6 @@ BOOL wine_vk_device_extension_supported(const char *name) DECLSPEC_HIDDEN;
BOOL wine_vk_instance_extension_supported(const char *name) DECLSPEC_HIDDEN;
BOOL wine_vk_is_type_wrapped(VkObjectType type) DECLSPEC_HIDDEN;
uint64_t wine_vk_unwrap_handle(VkObjectType type, uint64_t handle) DECLSPEC_HIDDEN;
NTSTATUS init_vulkan(void *args) DECLSPEC_HIDDEN;
......
......@@ -21,6 +21,33 @@
WINE_DEFAULT_DEBUG_CHANNEL(vulkan);
static uint64_t wine_vk_unwrap_handle(uint32_t type, uint64_t handle)
{
switch(type)
{
case VK_OBJECT_TYPE_COMMAND_BUFFER:
return (uint64_t) (uintptr_t) wine_cmd_buffer_from_handle(((VkCommandBuffer) (uintptr_t) handle))->command_buffer;
case VK_OBJECT_TYPE_COMMAND_POOL:
return (uint64_t) wine_cmd_pool_from_handle(handle)->command_pool;
case VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT:
return (uint64_t) wine_debug_report_callback_from_handle(handle)->debug_callback;
case VK_OBJECT_TYPE_DEBUG_UTILS_MESSENGER_EXT:
return (uint64_t) wine_debug_utils_messenger_from_handle(handle)->debug_messenger;
case VK_OBJECT_TYPE_DEVICE:
return (uint64_t) (uintptr_t) wine_device_from_handle(((VkDevice) (uintptr_t) handle))->device;
case VK_OBJECT_TYPE_INSTANCE:
return (uint64_t) (uintptr_t) wine_instance_from_handle(((VkInstance) (uintptr_t) handle))->instance;
case VK_OBJECT_TYPE_PHYSICAL_DEVICE:
return (uint64_t) (uintptr_t) wine_phys_dev_from_handle(((VkPhysicalDevice) (uintptr_t) handle))->phys_dev;
case VK_OBJECT_TYPE_QUEUE:
return (uint64_t) (uintptr_t) wine_queue_from_handle(((VkQueue) (uintptr_t) handle))->queue;
case VK_OBJECT_TYPE_SURFACE_KHR:
return (uint64_t) wine_surface_from_handle(handle)->surface;
default:
return handle;
}
}
#if defined(USE_STRUCT_CONVERSION)
static inline void convert_VkAcquireNextImageInfoKHR_win32_to_host(const VkAcquireNextImageInfoKHR *in, VkAcquireNextImageInfoKHR_host *out)
{
......@@ -19636,33 +19663,6 @@ BOOL wine_vk_is_type_wrapped(VkObjectType type)
type == VK_OBJECT_TYPE_SURFACE_KHR;
}
uint64_t wine_vk_unwrap_handle(VkObjectType type, uint64_t handle)
{
switch(type)
{
case VK_OBJECT_TYPE_COMMAND_BUFFER:
return (uint64_t) (uintptr_t) wine_cmd_buffer_from_handle(((VkCommandBuffer) (uintptr_t) handle))->command_buffer;
case VK_OBJECT_TYPE_COMMAND_POOL:
return (uint64_t) wine_cmd_pool_from_handle(handle)->command_pool;
case VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT:
return (uint64_t) wine_debug_report_callback_from_handle(handle)->debug_callback;
case VK_OBJECT_TYPE_DEBUG_UTILS_MESSENGER_EXT:
return (uint64_t) wine_debug_utils_messenger_from_handle(handle)->debug_messenger;
case VK_OBJECT_TYPE_DEVICE:
return (uint64_t) (uintptr_t) wine_device_from_handle(((VkDevice) (uintptr_t) handle))->device;
case VK_OBJECT_TYPE_INSTANCE:
return (uint64_t) (uintptr_t) wine_instance_from_handle(((VkInstance) (uintptr_t) handle))->instance;
case VK_OBJECT_TYPE_PHYSICAL_DEVICE:
return (uint64_t) (uintptr_t) wine_phys_dev_from_handle(((VkPhysicalDevice) (uintptr_t) handle))->phys_dev;
case VK_OBJECT_TYPE_QUEUE:
return (uint64_t) (uintptr_t) wine_queue_from_handle(((VkQueue) (uintptr_t) handle))->queue;
case VK_OBJECT_TYPE_SURFACE_KHR:
return (uint64_t) wine_surface_from_handle(handle)->surface;
default:
return handle;
}
}
#if !defined(USE_STRUCT_CONVERSION)
const unixlib_entry_t __wine_unix_call_funcs[] =
......
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