From: Józef Kucia jkucia@codeweavers.com
For Windows builds.
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- configure.ac | 5 ++-- libs/vkd3d/device.c | 63 ++++++++++++++++++++++++++++++++++++++------- 2 files changed, 56 insertions(+), 12 deletions(-)
diff --git a/configure.ac b/configure.ac index 37e1edd6e941..bfaa8f2d429a 100644 --- a/configure.ac +++ b/configure.ac @@ -54,7 +54,8 @@ VKD3D_CHECK_MINGW32_PROG([CROSSCC32], [CROSSTARGET32], [no]) VKD3D_CHECK_MINGW64_PROG([CROSSCC64], [CROSSTARGET64], [no])
dnl Check for headers -AC_CHECK_HEADERS([pthread.h vulkan/vulkan.h \ +AC_CHECK_HEADERS([dlfcn.h pthread.h \ + vulkan/vulkan.h \ vulkan/spirv.h vulkan/GLSL.std.450.h \ spirv/unified1/spirv.h spirv/unified1/GLSL.std.450.h]) AS_IF([test "x$ac_cv_header_pthread_h" != "xyes"], [AC_MSG_ERROR([pthread.h not found.])]) @@ -76,7 +77,7 @@ AC_CHECK_LIB([m], [ceilf]) AC_ARG_VAR([DL_LIBS], [linker flags for dl]) AC_CHECK_LIB([dl], [dlopen], [AC_SUBST([DL_LIBS], ["-ldl"])], - [AC_MSG_ERROR([libdl not found.])]) + [AS_IF([test "$ac_cv_header_dlfnc_h" = "xyes"], [AC_MSG_ERROR([libdl not found.])])])
AC_ARG_VAR([PTHREAD_LIBS], [linker flags for pthreads]) AC_CHECK_LIB([pthread], [pthread_create], diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index f809a00b03ff..8b35f40aea99 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -18,8 +18,51 @@
#include "vkd3d_private.h"
+#ifdef HAVE_DLFCN_H #include <dlfcn.h>
+static void *vkd3d_dlopen(const char *name) +{ + return dlopen(name, RTLD_NOW); +} + +static void *vkd3d_dlsym(void *handle, const char *symbol) +{ + return dlsym(handle, symbol); +} + +static int vkd3d_dlclose(void *handle) +{ + return dlclose(handle); +} + +static const char *vkd3d_dlerror(void) +{ + return dlerror(); +} +#else +static void *vkd3d_dlopen(const char *name) +{ + FIXME("Not implemented for this platform.\n"); + return NULL; +} + +static void *vkd3d_dlsym(void *handle, const char *symbol) +{ + return NULL; +} + +static int vkd3d_dlclose(void *handle) +{ + return 0; +} + +static const char *vkd3d_dlerror(void) +{ + return "Not implemented for this platform.\n"; +} +#endif + struct vkd3d_struct { enum vkd3d_structure_type type; @@ -321,16 +364,16 @@ static HRESULT vkd3d_init_vk_global_procs(struct vkd3d_instance *instance,
if (!vkGetInstanceProcAddr) { - if (!(instance->libvulkan = dlopen(SONAME_LIBVULKAN, RTLD_NOW))) + if (!(instance->libvulkan = vkd3d_dlopen(SONAME_LIBVULKAN))) { - ERR("Failed to load libvulkan: %s.\n", dlerror()); + ERR("Failed to load libvulkan: %s.\n", vkd3d_dlerror()); return E_FAIL; }
- if (!(vkGetInstanceProcAddr = dlsym(instance->libvulkan, "vkGetInstanceProcAddr"))) + if (!(vkGetInstanceProcAddr = vkd3d_dlsym(instance->libvulkan, "vkGetInstanceProcAddr"))) { ERR("Could not load function pointer for vkGetInstanceProcAddr().\n"); - dlclose(instance->libvulkan); + vkd3d_dlclose(instance->libvulkan); instance->libvulkan = NULL; return E_FAIL; } @@ -343,7 +386,7 @@ static HRESULT vkd3d_init_vk_global_procs(struct vkd3d_instance *instance, if (FAILED(hr = vkd3d_load_vk_global_procs(&instance->vk_global_procs, vkGetInstanceProcAddr))) { if (instance->libvulkan) - dlclose(instance->libvulkan); + vkd3d_dlclose(instance->libvulkan); instance->libvulkan = NULL; return hr; } @@ -428,7 +471,7 @@ static HRESULT vkd3d_instance_init(struct vkd3d_instance *instance, &extension_count, &user_extension_supported))) { if (instance->libvulkan) - dlclose(instance->libvulkan); + vkd3d_dlclose(instance->libvulkan); return hr; }
@@ -443,7 +486,7 @@ static HRESULT vkd3d_instance_init(struct vkd3d_instance *instance, if (!(extensions = vkd3d_calloc(extension_count, sizeof(*extensions)))) { if (instance->libvulkan) - dlclose(instance->libvulkan); + vkd3d_dlclose(instance->libvulkan); vkd3d_free(user_extension_supported); return E_OUTOFMEMORY; } @@ -471,7 +514,7 @@ static HRESULT vkd3d_instance_init(struct vkd3d_instance *instance, { ERR("Failed to create Vulkan instance, vr %d.\n", vr); if (instance->libvulkan) - dlclose(instance->libvulkan); + vkd3d_dlclose(instance->libvulkan); return hresult_from_vk_result(vr); }
@@ -481,7 +524,7 @@ static HRESULT vkd3d_instance_init(struct vkd3d_instance *instance, if (instance->vk_procs.vkDestroyInstance) instance->vk_procs.vkDestroyInstance(vk_instance, NULL); if (instance->libvulkan) - dlclose(instance->libvulkan); + vkd3d_dlclose(instance->libvulkan); return hr; }
@@ -541,7 +584,7 @@ static void vkd3d_destroy_instance(struct vkd3d_instance *instance) VK_CALL(vkDestroyInstance(vk_instance, NULL));
if (instance->libvulkan) - dlclose(instance->libvulkan); + vkd3d_dlclose(instance->libvulkan);
vkd3d_free(instance); }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=49581
Your paranoid android.
=== debian9 (build log) ===
error: patch failed: configure.ac:54 Task: Patch failed to apply
=== debian9b (build log) ===
error: patch failed: configure.ac:54 Task: Patch failed to apply