vulkan/wsi: Add a dispatch table for WSI entrypoints

Acked-by: Chia-I Wu <olvaffe@gmail.com>
Acked-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13234>
This commit is contained in:
Jason Ekstrand 2021-10-06 09:37:32 -05:00 committed by Marge Bot
parent 916c9335b4
commit 020fbb9ea1
2 changed files with 38 additions and 6 deletions

View file

@ -44,11 +44,24 @@ if system_has_kms_drm and not with_platform_android
files_vulkan_wsi += files('wsi_common_display.c')
endif
wsi_entrypoints = custom_target(
'wsi_entrypoints',
input : [vk_entrypoints_gen, vk_api_xml],
output : ['wsi_common_entrypoints.h', 'wsi_common_entrypoints.c'],
command : [
prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
'--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'wsi',
],
depend_files : vk_entrypoints_gen_depend_files,
)
libvulkan_wsi = static_library(
'vulkan_wsi',
files_vulkan_wsi,
[files_vulkan_wsi, wsi_entrypoints],
include_directories : [inc_include, inc_src],
dependencies : [vulkan_wsi_deps, dep_libdrm, idep_vulkan_util, idep_xmlconfig],
dependencies : [
vulkan_wsi_deps, dep_libdrm, idep_vulkan_util_headers, idep_xmlconfig,
],
c_args : [vulkan_wsi_args],
gnu_symbol_visibility : 'hidden',
build_by_default : false,
@ -58,7 +71,19 @@ idep_vulkan_wsi_headers = declare_dependency(
include_directories : include_directories('.')
)
idep_vulkan_wsi = declare_dependency(
link_with : libvulkan_wsi,
dependencies : idep_vulkan_wsi_headers
)
# This is likely a bug in the Meson VS backend, as MSVC with ninja works fine.
# See this discussion here:
# https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10506
if get_option('backend').startswith('vs')
idep_vulkan_wsi = declare_dependency(
link_with : libvulkan_wsi,
dependencies : idep_vulkan_wsi_headers
)
else
idep_vulkan_wsi = declare_dependency(
# Instruct users of this library to link with --whole-archive. Otherwise,
# our weak function overloads may not resolve properly.
link_whole : libvulkan_wsi,
dependencies : idep_vulkan_wsi_headers
)
endif

View file

@ -27,9 +27,16 @@
#include <stdbool.h>
#include "vk_alloc.h"
#include "vk_dispatch_table.h"
#include <vulkan/vulkan.h>
#include <vulkan/vk_icd.h>
#ifndef WSI_ENTRYPOINTS_H
extern const struct vk_instance_entrypoint_table wsi_instance_entrypoints;
extern const struct vk_physical_device_entrypoint_table wsi_physical_device_entrypoints;
extern const struct vk_device_entrypoint_table wsi_device_entrypoints;
#endif
/* This is guaranteed to not collide with anything because it's in the
* VK_KHR_swapchain namespace but not actually used by the extension.
*/