aboutsummaryrefslogtreecommitdiffstats
path: root/src/x11_vulkan.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-01-02 21:09:27 +0100
committerDavid Robillard <d@drobilla.net>2021-01-02 21:09:27 +0100
commit1c365945ed2ebd5b9f54eb0c8c5c1c6d97cad712 (patch)
tree4b77266a9ce3e2a11b59bbd2754869c6ee1d172b /src/x11_vulkan.c
parenta92a194b4fc64e0cfa4a88a59e261f236414d61c (diff)
downloadpugl-1c365945ed2ebd5b9f54eb0c8c5c1c6d97cad712.tar.gz
pugl-1c365945ed2ebd5b9f54eb0c8c5c1c6d97cad712.tar.bz2
pugl-1c365945ed2ebd5b9f54eb0c8c5c1c6d97cad712.zip
Simplify clang-format configuration and format all code
Diffstat (limited to 'src/x11_vulkan.c')
-rw-r--r--src/x11_vulkan.c105
1 files changed, 52 insertions, 53 deletions
diff --git a/src/x11_vulkan.c b/src/x11_vulkan.c
index b32111c..77bdd59 100644
--- a/src/x11_vulkan.c
+++ b/src/x11_vulkan.c
@@ -31,78 +31,77 @@
#include <stdint.h>
#include <stdlib.h>
-struct PuglVulkanLoaderImpl
-{
- void* libvulkan;
- PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr;
- PFN_vkGetDeviceProcAddr vkGetDeviceProcAddr;
+struct PuglVulkanLoaderImpl {
+ void* libvulkan;
+ PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr;
+ PFN_vkGetDeviceProcAddr vkGetDeviceProcAddr;
};
PuglVulkanLoader*
puglNewVulkanLoader(PuglWorld* PUGL_UNUSED(world))
{
- PuglVulkanLoader* loader =
- (PuglVulkanLoader*)calloc(1, sizeof(PuglVulkanLoader));
- if (!loader) {
- return NULL;
- }
+ PuglVulkanLoader* loader =
+ (PuglVulkanLoader*)calloc(1, sizeof(PuglVulkanLoader));
+ if (!loader) {
+ return NULL;
+ }
- if (!(loader->libvulkan = dlopen("libvulkan.so", RTLD_LAZY))) {
- free(loader);
- return NULL;
- }
+ if (!(loader->libvulkan = dlopen("libvulkan.so", RTLD_LAZY))) {
+ free(loader);
+ return NULL;
+ }
- 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;
+ return loader;
}
void
puglFreeVulkanLoader(PuglVulkanLoader* loader)
{
- if (loader) {
- dlclose(loader->libvulkan);
- free(loader);
- }
+ if (loader) {
+ dlclose(loader->libvulkan);
+ free(loader);
+ }
}
PFN_vkGetInstanceProcAddr
puglGetInstanceProcAddrFunc(const PuglVulkanLoader* loader)
{
- return loader->vkGetInstanceProcAddr;
+ return loader->vkGetInstanceProcAddr;
}
PFN_vkGetDeviceProcAddr
puglGetDeviceProcAddrFunc(const PuglVulkanLoader* loader)
{
- return loader->vkGetDeviceProcAddr;
+ return loader->vkGetDeviceProcAddr;
}
const PuglBackend*
puglVulkanBackend(void)
{
- static const PuglBackend backend = {puglX11StubConfigure,
- puglStubCreate,
- puglStubDestroy,
- puglStubEnter,
- puglStubLeave,
- puglStubGetContext};
-
- return &backend;
+ static const PuglBackend backend = {puglX11StubConfigure,
+ puglStubCreate,
+ puglStubDestroy,
+ puglStubEnter,
+ puglStubLeave,
+ puglStubGetContext};
+
+ return &backend;
}
const char* const*
puglGetInstanceExtensions(uint32_t* const count)
{
- static const char* const extensions[] = {"VK_KHR_surface",
- "VK_KHR_xlib_surface"};
+ static const char* const extensions[] = {"VK_KHR_surface",
+ "VK_KHR_xlib_surface"};
- *count = 2;
- return extensions;
+ *count = 2;
+ return extensions;
}
VkResult
@@ -112,20 +111,20 @@ puglCreateSurface(PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr,
const VkAllocationCallbacks* const allocator,
VkSurfaceKHR* const surface)
{
- PuglInternals* const impl = view->impl;
- PuglWorldInternals* world_impl = view->world->impl;
-
- PFN_vkCreateXlibSurfaceKHR vkCreateXlibSurfaceKHR =
- (PFN_vkCreateXlibSurfaceKHR)
- vkGetInstanceProcAddr(instance, "vkCreateXlibSurfaceKHR");
-
- const VkXlibSurfaceCreateInfoKHR info = {
- VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR,
- NULL,
- 0,
- world_impl->display,
- impl->win,
- };
-
- return vkCreateXlibSurfaceKHR(instance, &info, allocator, surface);
+ PuglInternals* const impl = view->impl;
+ PuglWorldInternals* world_impl = view->world->impl;
+
+ PFN_vkCreateXlibSurfaceKHR vkCreateXlibSurfaceKHR =
+ (PFN_vkCreateXlibSurfaceKHR)vkGetInstanceProcAddr(instance,
+ "vkCreateXlibSurfaceKHR");
+
+ const VkXlibSurfaceCreateInfoKHR info = {
+ VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR,
+ NULL,
+ 0,
+ world_impl->display,
+ impl->win,
+ };
+
+ return vkCreateXlibSurfaceKHR(instance, &info, allocator, surface);
}