diff options
| author | ladevieq <ladevie.quentin@gmail.com> | 2022-07-09 23:45:26 +0200 |
|---|---|---|
| committer | ladevieq <ladevie.quentin@gmail.com> | 2022-07-10 00:04:17 +0200 |
| commit | cfcb5c3212f0fce667885ff0de6fa0b9fc4b3ca8 (patch) | |
| tree | d076b243e0203537d5816c9a15010723581d7f97 /src/vulkan-loader.cpp | |
| parent | 928b1b0503d2ecab09cc275e9775593a41e417cb (diff) | |
Improve compilation time
Diffstat (limited to 'src/vulkan-loader.cpp')
| -rw-r--r-- | src/vulkan-loader.cpp | 54 |
1 files changed, 18 insertions, 36 deletions
diff --git a/src/vulkan-loader.cpp b/src/vulkan-loader.cpp index 42c018e..0977fe8 100644 --- a/src/vulkan-loader.cpp +++ b/src/vulkan-loader.cpp @@ -1,12 +1,10 @@ -#include <iostream> - #include "vulkan-loader.hpp" + +#include <cassert> + #include "defines.hpp" #if defined(WINDOWS) -#include <Windows.h> -#include <windowsx.h> - HMODULE vulkanLibrary = LoadLibrary("vulkan-1.dll"); #define LoadProcAddress GetProcAddress @@ -33,46 +31,30 @@ void *vulkanLibrary = dlopen("libvulkan.1.dylib", RTLD_NOW); VULKAN_DEVICE_FUNCTIONS #undef X -#define X(name) \ -void Load_##name() \ -{ \ - name = reinterpret_cast<PFN_##name>(LoadProcAddress(vulkanLibrary, #name)); \ - if (!name) { \ - std::cerr << "Cannot load vulkan function " << #name << std::endl; \ - } \ +#define X(name) \ +void Load_##name() \ +{ \ + (name) = reinterpret_cast<PFN_##name>(LoadProcAddress(vulkanLibrary, #name)); \ + assert((name) && "Cannot load vulkan function " #name); \ } VULKAN_EXPORTED_FUNCTIONS -#undef X - -#define X(name) \ -void Load_##name() \ -{ \ - name = reinterpret_cast<PFN_##name>(vkGetInstanceProcAddr(nullptr, #name)); \ - if (!name) { \ - std::cerr << "Cannot load vulkan function " << #name << std::endl; \ - } \ -} VULKAN_APPLICATION_FUNCTIONS #undef X -#define X(name) \ -void Load_##name(VkInstance instance) \ -{ \ - name = reinterpret_cast<PFN_##name>(vkGetInstanceProcAddr(instance, #name)); \ - if (!name) { \ - std::cerr << "Cannot load vulkan function " << #name << std::endl; \ - } \ +#define X(name) \ +void Load_##name(VkInstance instance) \ +{ \ + (name) = reinterpret_cast<PFN_##name>(vkGetInstanceProcAddr(instance, #name)); \ + assert((name) && "Cannot load vulkan function " #name); \ } VULKAN_INSTANCE_FUNCTIONS #undef X -#define X(name) \ -void Load_##name(VkDevice device) \ -{ \ - name = reinterpret_cast<PFN_##name>(vkGetDeviceProcAddr(device, #name)); \ - if (!name) { \ - std::cerr << "Cannot load vulkan function " << #name << std::endl; \ - } \ +#define X(name) \ +void Load_##name(VkDevice device) \ +{ \ + (name) = reinterpret_cast<PFN_##name>(vkGetDeviceProcAddr(device, #name)); \ + assert((name) && "Cannot load vulkan function " #name); \ } VULKAN_DEVICE_FUNCTIONS #undef X |
