Commit 2f41d851 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

winevulkan: Get rid of direct Unix calls.

parent d3ee5683
...@@ -35,8 +35,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(vulkan); ...@@ -35,8 +35,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(vulkan);
DEFINE_DEVPROPKEY(DEVPROPKEY_GPU_LUID, 0x60b193cb, 0x5276, 0x4d0f, 0x96, 0xfc, 0xf1, 0x73, 0xab, 0xad, 0x3e, 0xc6, 2); DEFINE_DEVPROPKEY(DEVPROPKEY_GPU_LUID, 0x60b193cb, 0x5276, 0x4d0f, 0x96, 0xfc, 0xf1, 0x73, 0xab, 0xad, 0x3e, 0xc6, 2);
DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_GPU_VULKAN_UUID, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5c, 2); DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_GPU_VULKAN_UUID, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5c, 2);
NTSTATUS (WINAPI *p_vk_direct_unix_call)(unixlib_handle_t handle, unsigned int code, void *args) = NULL;
static HINSTANCE hinstance; static HINSTANCE hinstance;
static void *wine_vk_get_global_proc_addr(const char *name); static void *wine_vk_get_global_proc_addr(const char *name);
...@@ -236,9 +234,8 @@ static BOOL WINAPI wine_vk_init(INIT_ONCE *once, void *param, void **context) ...@@ -236,9 +234,8 @@ static BOOL WINAPI wine_vk_init(INIT_ONCE *once, void *param, void **context)
{ {
NTSTATUS status = __wine_init_unix_call(); NTSTATUS status = __wine_init_unix_call();
p_vk_direct_unix_call = __wine_unix_call_dispatcher;
if (status) return FALSE; if (status) return FALSE;
return !vk_unix_call(unix_init, &p_vk_direct_unix_call); return !vk_unix_call(unix_init, NULL);
} }
static BOOL wine_vk_init_once(void) static BOOL wine_vk_init_once(void)
......
...@@ -149,12 +149,6 @@ ALLOWED_X_EXTENSIONS = [ ...@@ -149,12 +149,6 @@ ALLOWED_X_EXTENSIONS = [
"VK_NVX_image_view_handle", "VK_NVX_image_view_handle",
] ]
# Some frequently called functions use direct calls for performance reasons.
DIRECT_CALL_FUNCTIONS = [
"vkUpdateDescriptorSets",
"vkUpdateDescriptorSetWithTemplate",
]
# Functions part of our winevulkan graphics driver interface. # Functions part of our winevulkan graphics driver interface.
# DRIVER_VERSION should be bumped on any change to driver interface # DRIVER_VERSION should be bumped on any change to driver interface
# in FUNCTION_OVERRIDES # in FUNCTION_OVERRIDES
...@@ -679,12 +673,6 @@ class VkFunction(object): ...@@ -679,12 +673,6 @@ class VkFunction(object):
# The function needs exposed if at-least one extension isn't both UNSUPPORTED and UNEXPOSED # The function needs exposed if at-least one extension isn't both UNSUPPORTED and UNEXPOSED
return self.is_required() and (not self.extensions or not self.extensions.issubset(UNEXPOSED_EXTENSIONS)) return self.is_required() and (not self.extensions or not self.extensions.issubset(UNEXPOSED_EXTENSIONS))
def needs_direct_call(self):
# vkCmd* functions are frequently called, use direct calls for performance
if self.name.startswith("vkCmd"):
return True
return self.name in DIRECT_CALL_FUNCTIONS
def pfn(self, prefix="p", call_conv=None): def pfn(self, prefix="p", call_conv=None):
""" Create function pointer. """ """ Create function pointer. """
...@@ -747,13 +735,9 @@ class VkFunction(object): ...@@ -747,13 +735,9 @@ class VkFunction(object):
body += " NTSTATUS status;\n" body += " NTSTATUS status;\n"
for p in self.params: for p in self.params:
body += " params.{0} = {0};\n".format(p.name) body += " params.{0} = {0};\n".format(p.name)
body += " ";
# Call the Unix function. # Call the Unix function.
if self.needs_direct_call(): body += " status = vk_unix_call(unix_{0}, &params);\n".format(self.name)
body += "status = p_vk_direct_unix_call(__wine_unixlib_handle, unix_{0}, &params);\n".format(self.name)
else:
body += "status = vk_unix_call(unix_{0}, &params);\n".format(self.name)
body += " assert(!status);\n" body += " assert(!status);\n"
if self.type != "void": if self.type != "void":
body += " return params.result;\n" body += " return params.result;\n"
...@@ -2733,7 +2717,7 @@ class VkGenerator(object): ...@@ -2733,7 +2717,7 @@ class VkGenerator(object):
f.write("const unixlib_entry_t __wine_unix_call_funcs[] =\n") f.write("const unixlib_entry_t __wine_unix_call_funcs[] =\n")
f.write("#endif\n") f.write("#endif\n")
f.write("{\n") f.write("{\n")
f.write(" init_vulkan32,\n") f.write(" init_vulkan,\n")
f.write(" vk_is_available_instance_function32,\n") f.write(" vk_is_available_instance_function32,\n")
f.write(" vk_is_available_device_function32,\n") f.write(" vk_is_available_device_function32,\n")
for vk_func in self.registry.funcs.values(): for vk_func in self.registry.funcs.values():
...@@ -2744,12 +2728,7 @@ class VkGenerator(object): ...@@ -2744,12 +2728,7 @@ class VkGenerator(object):
f.write(" {1}{0},\n".format(vk_func.name, "thunk32_")) f.write(" {1}{0},\n".format(vk_func.name, "thunk32_"))
f.write("};\n") f.write("};\n")
f.write("C_ASSERT(ARRAYSIZE(__wine_unix_call_funcs) == unix_count);\n\n") f.write("C_ASSERT(ARRAYSIZE(__wine_unix_call_funcs) == unix_count);\n")
f.write("NTSTATUS WINAPI vk_direct_unix_call(unixlib_handle_t handle, unsigned int code, void *params)\n")
f.write("{\n")
f.write(" return __wine_unix_call_funcs[code](params);\n")
f.write("}\n")
def generate_thunks_h(self, f, prefix): def generate_thunks_h(self, f, prefix):
self._generate_copyright(f) self._generate_copyright(f)
......
...@@ -462,8 +462,6 @@ static void wine_vk_device_free(struct wine_device *device) ...@@ -462,8 +462,6 @@ static void wine_vk_device_free(struct wine_device *device)
free(device); free(device);
} }
#ifdef _WIN64
NTSTATUS init_vulkan(void *args) NTSTATUS init_vulkan(void *args)
{ {
vk_funcs = __wine_get_vulkan_driver(WINE_VULKAN_DRIVER_VERSION); vk_funcs = __wine_get_vulkan_driver(WINE_VULKAN_DRIVER_VERSION);
...@@ -473,25 +471,6 @@ NTSTATUS init_vulkan(void *args) ...@@ -473,25 +471,6 @@ NTSTATUS init_vulkan(void *args)
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
*(void **)args = vk_direct_unix_call;
return STATUS_SUCCESS;
}
#endif /* _WIN64 */
NTSTATUS init_vulkan32(void *args)
{
vk_funcs = __wine_get_vulkan_driver(WINE_VULKAN_DRIVER_VERSION);
if (!vk_funcs)
{
ERR("Failed to load Wine graphics driver supporting Vulkan.\n");
return STATUS_UNSUCCESSFUL;
}
#ifndef _WIN64
*(void **)args = vk_direct_unix_call;
#endif
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
......
...@@ -147,9 +147,6 @@ struct is_available_device_function_params ...@@ -147,9 +147,6 @@ struct is_available_device_function_params
#ifndef WINE_UNIX_LIB #ifndef WINE_UNIX_LIB
extern NTSTATUS (WINAPI *p_vk_direct_unix_call)(unixlib_handle_t handle, unsigned int code,
void *args) DECLSPEC_HIDDEN;
static inline NTSTATUS vk_unix_call(enum unix_call code, void *params) static inline NTSTATUS vk_unix_call(enum unix_call code, void *params)
{ {
return WINE_UNIX_CALL(code, params); return WINE_UNIX_CALL(code, params);
......
...@@ -243,9 +243,6 @@ BOOL wine_vk_instance_extension_supported(const char *name) DECLSPEC_HIDDEN; ...@@ -243,9 +243,6 @@ BOOL wine_vk_instance_extension_supported(const char *name) DECLSPEC_HIDDEN;
BOOL wine_vk_is_type_wrapped(VkObjectType type) DECLSPEC_HIDDEN; BOOL wine_vk_is_type_wrapped(VkObjectType type) DECLSPEC_HIDDEN;
NTSTATUS init_vulkan(void *args) DECLSPEC_HIDDEN; NTSTATUS init_vulkan(void *args) DECLSPEC_HIDDEN;
NTSTATUS init_vulkan32(void *args) DECLSPEC_HIDDEN;
NTSTATUS WINAPI vk_direct_unix_call(unixlib_handle_t handle, unsigned int code, void *arg) DECLSPEC_HIDDEN;
NTSTATUS vk_is_available_instance_function(void *arg) DECLSPEC_HIDDEN; NTSTATUS vk_is_available_instance_function(void *arg) DECLSPEC_HIDDEN;
NTSTATUS vk_is_available_device_function(void *arg) DECLSPEC_HIDDEN; NTSTATUS vk_is_available_device_function(void *arg) DECLSPEC_HIDDEN;
......
...@@ -41789,7 +41789,7 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] = ...@@ -41789,7 +41789,7 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] =
const unixlib_entry_t __wine_unix_call_funcs[] = const unixlib_entry_t __wine_unix_call_funcs[] =
#endif #endif
{ {
init_vulkan32, init_vulkan,
vk_is_available_instance_function32, vk_is_available_instance_function32,
vk_is_available_device_function32, vk_is_available_device_function32,
thunk32_vkAcquireNextImage2KHR, thunk32_vkAcquireNextImage2KHR,
...@@ -42320,8 +42320,3 @@ const unixlib_entry_t __wine_unix_call_funcs[] = ...@@ -42320,8 +42320,3 @@ const unixlib_entry_t __wine_unix_call_funcs[] =
thunk32_vkWriteMicromapsPropertiesEXT, thunk32_vkWriteMicromapsPropertiesEXT,
}; };
C_ASSERT(ARRAYSIZE(__wine_unix_call_funcs) == unix_count); C_ASSERT(ARRAYSIZE(__wine_unix_call_funcs) == unix_count);
NTSTATUS WINAPI vk_direct_unix_call(unixlib_handle_t handle, unsigned int code, void *params)
{
return __wine_unix_call_funcs[code](params);
}
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