Try to load the library and all the required entry points
| 50 | |
| 51 | // Try to load the library and all the required entry points |
| 52 | bool loadLibrary() |
| 53 | { |
| 54 | if (library) |
| 55 | return true; |
| 56 | |
| 57 | library = LoadLibraryA("vulkan-1.dll"); |
| 58 | |
| 59 | if (!library) |
| 60 | return false; |
| 61 | |
| 62 | if (!loadEntryPoint(vkGetInstanceProcAddr, "vkGetInstanceProcAddr")) |
| 63 | { |
| 64 | FreeLibrary(library); |
| 65 | library = nullptr; |
| 66 | return false; |
| 67 | } |
| 68 | |
| 69 | if (!loadEntryPoint(vkEnumerateInstanceLayerProperties, "vkEnumerateInstanceLayerProperties")) |
| 70 | { |
| 71 | FreeLibrary(library); |
| 72 | library = nullptr; |
| 73 | return false; |
| 74 | } |
| 75 | |
| 76 | if (!loadEntryPoint(vkEnumerateInstanceExtensionProperties, "vkEnumerateInstanceExtensionProperties")) |
| 77 | { |
| 78 | FreeLibrary(library); |
| 79 | library = nullptr; |
| 80 | return false; |
| 81 | } |
| 82 | |
| 83 | return true; |
| 84 | } |
| 85 | |
| 86 | template <typename T> |
| 87 | bool loadEntryPoint(T& entryPoint, const char* name) |