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 --- Makefile.am | 2 +- tests/shader_runner_vulkan.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am index fea63eb51..f7566d4b9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -309,7 +309,7 @@ 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@ +tests_shader_runner_LDADD = $(LDADD) @VULKAN_LIBS@ @DL_LIBS@ tests_shader_runner_SOURCES = \ tests/shader_runner.c \ tests/shader_runner_d3d12.c \ diff --git a/tests/shader_runner_vulkan.c b/tests/shader_runner_vulkan.c index 4a30ea85d..5d4b65cff 100644 --- a/tests/shader_runner_vulkan.c +++ b/tests/shader_runner_vulkan.c @@ -18,6 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
+#define VK_NO_PROTOTYPES #include "config.h" #include "vulkan/vulkan.h" #include "vkd3d_shader.h" @@ -45,6 +46,8 @@ static struct vulkan_resource *vulkan_resource(struct resource *r)
#define DECLARE_VK_PFN(name) PFN_##name name;
+DECLARE_VK_PFN(vkGetInstanceProcAddr) + struct vulkan_shader_runner { struct shader_runner r; @@ -984,8 +987,16 @@ static bool init_vulkan_runner(struct vulkan_shader_runner *runner) VkFormatProperties format_props; uint32_t count, graphics_index; VkDevice device; + void *libvulkan; VkResult vr;
+ if (!(libvulkan = vkd3d_dlopen(SONAME_LIBVULKAN))) + { + skip("Failed to load %s: %s.\n", SONAME_LIBVULKAN, vkd3d_dlerror()); + return false; + } + vkGetInstanceProcAddr = vkd3d_dlsym(libvulkan, "vkGetInstanceProcAddr"); + runner->vkCreateInstance = (void *)vkGetInstanceProcAddr(NULL, "vkCreateInstance");
if ((vr = VK_CALL(vkCreateInstance(&instance_desc, NULL, &runner->instance))) < 0)