Commit 37be0989 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

winevulkan: Make Vulkan direct Unix calls more similar to __wine_unix_call interface.

parent 3661194f
......@@ -255,7 +255,7 @@ VkResult WINAPI vkCreateInstance(const VkInstanceCreateInfo *create_info,
params.pCreateInfo = create_info;
params.pAllocator = allocator;
params.pInstance = instance;
return unix_funcs->p_vkCreateInstance(&params);
return unix_funcs->p_vk_call(unix_vkCreateInstance, &params);
}
VkResult WINAPI vkEnumerateInstanceExtensionProperties(const char *layer_name,
......@@ -280,7 +280,7 @@ VkResult WINAPI vkEnumerateInstanceExtensionProperties(const char *layer_name,
params.pLayerName = layer_name;
params.pPropertyCount = count;
params.pProperties = properties;
return unix_funcs->p_vkEnumerateInstanceExtensionProperties(&params);
return unix_funcs->p_vk_call(unix_vkEnumerateInstanceExtensionProperties, &params);
}
VkResult WINAPI vkEnumerateInstanceVersion(uint32_t *version)
......@@ -296,7 +296,7 @@ VkResult WINAPI vkEnumerateInstanceVersion(uint32_t *version)
}
params.pApiVersion = version;
return unix_funcs->p_vkEnumerateInstanceVersion(&params);
return unix_funcs->p_vk_call(unix_vkEnumerateInstanceVersion, &params);
}
static HANDLE get_display_device_init_mutex(void)
......@@ -377,7 +377,7 @@ void WINAPI vkGetPhysicalDeviceProperties2(VkPhysicalDevice phys_dev,
params.physicalDevice = phys_dev;
params.pProperties = properties2;
unix_funcs->p_vkGetPhysicalDeviceProperties2(&params);
unix_funcs->p_vk_call(unix_vkGetPhysicalDeviceProperties2, &params);
fill_luid_property(properties2);
}
......@@ -390,7 +390,7 @@ void WINAPI vkGetPhysicalDeviceProperties2KHR(VkPhysicalDevice phys_dev,
params.physicalDevice = phys_dev;
params.pProperties = properties2;
unix_funcs->p_vkGetPhysicalDeviceProperties2KHR(&params);
unix_funcs->p_vk_call(unix_vkGetPhysicalDeviceProperties2KHR, &params);
fill_luid_property(properties2);
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -751,10 +751,10 @@ class VkFunction(object):
body += " params.{0} = {0};\n".format(p.name)
body += " ";
# Call the function from unix_funcs.
# Call the Unix function.
if self.type != "void" and not self.returns_longlong():
body += "return "
body += "unix_funcs->p_{0}(&params);\n".format(self.name)
body += "unix_funcs->p_vk_call(unix_{0}, &params);\n".format(self.name)
if self.returns_longlong():
body += " return params.result;\n"
return body
......@@ -861,13 +861,13 @@ class VkFunction(object):
stub += "}\n\n"
return stub
def thunk(self, call_conv=None, prefix=None):
if self.needs_private_thunk():
thunk = self.prototype(call_conv=call_conv, prefix=prefix)
def thunk(self, prefix=None):
if prefix == "thunk_":
thunk = self.prototype(prefix=prefix)
thunk += "\n{\n"
params_prefix = ""
else:
thunk = "NTSTATUS {0} {1}{2}(void *args)\n".format(call_conv, prefix, self.name)
thunk = "NTSTATUS {0}{1}(void *args)\n".format(prefix, self.name)
thunk += "{\n"
thunk += " struct {0}_params *params = args;\n".format(self.name)
params_prefix = "params->"
......@@ -2721,18 +2721,15 @@ class VkGenerator(object):
for vk_func in self.registry.funcs.values():
if not vk_func.needs_exposing():
continue
if vk_func.is_global_func():
continue
if not vk_func.needs_thunk():
if vk_func.loader_thunk_type == ThunkType.NONE:
continue
if vk_func.needs_private_thunk():
f.write(vk_func.thunk(prefix="thunk_"))
else:
if vk_func.thunk_type == ThunkType.PUBLIC:
f.write("static ")
f.write(vk_func.thunk(prefix=prefix, call_conv="WINAPI"))
f.write(vk_func.thunk(prefix=prefix))
# Create array of device extensions.
f.write("static const char * const vk_device_extensions[] =\n{\n")
......@@ -2808,8 +2805,9 @@ class VkGenerator(object):
f.write(" }\n")
f.write("}\n\n")
f.write("const struct unix_funcs loader_funcs =\n")
f.write("const unixlib_entry_t __wine_unix_call_funcs[] =\n")
f.write("{\n")
f.write(" init_vulkan,\n")
for vk_func in self.registry.funcs.values():
if not vk_func.needs_exposing():
continue
......@@ -2817,15 +2815,20 @@ class VkGenerator(object):
continue
f.write(" &{1}{0},\n".format(vk_func.name, prefix))
f.write(" &wine_vk_is_available_instance_function,\n")
f.write(" &wine_vk_is_available_device_function,\n")
f.write("};\n\n")
f.write("};\n")
f.write("C_ASSERT(ARRAYSIZE(__wine_unix_call_funcs) == unix_count);\n\n")
f.write("const unixlib_entry_t __wine_unix_call_funcs[] =\n")
f.write("static NTSTATUS WINAPI wine_vk_call(enum unix_call code, void *params)\n")
f.write("{\n")
f.write(" init_vulkan,\n")
f.write(" return __wine_unix_call_funcs[code](params);\n")
f.write("}\n\n")
f.write("const struct unix_funcs loader_funcs =\n")
f.write("{\n")
f.write(" &wine_vk_call,\n")
f.write(" &wine_vk_is_available_instance_function,\n")
f.write(" &wine_vk_is_available_device_function,\n")
f.write("};\n")
f.write("C_ASSERT(ARRAYSIZE(__wine_unix_call_funcs) == unix_count);\n")
def generate_thunks_h(self, f, prefix):
self._generate_copyright(f)
......@@ -2843,7 +2846,7 @@ class VkGenerator(object):
if vk_func.needs_thunk() and not vk_func.needs_private_thunk():
continue
f.write("NTSTATUS WINAPI {0}{1}(void *args) DECLSPEC_HIDDEN;\n".format(prefix, vk_func.name))
f.write("NTSTATUS {0}{1}(void *args) DECLSPEC_HIDDEN;\n".format(prefix, vk_func.name))
f.write("\n")
f.write("/* Private thunks */\n")
......@@ -3013,24 +3016,16 @@ class VkGenerator(object):
f.write("#ifndef __WINE_VULKAN_LOADER_THUNKS_H\n")
f.write("#define __WINE_VULKAN_LOADER_THUNKS_H\n\n")
f.write("struct unix_funcs\n")
f.write("enum unix_call\n")
f.write("{\n")
f.write(" unix_init,\n")
for vk_func in self.registry.funcs.values():
if not vk_func.needs_exposing():
continue
if vk_func.loader_thunk_type == ThunkType.NONE:
continue
f.write(" NTSTATUS (WINAPI *p_{1})(void *args);\n".format(vk_func.type, vk_func.name))
f.write("\n")
f.write(" /* winevulkan specific functions */\n")
f.write(" BOOL (WINAPI *p_is_available_instance_function)(VkInstance, const char *);\n")
f.write(" BOOL (WINAPI *p_is_available_device_function)(VkDevice, const char *);\n")
f.write("};\n\n")
f.write("enum unix_call\n")
f.write("{\n")
f.write(" unix_init,\n")
f.write(" unix_{0},\n".format(vk_func.name))
f.write(" unix_count,\n")
f.write("};\n\n")
......
......@@ -103,4 +103,11 @@ static inline NTSTATUS vk_unix_call(enum unix_call code, void *params)
return __wine_unix_call(unix_handle, code, params);
}
struct unix_funcs
{
NTSTATUS (WINAPI *p_vk_call)(enum unix_call, void *);
BOOL (WINAPI *p_is_available_instance_function)(VkInstance, const char *);
BOOL (WINAPI *p_is_available_device_function)(VkDevice, const char *);
};
#endif /* __WINE_VULKAN_LOADER_H */
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -15,44 +15,44 @@
#define WINE_VK_VERSION VK_API_VERSION_1_2
/* Functions for which we have custom implementations outside of the thunks. */
NTSTATUS WINAPI wine_vkAllocateCommandBuffers(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkCreateCommandPool(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkCreateDebugReportCallbackEXT(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkCreateDebugUtilsMessengerEXT(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkCreateDevice(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkCreateInstance(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkCreateWin32SurfaceKHR(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkDestroyCommandPool(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkDestroyDebugReportCallbackEXT(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkDestroyDebugUtilsMessengerEXT(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkDestroyDevice(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkDestroyInstance(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkDestroySurfaceKHR(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkEnumerateDeviceExtensionProperties(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkEnumerateDeviceLayerProperties(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkEnumerateInstanceExtensionProperties(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkEnumerateInstanceLayerProperties(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkEnumerateInstanceVersion(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkEnumeratePhysicalDeviceGroups(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkEnumeratePhysicalDeviceGroupsKHR(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkEnumeratePhysicalDevices(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkFreeCommandBuffers(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkGetCalibratedTimestampsEXT(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkGetDeviceProcAddr(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkGetDeviceQueue(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkGetDeviceQueue2(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkGetInstanceProcAddr(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkGetPhysicalDeviceExternalBufferProperties(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkGetPhysicalDeviceExternalBufferPropertiesKHR(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkGetPhysicalDeviceExternalFenceProperties(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkGetPhysicalDeviceExternalFencePropertiesKHR(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkGetPhysicalDeviceExternalSemaphoreProperties(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkGetPhysicalDeviceImageFormatProperties2(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkGetPhysicalDeviceImageFormatProperties2KHR(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkGetPhysicalDeviceSurfaceCapabilities2KHR(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI wine_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkAllocateCommandBuffers(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkCreateCommandPool(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkCreateDebugReportCallbackEXT(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkCreateDebugUtilsMessengerEXT(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkCreateDevice(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkCreateInstance(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkCreateWin32SurfaceKHR(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkDestroyCommandPool(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkDestroyDebugReportCallbackEXT(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkDestroyDebugUtilsMessengerEXT(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkDestroyDevice(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkDestroyInstance(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkDestroySurfaceKHR(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkEnumerateDeviceExtensionProperties(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkEnumerateDeviceLayerProperties(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkEnumerateInstanceExtensionProperties(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkEnumerateInstanceLayerProperties(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkEnumerateInstanceVersion(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkEnumeratePhysicalDeviceGroups(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkEnumeratePhysicalDeviceGroupsKHR(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkEnumeratePhysicalDevices(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkFreeCommandBuffers(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkGetCalibratedTimestampsEXT(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkGetDeviceProcAddr(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkGetDeviceQueue(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkGetDeviceQueue2(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkGetInstanceProcAddr(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkGetPhysicalDeviceExternalBufferProperties(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkGetPhysicalDeviceExternalBufferPropertiesKHR(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkGetPhysicalDeviceExternalFenceProperties(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkGetPhysicalDeviceExternalFencePropertiesKHR(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkGetPhysicalDeviceExternalSemaphoreProperties(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkGetPhysicalDeviceImageFormatProperties2(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkGetPhysicalDeviceImageFormatProperties2KHR(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkGetPhysicalDeviceSurfaceCapabilities2KHR(void *args) DECLSPEC_HIDDEN;
NTSTATUS wine_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(void *args) DECLSPEC_HIDDEN;
/* Private thunks */
VkResult thunk_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties) DECLSPEC_HIDDEN;
......
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