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 <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:44 -05:00 committed by Alexandre Julliard
parent d087b9ea5b
commit bcad6d6997
2 changed files with 24 additions and 1 deletions

View File

@ -314,7 +314,7 @@ tests_shader_runner_SOURCES = \
tests/shader_runner.c \ tests/shader_runner.c \
tests/shader_runner_d3d12.c \ tests/shader_runner_d3d12.c \
tests/shader_runner_vulkan.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 tests_vkd3d_shader_api_LDADD = libvkd3d-shader.la
SHADER_TEST_LOG_COMPILER = tests/shader_runner SHADER_TEST_LOG_COMPILER = tests/shader_runner
XFAIL_TESTS = \ XFAIL_TESTS = \

View File

@ -16,6 +16,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#define VK_NO_PROTOTYPES
#define COBJMACROS #define COBJMACROS
#define INITGUID #define INITGUID
#define WIDL_C_INLINE_WRAPPERS #define WIDL_C_INLINE_WRAPPERS
@ -24,6 +25,13 @@
#include "d3d12_test_utils.h" #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, HRESULT WINAPI D3D12SerializeRootSignature(const D3D12_ROOT_SIGNATURE_DESC *root_signature_desc,
D3D_ROOT_SIGNATURE_VERSION version, ID3DBlob **blob, ID3DBlob **error_blob) D3D_ROOT_SIGNATURE_VERSION version, ID3DBlob **blob, ID3DBlob **error_blob)
{ {
@ -1180,6 +1188,21 @@ static bool have_d3d12_device(void)
START_TEST(vkd3d_api) 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()) if (!have_d3d12_device())
{ {
skip("D3D12 device cannot be created.\n"); skip("D3D12 device cannot be created.\n");