Dylan Aïssi pushed to branch upstream at X Strike Force / vulkan / vulkan-volk
Commits:
-
88931c9d
by Dylan Aïssi at 2024-05-31T15:14:05+02:00
4 changed files:
Changes:
... | ... | @@ -4,7 +4,7 @@ cmake_policy(SET CMP0048 NEW) # project(... VERSION ...) support |
4 | 4 | |
5 | 5 | project(volk VERSION
|
6 | 6 | # VOLK_GENERATE_VERSION
|
7 | -280
|
|
7 | +283
|
|
8 | 8 | # VOLK_GENERATE_VERSION
|
9 | 9 | LANGUAGES C
|
10 | 10 | )
|
... | ... | @@ -12,7 +12,7 @@ project(volk VERSION |
12 | 12 | # CMake 3.12 changes the default behaviour of option() to leave local variables
|
13 | 13 | # unchanged if they exist (which we want), but we must work with older CMake versions.
|
14 | 14 | if(NOT DEFINED VOLK_STATIC_DEFINES)
|
15 | - option(VOLK_STATIC_DEFINES "Additional defines for building the volk static library, e.g. Vulkan platform defines" "")
|
|
15 | + set(VOLK_STATIC_DEFINES "" CACHE STRING "Additional defines for building the volk static library, e.g. Vulkan platform defines")
|
|
16 | 16 | endif()
|
17 | 17 | if(NOT DEFINED VOLK_PULL_IN_VULKAN)
|
18 | 18 | option(VOLK_PULL_IN_VULKAN "Vulkan as a transitive dependency" ON)
|
... | ... | @@ -24,7 +24,7 @@ if(NOT DEFINED VOLK_HEADERS_ONLY) |
24 | 24 | option(VOLK_HEADERS_ONLY "Add interface library only" OFF)
|
25 | 25 | endif()
|
26 | 26 | if(NOT DEFINED VULKAN_HEADERS_INSTALL_DIR)
|
27 | - option(VULKAN_HEADERS_INSTALL_DIR "Where to get the Vulkan headers" "")
|
|
27 | + set(VULKAN_HEADERS_INSTALL_DIR "" CACHE PATH "Where to get the Vulkan headers")
|
|
28 | 28 | endif()
|
29 | 29 | |
30 | 30 | # -----------------------------------------------------
|
... | ... | @@ -12,7 +12,7 @@ volk is written in C89 and supports Windows, Linux, Android and macOS (via Molte |
12 | 12 | |
13 | 13 | There are multiple ways to use volk in your project:
|
14 | 14 | |
15 | -1. You can just add `volk.c` to your build system. Note that the usual preprocessor defines that enable Vulkan's platform-specific functions (VK_USE_PLATFORM_WIN32_KHR, VK_USE_PLATFORM_XLIB_KHR, VK_USE_PLATFORM_MACOS_MVK, etc) must be passed as desired to the compiler when building `volk.c`.
|
|
15 | +1. You can add `volk.c` to your build system. Note that the usual preprocessor defines that enable Vulkan's platform-specific functions (VK_USE_PLATFORM_WIN32_KHR, VK_USE_PLATFORM_XLIB_KHR, VK_USE_PLATFORM_MACOS_MVK, etc) must be passed as desired to the compiler when building `volk.c`.
|
|
16 | 16 | 2. You can use provided CMake files, with the usage detailed below.
|
17 | 17 | 3. You can use volk in header-only fashion. Include `volk.h` wherever you want to use Vulkan functions. In exactly one source file, define `VOLK_IMPLEMENTATION` before including `volk.h`. Do not build `volk.c` at all in this case - however, `volk.c` must still be in the same directory as `volk.h`. This method of integrating volk makes it possible to set the platform defines mentioned above with arbitrary (preprocessor) logic in your code.
|
18 | 18 |
... | ... | @@ -31,6 +31,17 @@ __declspec(dllimport) FARPROC __stdcall GetProcAddress(HMODULE, LPCSTR); |
31 | 31 | __declspec(dllimport) int __stdcall FreeLibrary(HMODULE);
|
32 | 32 | #endif
|
33 | 33 | |
34 | +#if defined(__GNUC__)
|
|
35 | +# define VOLK_DISABLE_GCC_PEDANTIC_WARNINGS \
|
|
36 | + _Pragma("GCC diagnostic push") \
|
|
37 | + _Pragma("GCC diagnostic ignored \"-Wpedantic\"")
|
|
38 | +# define VOLK_RESTORE_GCC_PEDANTIC_WARNINGS \
|
|
39 | + _Pragma("GCC diagnostic pop")
|
|
40 | +#else
|
|
41 | +# define VOLK_DISABLE_GCC_PEDANTIC_WARNINGS
|
|
42 | +# define VOLK_RESTORE_GCC_PEDANTIC_WARNINGS
|
|
43 | +#endif
|
|
44 | + |
|
34 | 45 | static void* loadedModule = NULL;
|
35 | 46 | static VkInstance loadedInstance = VK_NULL_HANDLE;
|
36 | 47 | static VkDevice loadedDevice = VK_NULL_HANDLE;
|
... | ... | @@ -92,8 +103,9 @@ VkResult volkInitialize(void) |
92 | 103 | module = dlopen("libvulkan.so", RTLD_NOW | RTLD_LOCAL);
|
93 | 104 | if (!module)
|
94 | 105 | return VK_ERROR_INITIALIZATION_FAILED;
|
95 | - |
|
106 | + VOLK_DISABLE_GCC_PEDANTIC_WARNINGS
|
|
96 | 107 | vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)dlsym(module, "vkGetInstanceProcAddr");
|
108 | + VOLK_RESTORE_GCC_PEDANTIC_WARNINGS
|
|
97 | 109 | #endif
|
98 | 110 | |
99 | 111 | loadedModule = module;
|
... | ... | @@ -15,7 +15,7 @@ |
15 | 15 | #endif
|
16 | 16 | |
17 | 17 | /* VOLK_GENERATE_VERSION_DEFINE */
|
18 | -#define VOLK_HEADER_VERSION 280
|
|
18 | +#define VOLK_HEADER_VERSION 283
|
|
19 | 19 | /* VOLK_GENERATE_VERSION_DEFINE */
|
20 | 20 | |
21 | 21 | #ifndef VK_NO_PROTOTYPES
|