From 007a4bc9b0f788f91125b692ea12ce23adf1eb21 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Thu, 29 Apr 2021 14:38:46 +0200 Subject: [PATCH] winevulkan: Don't use wine_ prefix on PE side. There is no ABI ambiguity, so we may just use public names. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/winevulkan/loader.c | 34 ++++++++++++++--------------- dlls/winevulkan/make_vulkan | 37 +++++++++++--------------------- dlls/winevulkan/vulkan_loader.h | 2 -- dlls/winevulkan/vulkan_private.h | 1 + 4 files changed, 31 insertions(+), 43 deletions(-) diff --git a/dlls/winevulkan/loader.c b/dlls/winevulkan/loader.c index 73f09d9e303..6bc32620bba 100644 --- a/dlls/winevulkan/loader.c +++ b/dlls/winevulkan/loader.c @@ -60,7 +60,7 @@ static void *wine_vk_find_struct_(void *s, VkStructureType t) return NULL; } -VkResult WINAPI wine_vkEnumerateInstanceLayerProperties(uint32_t *count, VkLayerProperties *properties) +VkResult WINAPI vkEnumerateInstanceLayerProperties(uint32_t *count, VkLayerProperties *properties) { TRACE("%p, %p\n", count, properties); @@ -71,11 +71,11 @@ VkResult WINAPI wine_vkEnumerateInstanceLayerProperties(uint32_t *count, VkLayer static const struct vulkan_func vk_global_dispatch_table[] = { /* These functions must call wine_vk_init_once() before accessing vk_funcs. */ - {"vkCreateInstance", &wine_vkCreateInstance}, - {"vkEnumerateInstanceExtensionProperties", &wine_vkEnumerateInstanceExtensionProperties}, - {"vkEnumerateInstanceLayerProperties", &wine_vkEnumerateInstanceLayerProperties}, - {"vkEnumerateInstanceVersion", &wine_vkEnumerateInstanceVersion}, - {"vkGetInstanceProcAddr", &wine_vkGetInstanceProcAddr}, + {"vkCreateInstance", &vkCreateInstance}, + {"vkEnumerateInstanceExtensionProperties", &vkEnumerateInstanceExtensionProperties}, + {"vkEnumerateInstanceLayerProperties", &vkEnumerateInstanceLayerProperties}, + {"vkEnumerateInstanceVersion", &vkEnumerateInstanceVersion}, + {"vkGetInstanceProcAddr", &vkGetInstanceProcAddr}, }; static void *wine_vk_get_global_proc_addr(const char *name) @@ -93,7 +93,7 @@ static void *wine_vk_get_global_proc_addr(const char *name) return NULL; } -PFN_vkVoidFunction WINAPI wine_vkGetInstanceProcAddr(VkInstance instance, const char *name) +PFN_vkVoidFunction WINAPI vkGetInstanceProcAddr(VkInstance instance, const char *name) { void *func; @@ -130,7 +130,7 @@ PFN_vkVoidFunction WINAPI wine_vkGetInstanceProcAddr(VkInstance instance, const return NULL; } -PFN_vkVoidFunction WINAPI wine_vkGetDeviceProcAddr(VkDevice device, const char *name) +PFN_vkVoidFunction WINAPI vkGetDeviceProcAddr(VkDevice device, const char *name) { void *func; TRACE("%p, %s\n", device, debugstr_a(name)); @@ -171,14 +171,14 @@ PFN_vkVoidFunction WINAPI wine_vkGetDeviceProcAddr(VkDevice device, const char * return NULL; } -void * WINAPI wine_vk_icdGetPhysicalDeviceProcAddr(VkInstance instance, const char *name) +void * WINAPI vk_icdGetPhysicalDeviceProcAddr(VkInstance instance, const char *name) { TRACE("%p, %s\n", instance, debugstr_a(name)); return wine_vk_get_phys_dev_proc_addr(name); } -void * WINAPI wine_vk_icdGetInstanceProcAddr(VkInstance instance, const char *name) +void * WINAPI vk_icdGetInstanceProcAddr(VkInstance instance, const char *name) { TRACE("%p, %s\n", instance, debugstr_a(name)); @@ -187,10 +187,10 @@ void * WINAPI wine_vk_icdGetInstanceProcAddr(VkInstance instance, const char *na * Vulkan API. One of them in our case should forward to the other, so just forward * to the older vkGetInstanceProcAddr. */ - return wine_vkGetInstanceProcAddr(instance, name); + return vkGetInstanceProcAddr(instance, name); } -VkResult WINAPI wine_vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t *supported_version) +VkResult WINAPI vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t *supported_version) { uint32_t req_version; @@ -230,7 +230,7 @@ static BOOL wine_vk_init_once(void) return InitOnceExecuteOnce(&init_once, wine_vk_init, NULL, NULL); } -VkResult WINAPI wine_vkCreateInstance(const VkInstanceCreateInfo *create_info, +VkResult WINAPI vkCreateInstance(const VkInstanceCreateInfo *create_info, const VkAllocationCallbacks *allocator, VkInstance *instance) { TRACE("create_info %p, allocator %p, instance %p\n", create_info, allocator, instance); @@ -241,7 +241,7 @@ VkResult WINAPI wine_vkCreateInstance(const VkInstanceCreateInfo *create_info, return unix_funcs->p_vkCreateInstance(create_info, allocator, instance); } -VkResult WINAPI wine_vkEnumerateInstanceExtensionProperties(const char *layer_name, +VkResult WINAPI vkEnumerateInstanceExtensionProperties(const char *layer_name, uint32_t *count, VkExtensionProperties *properties) { TRACE("%p, %p, %p\n", layer_name, count, properties); @@ -261,7 +261,7 @@ VkResult WINAPI wine_vkEnumerateInstanceExtensionProperties(const char *layer_na return unix_funcs->p_vkEnumerateInstanceExtensionProperties(layer_name, count, properties); } -VkResult WINAPI wine_vkEnumerateInstanceVersion(uint32_t *version) +VkResult WINAPI vkEnumerateInstanceVersion(uint32_t *version) { TRACE("%p\n", version); @@ -343,7 +343,7 @@ static void fill_luid_property(VkPhysicalDeviceProperties2 *properties2) id->deviceNodeMask); } -void WINAPI wine_vkGetPhysicalDeviceProperties2(VkPhysicalDevice phys_dev, +void WINAPI vkGetPhysicalDeviceProperties2(VkPhysicalDevice phys_dev, VkPhysicalDeviceProperties2 *properties2) { TRACE("%p, %p\n", phys_dev, properties2); @@ -352,7 +352,7 @@ void WINAPI wine_vkGetPhysicalDeviceProperties2(VkPhysicalDevice phys_dev, fill_luid_property(properties2); } -void WINAPI wine_vkGetPhysicalDeviceProperties2KHR(VkPhysicalDevice phys_dev, +void WINAPI vkGetPhysicalDeviceProperties2KHR(VkPhysicalDevice phys_dev, VkPhysicalDeviceProperties2 *properties2) { TRACE("%p, %p\n", phys_dev, properties2); diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 66b28bf13df..9bebda773e3 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -2500,7 +2500,7 @@ class VkGenerator(object): f.write("#endif /* __WINE_VULKAN_THUNKS_H */\n") - def generate_loader_thunks_c(self, f, prefix): + def generate_loader_thunks_c(self, f): self._generate_copyright(f) f.write("#include \"vulkan_loader.h\"\n\n") @@ -2513,14 +2513,14 @@ class VkGenerator(object): if vk_func.loader_thunk_type != ThunkType.PUBLIC: continue - f.write(vk_func.loader_thunk(prefix=prefix)) + f.write(vk_func.loader_thunk()) f.write("static const struct vulkan_func vk_device_dispatch_table[] =\n{\n") for vk_func in self.registry.device_funcs: if not vk_func.is_required(): continue - f.write(" {{\"{0}\", &{1}{0}}},\n".format(vk_func.name, prefix)) + f.write(" {{\"{0}\", &{0}}},\n".format(vk_func.name)) f.write("};\n\n") f.write("static const struct vulkan_func vk_phys_dev_dispatch_table[] =\n{\n") @@ -2528,7 +2528,7 @@ class VkGenerator(object): if not vk_func.is_required(): continue - f.write(" {{\"{0}\", &{1}{0}}},\n".format(vk_func.name, prefix)) + f.write(" {{\"{0}\", &{0}}},\n".format(vk_func.name)) f.write("};\n\n") f.write("static const struct vulkan_func vk_instance_dispatch_table[] =\n{\n") @@ -2536,7 +2536,7 @@ class VkGenerator(object): if not vk_func.is_required(): continue - f.write(" {{\"{0}\", &{1}{0}}},\n".format(vk_func.name, prefix)) + f.write(" {{\"{0}\", &{0}}},\n".format(vk_func.name)) f.write("};\n\n") f.write("void *wine_vk_get_device_proc_addr(const char *name)\n") @@ -2581,7 +2581,7 @@ class VkGenerator(object): f.write(" return NULL;\n") f.write("}\n") - def generate_loader_thunks_h(self, f, prefix): + def generate_loader_thunks_h(self, f): self._generate_copyright(f) f.write("#ifndef __WINE_VULKAN_LOADER_THUNKS_H\n") @@ -2598,17 +2598,6 @@ class VkGenerator(object): f.write(" {0};\n".format(vk_func.pfn(conv=False, call_conv="WINAPI"))) f.write("};\n\n") - # Generate prototypes for device and instance functions requiring a custom implementation. - f.write("/* Functions for which we have custom implementations outside of the thunks. */\n") - for vk_func in self.registry.funcs.values(): - if not vk_func.is_required(): - continue - if vk_func.loader_thunk_type == ThunkType.PUBLIC: - continue - - f.write("{0};\n".format(vk_func.prototype("WINAPI", prefix=prefix))) - f.write("\n") - f.write("#endif /* __WINE_VULKAN_LOADER_THUNKS_H */\n") def generate_vulkan_h(self, f): @@ -2769,9 +2758,9 @@ class VkGenerator(object): def generate_vulkan_spec(self, f): self._generate_copyright(f, spec_file=True) - f.write("@ stdcall -private vk_icdGetInstanceProcAddr(ptr str) wine_vk_icdGetInstanceProcAddr\n") - f.write("@ stdcall -private vk_icdGetPhysicalDeviceProcAddr(ptr str) wine_vk_icdGetPhysicalDeviceProcAddr\n") - f.write("@ stdcall -private vk_icdNegotiateLoaderICDInterfaceVersion(ptr) wine_vk_icdNegotiateLoaderICDInterfaceVersion\n") + f.write("@ stdcall -private vk_icdGetInstanceProcAddr(ptr str)\n") + f.write("@ stdcall -private vk_icdGetPhysicalDeviceProcAddr(ptr str)\n") + f.write("@ stdcall -private vk_icdNegotiateLoaderICDInterfaceVersion(ptr)\n") # Export symbols for all Vulkan Core functions. for func in self.registry.funcs.values(): @@ -2781,7 +2770,7 @@ class VkGenerator(object): # We support all Core functions except for VK_KHR_display* APIs. # Create stubs for unsupported Core functions. if func.is_required(): - f.write(func.spec(prefix="wine_")) + f.write(func.spec()) else: f.write("@ stub {0}\n".format(func.name)) @@ -2799,7 +2788,7 @@ class VkGenerator(object): # We support all Core functions except for VK_KHR_display* APIs. # Create stubs for unsupported Core functions. if func.is_required(): - f.write(func.spec(symbol="winevulkan.wine_" + func.name)) + f.write(func.spec(symbol="winevulkan." + func.name)) else: f.write("@ stub {0}\n".format(func.name)) @@ -3430,10 +3419,10 @@ def main(): generator.generate_thunks_c(f, "unix_") with open(WINE_VULKAN_LOADER_THUNKS_H, "w") as f: - generator.generate_loader_thunks_h(f, "wine_") + generator.generate_loader_thunks_h(f) with open(WINE_VULKAN_LOADER_THUNKS_C, "w") as f: - generator.generate_loader_thunks_c(f, "wine_") + generator.generate_loader_thunks_c(f) with open(WINE_VULKAN_JSON, "w") as f: generate_vulkan_json(f) diff --git a/dlls/winevulkan/vulkan_loader.h b/dlls/winevulkan/vulkan_loader.h index d248ff6521f..e20583cecab 100644 --- a/dlls/winevulkan/vulkan_loader.h +++ b/dlls/winevulkan/vulkan_loader.h @@ -21,8 +21,6 @@ #define __WINE_VULKAN_LOADER_H #include "wine/debug.h" - -#define VK_NO_PROTOTYPES #include "wine/vulkan.h" #include "wine/vulkan_driver.h" diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h index ebc1b35ba44..83dc90ca15e 100644 --- a/dlls/winevulkan/vulkan_private.h +++ b/dlls/winevulkan/vulkan_private.h @@ -24,6 +24,7 @@ #if defined(__i386__) #define USE_STRUCT_CONVERSION #endif +#define VK_NO_PROTOTYPES #include