[PATCH 04/10] winex11: Add stubs for global Vulkan functions.

Józef Kucia joseph.kucia at gmail.com
Wed Nov 1 05:10:31 CDT 2017


On Tue, Oct 31, 2017 at 6:24 PM, Roderick Colenbrander
<thunderbird2k at gmail.com> wrote:
> Signed-off-by: Roderick Colenbrander <thunderbird2k at gmail.com>
> ---
>  dlls/winex11.drv/Makefile.in      |  1 +
>  dlls/winex11.drv/vulkan.c         | 65 ++++++++++++++++++++++++++++++++++++++-
>  dlls/winex11.drv/vulkan_private.h | 45 +++++++++++++++++++++++++++
>  dlls/winex11.drv/vulkan_thunks.c  | 18 +++++++++++
>  4 files changed, 128 insertions(+), 1 deletion(-)
>  create mode 100644 dlls/winex11.drv/vulkan_private.h
>  create mode 100644 dlls/winex11.drv/vulkan_thunks.c
>
> diff --git a/dlls/winex11.drv/Makefile.in b/dlls/winex11.drv/Makefile.in
> index 747f509b44..fc6c288d66 100644
> --- a/dlls/winex11.drv/Makefile.in
> +++ b/dlls/winex11.drv/Makefile.in
> @@ -21,6 +21,7 @@ C_SRCS = \
>         settings.c \
>         systray.c \
>         vulkan.c \
> +       vulkan_thunks.c \
>         window.c \
>         wintab.c \
>         x11drv_main.c \
> diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c
> index f58bad9c5a..cff474190a 100644
> --- a/dlls/winex11.drv/vulkan.c
> +++ b/dlls/winex11.drv/vulkan.c
> @@ -25,6 +25,8 @@
>
>  #ifdef SONAME_LIBVULKAN
>
> +#include "vulkan_private.h"
> +
>  WINE_DEFAULT_DEBUG_CHANNEL(vulkan);
>
>  /* For now default to 3 as it felt like a reasonable version feature wise to support.
> @@ -34,10 +36,71 @@ WINE_DEFAULT_DEBUG_CHANNEL(vulkan);
>   */
>  #define WINE_VULKAN_ICD_VERSION 3
>
> +void* WINAPI X11DRV_vk_icdGetInstanceProcAddr(VkInstance instance, const char* pName);
> +
> +
> +static void *wine_vk_get_global_proc_addr(const char* name)
> +{
> +    int i;

I think that "unsigned int" is preferred in this case.

> diff --git a/dlls/winex11.drv/vulkan_private.h b/dlls/winex11.drv/vulkan_private.h
> new file mode 100644
> index 0000000000..bb722ddb06
> --- /dev/null
> +++ b/dlls/winex11.drv/vulkan_private.h
> @@ -0,0 +1,45 @@
> +/* X11DRV Vulkan ICD implementation
> + *
> + * Copyright 2017 Roderick Colenbrander
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
> + */
> +
> +#ifndef __WINE_VULKAN_PRIVATE_H /* __WINE_VULKAN_PRIVATE_H */

I guess that /* __WINE_VULKAN_PRIVATE_H */ is unintentional.

> +#define __WINE_VULKAN_PRIVATE_H
> +
> +#ifndef __WINE_CONFIG_H
> +# error You must include config.h to use this header
> +#endif
> +
> +#ifdef SONAME_LIBVULKAN
> +
> +struct vulkan_func
> +{
> +    const char *name;
> +    const char *extension;
> +    void *func;
> +};
> +
> +/* For use by vk_icdGetInstanceProcAddr / vkGetInstanceProcAddr */
> +extern const struct vulkan_func vk_global_dispatch_table[] DECLSPEC_HIDDEN;
> +extern const int vk_global_dispatch_table_size DECLSPEC_HIDDEN;

Could we make the dispatch tables static and local to vulkan_thunks.c?
It would be nicer if only wine_vk_get_global_proc_addr() would be
accessible to other files.

> +
> +VkResult WINAPI X11DRV_vkCreateInstance(const VkInstanceCreateInfo*, const VkAllocationCallbacks*, VkInstance*) DECLSPEC_HIDDEN;
> +VkResult WINAPI X11DRV_vkEnumerateInstanceExtensionProperties(const char*, uint32_t*, VkExtensionProperties*) DECLSPEC_HIDDEN;
> +PFN_vkVoidFunction WINAPI X11DRV_vkGetInstanceProcAddr(VkInstance, const char*) DECLSPEC_HIDDEN;
> +
> +#endif /* SONAME_LIBVULKAN */
> +#endif /* __WINE_VULKAN_PRIVATE_H */
> diff --git a/dlls/winex11.drv/vulkan_thunks.c b/dlls/winex11.drv/vulkan_thunks.c
> new file mode 100644
> index 0000000000..fc3c65762a
> --- /dev/null
> +++ b/dlls/winex11.drv/vulkan_thunks.c
> @@ -0,0 +1,18 @@
> +/* Automatically generated from Vulkan vk.xml; DO NOT EDIT! */

When do you plan to submit the code generator?

> +
> +#include "config.h"
> +#include "wine/port.h"
> +
> +#ifdef SONAME_LIBVULKAN
> +
> +#include "wine/vulkan.h"
> +#include "vulkan_private.h"
> +
> +const struct vulkan_func vk_global_dispatch_table[] = {
> +    {"vkCreateInstance", NULL, &X11DRV_vkCreateInstance},
> +    {"vkEnumerateInstanceExtensionProperties", NULL, &X11DRV_vkEnumerateInstanceExtensionProperties},
> +    {"vkGetInstanceProcAddr", NULL, &X11DRV_vkGetInstanceProcAddr},
> +};
> +const int vk_global_dispatch_table_size = 3;
> +
> +#endif /* SONAME_LIBVULKAN */
> --
> 2.13.6
>
>
>



More information about the wine-devel mailing list