Commit 95324f8b authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Vitaly Lipatov

winex11: Specify a default vulkan driver if one not found at build time

We cannot specify it as a dependency since Debian Jessie has the vulkan library in backports and not everybody will have this mapped.
parent cc471938
......@@ -43,10 +43,12 @@
#include "wine/vulkan_driver.h"
WINE_DEFAULT_DEBUG_CHANNEL(vulkan);
#ifdef SONAME_LIBVULKAN
WINE_DECLARE_DEBUG_CHANNEL(fps);
#ifndef SONAME_LIBVULKAN
#define SONAME_LIBVULKAN ""
#endif
static pthread_mutex_t vulkan_mutex;
static XContext vulkan_hwnd_context;
......@@ -107,14 +109,23 @@ static void *vulkan_handle;
static void wine_vk_init(void)
{
init_recursive_mutex(&vulkan_mutex);
const char *libvulkan_candidates[] = {SONAME_LIBVULKAN,
"libvulkan.so.1",
"libvulkan.so",
NULL};
int i;
for (i=0; libvulkan_candidates[i] && !vulkan_handle; i++)
vulkan_handle = dlopen(libvulkan_candidates[i], RTLD_NOW);
if (!(vulkan_handle = dlopen(SONAME_LIBVULKAN, RTLD_NOW)))
if (!vulkan_handle)
{
ERR("Failed to load %s.\n", SONAME_LIBVULKAN);
ERR("Failed to load vulkan library\n");
return;
}
init_recursive_mutex(&vulkan_mutex);
#define LOAD_FUNCPTR(f) if (!(p##f = dlsym(vulkan_handle, #f))) goto fail
#define LOAD_OPTIONAL_FUNCPTR(f) p##f = dlsym(vulkan_handle, #f)
LOAD_FUNCPTR(vkCreateInstance);
......@@ -734,20 +745,3 @@ const struct vulkan_funcs *get_vulkan_driver(UINT version)
return NULL;
}
#else /* No vulkan */
const struct vulkan_funcs *get_vulkan_driver(UINT version)
{
ERR("Wine was built without Vulkan support.\n");
return NULL;
}
void wine_vk_surface_destroy(HWND hwnd)
{
}
void vulkan_thread_detach(void)
{
}
#endif /* SONAME_LIBVULKAN */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment