aboutsummaryrefslogtreecommitdiffstats
path: root/src/x11_vulkan.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/x11_vulkan.c')
-rw-r--r--src/x11_vulkan.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/x11_vulkan.c b/src/x11_vulkan.c
index 72ff701..5b6745e 100644
--- a/src/x11_vulkan.c
+++ b/src/x11_vulkan.c
@@ -28,19 +28,23 @@ struct PuglVulkanLoaderImpl {
PuglVulkanLoader*
puglNewVulkanLoader(PuglWorld* PUGL_UNUSED(world))
{
+ void* const libvulkan = dlopen("libvulkan.so", RTLD_LAZY);
+ if (!libvulkan) {
+ return NULL;
+ }
+
PuglVulkanLoader* const loader =
(PuglVulkanLoader*)calloc(1, sizeof(PuglVulkanLoader));
- if (!loader || !(loader->libvulkan = dlopen("libvulkan.so", RTLD_LAZY))) {
- free(loader);
- return NULL;
- }
+ if (loader) {
+ loader->libvulkan = libvulkan;
- loader->vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)dlsym(
- loader->libvulkan, "vkGetInstanceProcAddr");
+ loader->vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)dlsym(
+ loader->libvulkan, "vkGetInstanceProcAddr");
- loader->vkGetDeviceProcAddr =
- (PFN_vkGetDeviceProcAddr)dlsym(loader->libvulkan, "vkGetDeviceProcAddr");
+ loader->vkGetDeviceProcAddr =
+ (PFN_vkGetDeviceProcAddr)dlsym(loader->libvulkan, "vkGetDeviceProcAddr");
+ }
return loader;
}