[PATCH 2/3] winevulkan: Support use of extensions which musn't be exposed.

Georg Lehmann dadschoorse at gmail.com
Tue May 18 10:06:52 CDT 2021



On 17.05.21 22:00, Derek Lesho wrote:
> Signed-off-by: Derek Lesho <dlesho at codeweavers.com>
> ---
> This patch is dead code, being used later for VK_KHR_external_memory_fd.  I was informed that commits like this are normal for winevulkan, since exposing an extension w/ stubs can break applications.
> ---
>   dlls/winevulkan/make_vulkan | 29 ++++++++++++++++++++++++++++-
>   1 file changed, 28 insertions(+), 1 deletion(-)
> 
> diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan
> index 7f76d328fc8..7e1d7c0f043 100755
> --- a/dlls/winevulkan/make_vulkan
> +++ b/dlls/winevulkan/make_vulkan
> @@ -120,6 +120,9 @@ UNSUPPORTED_EXTENSIONS = [
>       "VK_NV_external_memory_win32",
>   ]
>   
> +# Extensions which aren't present on the win32 platform, but which winevulkan may use.
> +UNEXPOSED_EXTENSIONS = []
> +
>   # The Vulkan loader provides entry-points for core functionality and important
>   # extensions. Based on vulkan-1.def this amounts to WSI extensions on 1.0.51.
>   CORE_EXTENSIONS = [
> @@ -521,7 +524,7 @@ class VkEnumValue(object):
>   
>   
>   class VkFunction(object):
> -    def __init__(self, _type=None, name=None, params=[], extensions=[], alias=None):
> +    def __init__(self, _type=None, name=None, params=[], alias=None):
>           self.extensions = []
>           self.name = name
>           self.type = _type
> @@ -665,6 +668,9 @@ class VkFunction(object):
>       def needs_private_thunk(self):
>           return self.thunk_type == ThunkType.PRIVATE
>   
> +    def needs_exposed(self):
> +        return not any(x for x in self.extensions if x in UNEXPOSED_EXTENSIONS)
> +

Shouldn't this be all instead of any? If we support any extension the 
function should be exposed, even if it's also provided by another 
extension that we don't expose.

>       def pfn(self, prefix="p", call_conv=None, conv=False):
>           """ Create function pointer. """
>   
> @@ -2656,6 +2662,9 @@ class VkGenerator(object):
>               if not vk_func.is_required():
>                   continue
>   
> +            if not vk_func.needs_exposed():
> +                continue
> +
>               if vk_func.is_global_func():
>                   continue
>   
> @@ -2676,6 +2685,8 @@ class VkGenerator(object):
>           for ext in self.registry.extensions:
>               if ext["type"] != "device":
>                   continue
> +            if ext["name"] in UNEXPOSED_EXTENSIONS:
> +                continue
>   
>               f.write("    \"{0}\",\n".format(ext["name"]))
>           f.write("};\n\n")
> @@ -2685,6 +2696,8 @@ class VkGenerator(object):
>           for ext in self.registry.extensions:
>               if ext["type"] != "instance":
>                   continue
> +            if ext["name"] in UNEXPOSED_EXTENSIONS:
> +                continue
>   
>               f.write("    \"{0}\",\n".format(ext["name"]))
>           f.write("};\n\n")
> @@ -2746,6 +2759,8 @@ class VkGenerator(object):
>           for vk_func in self.registry.funcs.values():
>               if not vk_func.is_required():
>                   continue
> +            if not vk_func.needs_exposed():
> +                continue
>               if vk_func.loader_thunk_type == ThunkType.NONE:
>                   continue
>   
> @@ -2767,6 +2782,8 @@ class VkGenerator(object):
>                   continue
>               if vk_func.needs_thunk() and not vk_func.needs_private_thunk():
>                   continue
> +            if not vk_func.needs_exposed():
> +                continue
>   
>               if vk_func.is_core_func():
>                   f.write("{0};\n".format(vk_func.prototype("WINAPI", prefix=prefix)))
> @@ -2874,6 +2891,8 @@ class VkGenerator(object):
>           for vk_func in self.registry.funcs.values():
>               if not vk_func.is_required():
>                   continue
> +            if not vk_func.needs_exposed():
> +                continue
>               if vk_func.loader_thunk_type != ThunkType.PUBLIC:
>                   continue
>   
> @@ -2883,6 +2902,8 @@ class VkGenerator(object):
>           for vk_func in self.registry.device_funcs:
>               if not vk_func.is_required():
>                   continue
> +            if not vk_func.needs_exposed():
> +                continue
>   
>               f.write("    {{\"{0}\", &{0}}},\n".format(vk_func.name))
>           f.write("};\n\n")
> @@ -2891,6 +2912,8 @@ class VkGenerator(object):
>           for vk_func in self.registry.phys_dev_funcs:
>               if not vk_func.is_required():
>                   continue
> +            if not vk_func.needs_exposed():
> +                continue
>   
>               f.write("    {{\"{0}\", &{0}}},\n".format(vk_func.name))
>           f.write("};\n\n")
> @@ -2899,6 +2922,8 @@ class VkGenerator(object):
>           for vk_func in self.registry.instance_funcs:
>               if not vk_func.is_required():
>                   continue
> +            if not vk_func.needs_exposed():
> +                continue
>   
>               f.write("    {{\"{0}\", &{0}}},\n".format(vk_func.name))
>           f.write("};\n\n")
> @@ -2956,6 +2981,8 @@ class VkGenerator(object):
>           for vk_func in self.registry.funcs.values():
>               if not vk_func.is_required():
>                   continue
> +            if not vk_func.needs_exposed():
> +                continue
>               if vk_func.loader_thunk_type == ThunkType.NONE:
>                   continue
>   
> 



More information about the wine-devel mailing list