From bcad6d6997168cde9e901c806ad78296516fdd18 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 18 Apr 2022 20:28:44 -0500 Subject: [PATCH] tests: Load libvulkan dynamically in vkd3d_api.c. We would like to allow overriding the soname of libvulkan, in which case the tests and demos should respect that override. Signed-off-by: Zebediah Figura Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- Makefile.am | 2 +- tests/vkd3d_api.c | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index ed881ffa..3079a0df 100644 --- a/Makefile.am +++ b/Makefile.am @@ -314,7 +314,7 @@ tests_shader_runner_SOURCES = \ tests/shader_runner.c \ tests/shader_runner_d3d12.c \ tests/shader_runner_vulkan.c -tests_vkd3d_api_LDADD = libvkd3d.la @VULKAN_LIBS@ +tests_vkd3d_api_LDADD = libvkd3d.la @DL_LIBS@ tests_vkd3d_shader_api_LDADD = libvkd3d-shader.la SHADER_TEST_LOG_COMPILER = tests/shader_runner XFAIL_TESTS = \ diff --git a/tests/vkd3d_api.c b/tests/vkd3d_api.c index 8195c067..ab266c4b 100644 --- a/tests/vkd3d_api.c +++ b/tests/vkd3d_api.c @@ -16,6 +16,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#define VK_NO_PROTOTYPES #define COBJMACROS #define INITGUID #define WIDL_C_INLINE_WRAPPERS @@ -24,6 +25,13 @@ #include "d3d12_test_utils.h" +#define DECLARE_VK_PFN(name) static PFN_##name name; +DECLARE_VK_PFN(vkEnumerateInstanceExtensionProperties) +DECLARE_VK_PFN(vkGetInstanceProcAddr) +#define VK_INSTANCE_PFN DECLARE_VK_PFN +#define VK_DEVICE_PFN DECLARE_VK_PFN +#include "vulkan_procs.h" + HRESULT WINAPI D3D12SerializeRootSignature(const D3D12_ROOT_SIGNATURE_DESC *root_signature_desc, D3D_ROOT_SIGNATURE_VERSION version, ID3DBlob **blob, ID3DBlob **error_blob) { @@ -1180,6 +1188,21 @@ static bool have_d3d12_device(void) START_TEST(vkd3d_api) { + void *libvulkan; + + if (!(libvulkan = vkd3d_dlopen(SONAME_LIBVULKAN))) + { + skip("Failed to load %s: %s.\n", SONAME_LIBVULKAN, vkd3d_dlerror()); + return; + } + +#define LOAD_VK_PFN(name) name = vkd3d_dlsym(libvulkan, #name); +LOAD_VK_PFN(vkEnumerateInstanceExtensionProperties) +LOAD_VK_PFN(vkGetInstanceProcAddr) +#define VK_DEVICE_PFN LOAD_VK_PFN +#define VK_INSTANCE_PFN LOAD_VK_PFN +#include "vulkan_procs.h" + if (!have_d3d12_device()) { skip("D3D12 device cannot be created.\n");