Zebediah Figura : tests: Load libvulkan dynamically in d3d12_crosstest.h.
Alexandre Julliard
julliard at winehq.org
Wed Apr 20 16:48:25 CDT 2022
Module: vkd3d
Branch: master
Commit: 0929ec7462fc778007b8fb555eca86db48e997ee
URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=0929ec7462fc778007b8fb555eca86db48e997ee
Author: Zebediah Figura <zfigura at codeweavers.com>
Date: Mon Apr 18 20:28:46 2022 -0500
tests: Load libvulkan dynamically in d3d12_crosstest.h.
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 <zfigura at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
Makefile.am | 8 ++++----
tests/d3d12_crosstest.h | 18 ++++++++++++++++++
2 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 44c80373..894f1e63 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -306,10 +306,10 @@ TEST_EXTENSIONS = .shader_test
if BUILD_TESTS
check_PROGRAMS = $(vkd3d_tests) $(vkd3d_cross_tests) tests/shader_runner
TESTS = $(vkd3d_tests) $(vkd3d_cross_tests) $(vkd3d_shader_tests)
-tests_d3d12_LDADD = $(LDADD) @PTHREAD_LIBS@ @VULKAN_LIBS@
-tests_d3d12_invalid_usage_LDADD = $(LDADD) @VULKAN_LIBS@
-tests_hlsl_d3d12_LDADD = $(LDADD) @VULKAN_LIBS@
-tests_shader_runner_LDADD = $(LDADD) @VULKAN_LIBS@ @DL_LIBS@
+tests_d3d12_LDADD = $(LDADD) @PTHREAD_LIBS@ @DL_LIBS@
+tests_d3d12_invalid_usage_LDADD = $(LDADD) @DL_LIBS@
+tests_hlsl_d3d12_LDADD = $(LDADD) @DL_LIBS@
+tests_shader_runner_LDADD = $(LDADD) @DL_LIBS@
tests_shader_runner_SOURCES = \
tests/shader_runner.c \
tests/shader_runner_d3d12.c \
diff --git a/tests/d3d12_crosstest.h b/tests/d3d12_crosstest.h
index fc761809..e6dc7a6c 100644
--- a/tests/d3d12_crosstest.h
+++ b/tests/d3d12_crosstest.h
@@ -39,6 +39,7 @@
typedef int HRESULT;
#endif
+#define VK_NO_PROTOTYPES
#define COBJMACROS
#define CONST_VTABLE
#define INITGUID
@@ -419,6 +420,11 @@ static inline bool is_depth_clip_enable_supported(ID3D12Device *device)
#else
+#define DECLARE_VK_PFN(name) static PFN_##name name;
+DECLARE_VK_PFN(vkGetInstanceProcAddr)
+#define VK_INSTANCE_PFN DECLARE_VK_PFN
+#include "vulkan_procs.h"
+
static bool check_device_extension(VkPhysicalDevice vk_physical_device, const char *name)
{
VkExtensionProperties *properties;
@@ -585,8 +591,20 @@ static void init_adapter_info(void)
VkPhysicalDeviceDriverPropertiesKHR driver_properties;
struct vkd3d_instance *instance;
ID3D12Device *device;
+ void *libvulkan;
HRESULT hr;
+ 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(vkGetInstanceProcAddr)
+#define VK_INSTANCE_PFN LOAD_VK_PFN
+#include "vulkan_procs.h"
+
if (FAILED(hr = create_vkd3d_instance(&instance)))
return;
More information about the wine-cvs
mailing list