[PATCH v5 1/4] winevulkan: Support use of extensions which mustn't be exposed.

Georg Lehmann dadschoorse at gmail.com
Thu May 20 14:13:23 CDT 2021



On 20.05.21 20:31, Derek Lesho wrote:
> Signed-off-by: Derek Lesho <dlesho at codeweavers.com>
> ---
>   dlls/winevulkan/make_vulkan | 36 +++++++++++++++++++++++++++++++++---
>   1 file changed, 33 insertions(+), 3 deletions(-)
> 
> diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan
> index 7f76d328fc8..62d865149d8 100755
> --- a/dlls/winevulkan/make_vulkan
> +++ b/dlls/winevulkan/make_vulkan
> @@ -120,6 +120,11 @@ UNSUPPORTED_EXTENSIONS = [
>       "VK_NV_external_memory_win32",
>   ]
>   
> +# Either internal extensions which aren't present on the win32 platform which
> +# winevulkan may nonetheless use, or extensions we want to generate headers for
> +# but not expose to applications (useful for test commits)
> +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,8 +526,8 @@ class VkEnumValue(object):
>   
>   
>   class VkFunction(object):
> -    def __init__(self, _type=None, name=None, params=[], extensions=[], alias=None):
> -        self.extensions = []
> +    def __init__(self, _type=None, name=None, params=[], alias=None):
> +        self.extensions = set()
>           self.name = name
>           self.type = _type
>           self.params = params
> @@ -665,6 +670,10 @@ class VkFunction(object):
>       def needs_private_thunk(self):
>           return self.thunk_type == ThunkType.PRIVATE
>   
> +    def needs_exposed(self):

I think needs_exposing sounds less weird.

> +        # 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))
> +
>       def pfn(self, prefix="p", call_conv=None, conv=False):
>           """ Create function pointer. """
>   
> @@ -2656,6 +2665,9 @@ class VkGenerator(object):
>               if not vk_func.is_required():
>                   continue

needs_exposed already does this. Same for the others.

>   
> +            if not vk_func.needs_exposed():
> +                continue
> +
>               if vk_func.is_global_func():
>                   continue
>   
> @@ -2676,6 +2688,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 +2699,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 +2762,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 +2785,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 +2894,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 +2905,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 +2915,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 +2925,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 +2984,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
>   
> @@ -3447,7 +3477,7 @@ class VkRegistry(object):
>                   # the XML file to handle this, but because of the manner in which we parse the XML
>                   # file we pre-populate from <commands> before we check if a command is enabled.
>                   if cmd_name in self.funcs:
> -                    self.funcs[cmd_name].extensions.append(ext_name)
> +                    self.funcs[cmd_name].extensions.add(ext_name)
>   
>               # Some extensions are not ready or have numbers reserved as a place holder.
>               if ext.attrib["supported"] == "disabled":
> 



More information about the wine-devel mailing list