aboutsummaryrefslogtreecommitdiffstats
path: root/src/win_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/win_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/win_vulkan.c')
-rw-r--r--src/win_vulkan.c97
1 files changed, 48 insertions, 49 deletions
diff --git a/src/win_vulkan.c b/src/win_vulkan.c
index f862716..d35d204 100644
--- a/src/win_vulkan.c
+++ b/src/win_vulkan.c
@@ -28,78 +28,77 @@
#include <stdlib.h>
-struct PuglVulkanLoaderImpl
-{
- HMODULE libvulkan;
- PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr;
- PFN_vkGetDeviceProcAddr vkGetDeviceProcAddr;
+struct PuglVulkanLoaderImpl {
+ HMODULE 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 = LoadLibrary("vulkan-1.dll"))) {
- free(loader);
- return NULL;
- }
+ if (!(loader->libvulkan = LoadLibrary("vulkan-1.dll"))) {
+ free(loader);
+ return NULL;
+ }
- loader->vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)GetProcAddress(
- loader->libvulkan, "vkGetInstanceProcAddr");
+ loader->vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)GetProcAddress(
+ loader->libvulkan, "vkGetInstanceProcAddr");
- loader->vkGetDeviceProcAddr = (PFN_vkGetDeviceProcAddr)GetProcAddress(
- loader->libvulkan, "vkGetDeviceProcAddr");
+ loader->vkGetDeviceProcAddr = (PFN_vkGetDeviceProcAddr)GetProcAddress(
+ loader->libvulkan, "vkGetDeviceProcAddr");
- return loader;
+ return loader;
}
void
puglFreeVulkanLoader(PuglVulkanLoader* loader)
{
- if (loader) {
- FreeLibrary(loader->libvulkan);
- free(loader);
- }
+ if (loader) {
+ FreeLibrary(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()
{
- static const PuglBackend backend = {puglWinStubConfigure,
- puglStubCreate,
- puglStubDestroy,
- puglWinStubEnter,
- puglWinStubLeave,
- puglStubGetContext};
-
- return &backend;
+ static const PuglBackend backend = {puglWinStubConfigure,
+ puglStubCreate,
+ puglStubDestroy,
+ puglWinStubEnter,
+ puglWinStubLeave,
+ puglStubGetContext};
+
+ return &backend;
}
const char* const*
puglGetInstanceExtensions(uint32_t* const count)
{
- static const char* const extensions[] = {"VK_KHR_surface",
- "VK_KHR_win32_surface"};
+ static const char* const extensions[] = {"VK_KHR_surface",
+ "VK_KHR_win32_surface"};
- *count = 2;
- return extensions;
+ *count = 2;
+ return extensions;
}
VkResult
@@ -109,19 +108,19 @@ puglCreateSurface(PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr,
const VkAllocationCallbacks* const pAllocator,
VkSurfaceKHR* const pSurface)
{
- PuglInternals* const impl = view->impl;
+ PuglInternals* const impl = view->impl;
- PFN_vkCreateWin32SurfaceKHR vkCreateWin32SurfaceKHR =
- (PFN_vkCreateWin32SurfaceKHR)
- vkGetInstanceProcAddr(instance, "vkCreateWin32SurfaceKHR");
+ PFN_vkCreateWin32SurfaceKHR vkCreateWin32SurfaceKHR =
+ (PFN_vkCreateWin32SurfaceKHR)vkGetInstanceProcAddr(
+ instance, "vkCreateWin32SurfaceKHR");
- const VkWin32SurfaceCreateInfoKHR createInfo = {
- VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR,
- NULL,
- 0,
- GetModuleHandle(NULL),
- impl->hwnd,
- };
+ const VkWin32SurfaceCreateInfoKHR createInfo = {
+ VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR,
+ NULL,
+ 0,
+ GetModuleHandle(NULL),
+ impl->hwnd,
+ };
- return vkCreateWin32SurfaceKHR(instance, &createInfo, pAllocator, pSurface);
+ return vkCreateWin32SurfaceKHR(instance, &createInfo, pAllocator, pSurface);
}