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@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2022-04-18 20:28:46 -05:00 committed by Alexandre Julliard
parent beffe5f367
commit 0929ec7462
2 changed files with 22 additions and 4 deletions

View File

@ -306,10 +306,10 @@ TEST_EXTENSIONS = .shader_test
if BUILD_TESTS if BUILD_TESTS
check_PROGRAMS = $(vkd3d_tests) $(vkd3d_cross_tests) tests/shader_runner check_PROGRAMS = $(vkd3d_tests) $(vkd3d_cross_tests) tests/shader_runner
TESTS = $(vkd3d_tests) $(vkd3d_cross_tests) $(vkd3d_shader_tests) TESTS = $(vkd3d_tests) $(vkd3d_cross_tests) $(vkd3d_shader_tests)
tests_d3d12_LDADD = $(LDADD) @PTHREAD_LIBS@ @VULKAN_LIBS@ tests_d3d12_LDADD = $(LDADD) @PTHREAD_LIBS@ @DL_LIBS@
tests_d3d12_invalid_usage_LDADD = $(LDADD) @VULKAN_LIBS@ tests_d3d12_invalid_usage_LDADD = $(LDADD) @DL_LIBS@
tests_hlsl_d3d12_LDADD = $(LDADD) @VULKAN_LIBS@ tests_hlsl_d3d12_LDADD = $(LDADD) @DL_LIBS@
tests_shader_runner_LDADD = $(LDADD) @VULKAN_LIBS@ @DL_LIBS@ tests_shader_runner_LDADD = $(LDADD) @DL_LIBS@
tests_shader_runner_SOURCES = \ tests_shader_runner_SOURCES = \
tests/shader_runner.c \ tests/shader_runner.c \
tests/shader_runner_d3d12.c \ tests/shader_runner_d3d12.c \

View File

@ -39,6 +39,7 @@
typedef int HRESULT; typedef int HRESULT;
#endif #endif
#define VK_NO_PROTOTYPES
#define COBJMACROS #define COBJMACROS
#define CONST_VTABLE #define CONST_VTABLE
#define INITGUID #define INITGUID
@ -419,6 +420,11 @@ static inline bool is_depth_clip_enable_supported(ID3D12Device *device)
#else #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) static bool check_device_extension(VkPhysicalDevice vk_physical_device, const char *name)
{ {
VkExtensionProperties *properties; VkExtensionProperties *properties;
@ -585,8 +591,20 @@ static void init_adapter_info(void)
VkPhysicalDeviceDriverPropertiesKHR driver_properties; VkPhysicalDeviceDriverPropertiesKHR driver_properties;
struct vkd3d_instance *instance; struct vkd3d_instance *instance;
ID3D12Device *device; ID3D12Device *device;
void *libvulkan;
HRESULT hr; 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))) if (FAILED(hr = create_vkd3d_instance(&instance)))
return; return;