Compare commits

...

395 Commits

Author SHA1 Message Date
Sharadh Rajaraman afed5bc758
Fix `vulkan:video` module by correctly removing suffix (#2377)
Set Version Tag / set-version-tag (push) Waiting to run Details
2025-12-01 13:42:21 +01:00
Andreas Süßenbach 126ab7501e
Extent function call tests with Query commands (#2376) 2025-12-01 11:13:21 +01:00
github-actions[bot] 9d55db6621
Update Vulkan-Headers to v1.4.335 (#2374)
Co-authored-by: GitHub <noreply@github.com>
2025-12-01 08:36:55 +01:00
Sharadh Rajaraman cbf8b58154
Rename `vulkan_hpp` module to `vulkan` (#2373)
Set Version Tag / set-version-tag (push) Has been cancelled Details
Update Vulkan-Headers PR / update-vulkan-headers (Debug, 11) (push) Has been cancelled Details
* Rename the `vulkan_hpp` module

* Use corrected module name in all tests

* Update readme

---------

Co-authored-by: Andreas Süßenbach <asuessenbach@nvidia.com>
2025-11-27 17:46:50 +01:00
Sharadh Rajaraman f4fd11e2b6
Export `vulkan_hpp:video` as module partition of `vulkan_hpp` (#2372)
Set Version Tag / set-version-tag (push) Waiting to run Details
* Export vulkan-video as module partition of `vulkan_hpp`

* Export-import video module partition

* Add vulkan-video to main module instead of separately
2025-11-27 10:56:10 +01:00
Andreas Süßenbach cb5783d49d
Add some explicit static_cast to the SharedHandles sample and the UniqueHandleDefaultArguments test. (#2370)
Set Version Tag / set-version-tag (push) Has been cancelled Details
2025-11-25 17:05:24 +01:00
Andreas Süßenbach 73121db60b
Extent function call tests with Queue semaphore commands. (#2369) 2025-11-25 13:39:06 +01:00
github-actions[bot] 6bbd8ccd68
Update Vulkan-Headers to v1.4.334 (#2364)
Co-authored-by: GitHub <noreply@github.com>
2025-11-25 12:38:11 +01:00
GitHub bdda01dc49 Update Vulkan-Headers to v1.4.333
Set Version Tag / set-version-tag (push) Has been cancelled Details
2025-11-18 15:23:46 +01:00
YaaZ 21d217d163 Fix typo leading to module compilation error 2025-11-18 15:22:55 +01:00
Andreas Süßenbach 8e79f71c15
Extend enum value alias handling. (#2361)
Set Version Tag / set-version-tag (push) Has been cancelled Details
2025-11-13 14:09:34 +01:00
Andreas Süßenbach 9747e68285
Restrict template argument Dispatch to only take evaluate the newly introduced type trait isDispatchLoader with value == true. (#2360)
Set Version Tag / set-version-tag (push) Has been cancelled Details
2025-11-12 18:21:31 +01:00
Jan Kuhlmann 7c480ca5aa
C++Module: Fix GCC error and replace `std.compat` with `std` (#2353)
* iunclude vulkan.h before the import

* replace std.compat with std
2025-11-12 13:49:10 +01:00
Andreas Süßenbach 5cd5bcf6de
Extent function call tests with Fence commands (#2359) 2025-11-12 13:42:37 +01:00
Nikita Gubarkov c75dcdc0bb
Export vk::raii::isVulkanRAIIHandleType (#2357)
Set Version Tag / set-version-tag (push) Waiting to run Details
2025-11-12 10:12:14 +01:00
Andreas Süßenbach 15f4b3024f
Fix default values of function arguments when VULKAN_HPP_NO_DEFAULT_DISPATCHER is defined. (#2356) 2025-11-12 10:08:57 +01:00
Jan Kuhlmann 1491456a64
use assert macros (#2352)
Set Version Tag / set-version-tag (push) Waiting to run Details
2025-11-11 14:56:14 +01:00
Andreas Süßenbach 9423ad7f69
Fix wrongly generated interface of vk::raii::Device::getFaultInfoEXT. (#2350) 2025-11-11 11:15:31 +01:00
Andreas Süßenbach 63a3afa9b2
Fix structure usage in special command flavours of vkSetDebugUtilsObjectNameEXT and vkSetDebugUtilsObjectTagEXT (#2348) 2025-11-10 14:29:50 +01:00
Andreas Süßenbach 36b276f0a2
Replace using free by using a std::vector (#2344) 2025-11-10 14:29:35 +01:00
Jan Kuhlmann b4d30a5fb5
CI: Added runner for Windows with Clang and Ninja (#2342)
* add windows ci testing clang and ninja

* attempt to use multi-config builds on msvc ci

* install deps for windows ci

* temporarily disable ci portions

* try clang-cl

* test x64 only

* try x64 for clang-cl

* specify clang-cl as C compiler

* attempt clang-cl with dep install

* ignore unused variable warning in sample02

* need to specify c compiler as glfw install is not being found

* try to ignore warning in standard clang fashion

* syntax fix

* cast procaddress to void* before final func type cast

* added more windows clang warning suppressions

* disable normal windows ci

* suppress warnings in raii samples

* suppress more warnings for tests

* more unused var suppressions for tests

* disable preinstall of deps in clang to prevent _ITERATOR_DEBUG_LEVEL mismatch

* suppress unused var warnings triggered in release mode

* add warning suppression to flags test

* fixed strided array proxy test

* fix structure chain test

* fix extension inspection test

* reenable all ci workflows
2025-11-10 14:29:09 +01:00
github-actions[bot] cda66a2513
Update Vulkan-Headers to v1.4.332 (#2346)
Co-authored-by: GitHub <noreply@github.com>
2025-11-10 13:06:46 +01:00
Sharadh Rajaraman e511715fce
Do not `export import std` as a macro (#2340)
Set Version Tag / set-version-tag (push) Has been cancelled Details
* Do not export-import `std` as a macro

* Move warning expansion to macros file, and create a macro for it
- Also remove macro for `std.compat` and hardcode it
2025-11-06 10:59:34 +01:00
Andreas Süßenbach d0b04b733a
Removed special handling for VkDeviceFaultInfoEXT, which was plainly wrong. (#2343) 2025-11-06 08:22:31 +01:00
Andreas Süßenbach 3a948949cc
Extent function call tests with Sparse resource memory management API commands (optional) (#2341)
Set Version Tag / set-version-tag (push) Has been cancelled Details
2025-11-04 13:48:27 +01:00
github-actions[bot] 95d69172ba
Update Vulkan-Headers to v1.4.331 (#2338)
Co-authored-by: GitHub <noreply@github.com>
2025-11-03 10:15:50 +01:00
Jan Kuhlmann 6f9677513d
properly set build type on windows ci (#2336) 2025-11-03 09:07:45 +01:00
Andreas Süßenbach 4bc2057ad8
Cleanup on default assignment macros. (#2335) 2025-10-30 15:37:07 +01:00
Andreas Süßenbach 053269201d
Extent function call tests with Memory management API commands (#2334) 2025-10-29 11:02:16 +01:00
Andreas Süßenbach 878fb0d390
Add special command flavours for vkSetDebugUtilsObjectNameEXT and vkSetDebugUtilsObjectTagEXT (#2329) 2025-10-29 09:18:30 +01:00
github-actions[bot] 0a7333161d
Update Vulkan-Headers to v1.4.330 (#2330)
Co-authored-by: GitHub <noreply@github.com>
2025-10-27 12:49:31 +01:00
Andreas Süßenbach 1958615077
Minor code cleanup. (#2328) 2025-10-23 14:21:50 +02:00
Andreas Süßenbach f25993be90
Extent function call tests with Memory commands. (#2326) 2025-10-22 14:54:59 +02:00
Andreas Süßenbach 3c1a2e5f10
Minor code cleanup. (#2325) 2025-10-16 13:35:27 +02:00
Nikita Gubarkov 9ab0f0602b
Export comparison operators (#2324) 2025-10-16 13:35:01 +02:00
Andreas Süßenbach 75e7718add
Add support for new api "vulkanbase" (#2323)
* Add support for api "vulkanbase"

* Merge internal APIs before processing

After loading the XML, merge internal API blocks into the public ones
so that we don't litter the vulkan and vulkan sc headers with
Base/Compute/Graphics version notations.

* Modify algorithm to merge internal features into public ones.

---------

Co-authored-by: Daniel Koch <dkoch@nvidia.com>
2025-10-13 21:51:04 +02:00
Andreas Süßenbach aab9fc1ada
Introduce a compile-time flag to handle VK_ERROR_OUT_OF_DATE_KHR like a success code. (#2312) 2025-10-13 11:05:21 +02:00
github-actions[bot] 767fce85b7
Update Vulkan-Headers to v1.4.329 (#2322)
Co-authored-by: GitHub <noreply@github.com>
2025-10-13 10:57:40 +02:00
Sharadh Rajaraman ed449ac36f
Simplify named module handling and macros (#2303)
* Remove `VULKAN_HPP_ENABLE_STD_MODULE` macro; unconditionally use `import std;`

* Emit compile-time warning about experimental state for module

* Refactor `#include` guard to use `VULKAN_HPP_CXX_MODULE` for all headers

* Group global namespace exports into block

* Simplify CMake setup for modules

- Raise minimum version to 3.22 (this is what we have in CI)
- Remove duplicated options
- Set up a single option that depends on magic `__CMAKE::CXX23` target; defaults to OFF unless magic UUID set (or future CMake version supports)

* Rebase changes

* Guard C++ module warning with compile-time flag

* Fix macro guard for experimental warning

* Force `<vulkan/vulkan_hpp_macros.hpp>` at the top of includes list
2025-10-09 21:04:11 +02:00
Andreas Süßenbach 7adfc34c5f
Minor code cleanup. (#2321) 2025-10-09 14:01:53 +02:00
Andreas Süßenbach 608f95fb9f
Extent function call tests with Queue commands (#2320) 2025-10-09 14:00:49 +02:00
Andreas Süßenbach d7f08491dc
Add support for a new flavour of commands. (#2318) 2025-10-08 20:16:53 +02:00
github-actions[bot] af898d1c28
Update Vulkan-Headers to v1.4.328-5-gdcfd966 (#2316)
Co-authored-by: GitHub <noreply@github.com>
2025-10-07 09:54:38 +02:00
Andreas Süßenbach 9e9b735e35
Minor code cleanup. (#2314) 2025-10-02 12:12:53 +02:00
Andreas Süßenbach 2d30af554e
Extent function call tests with Layer discovery commands (#2313) 2025-10-02 12:12:38 +02:00
Andreas Süßenbach 07a9e8911c
Extent function call tests with Extension discovery commands. (#2308)
* Extent function call tests with Extension discovery commands.

* Extent function call tests with Extension discovery commands.
2025-09-30 13:35:39 +02:00
Vobraz 34acbf0712
Fix typo in vk_raii_ProgrammingGuide.md (#2307) 2025-09-30 13:35:16 +02:00
Andreas Süßenbach fda19f0bb3
Extend test DesignatedInitializers to use a struct with deprectated members. (#2305) 2025-09-30 10:45:07 +02:00
Ilya Doroshenko 4ff98ef7a8
#1894 Added macro guard for optional default deleter constructors assignments. (#2296) 2025-09-29 17:22:14 +02:00
Jan Kuhlmann 2c17c62600
added another guard for VULKAN_HPP_ENABLE_STD_MODULE (#2300) 2025-09-29 10:58:54 +02:00
github-actions[bot] ed9a0a586b
Update Vulkan-Headers to v1.4.328 (#2302)
Co-authored-by: GitHub <noreply@github.com>
2025-09-29 10:41:14 +02:00
Andreas Süßenbach 10578463ae
Minor code cleanup. (#2298) 2025-09-25 13:54:06 +02:00
Andreas Süßenbach e0f4656f23
Extent function call tests with Device commands. (#2297) 2025-09-25 13:51:52 +02:00
Jan Kuhlmann f522d73454
C++Module: Fixing import std on enum header and using `export import std` when appropriate (#2283)
* fix std import on enum header

* remove duplicate contents in cppm

* moved dynamic enabling of std module into macro header

* do not automatically enable import std

* automatic opt-out approach for export import std

* added opt-out option VULKAN_HPP_NO_STD_MODULE

* add VULKAN_HPP_NO_STD_MODULE to CI workflows

* added VULKAN_HPP_NO_STD_MODULE flag to the readme

* set VULKAN_HPP_NO_STD_MODULE to OFF by default

* added import_std exclusion to ubuntu-ext CI
2025-09-25 09:02:03 +02:00
Andreas Süßenbach 40596212e8
Start function call compile test to catch API changes: VK_VERSION_1_0, Device initialization (#2295) 2025-09-23 13:50:37 +02:00
Nikita Gubarkov 202f053855
Export ResultValue related functions (#2290) 2025-09-22 14:56:32 +02:00
github-actions[bot] 1a9644fbda
Update Vulkan-Headers to v1.4.327 (#2293)
Co-authored-by: GitHub <noreply@github.com>
2025-09-22 10:48:27 +02:00
Nikita Gubarkov 938a2c36d2
Expose "raw" RAII constructors (#2280)
* Expose "raw" RAII constructors

* Protected raw constructors only for Buffer and Image
2025-09-18 15:35:27 +02:00
Andreas Süßenbach 857bb352ea
Minor code cleanup. (#2289) 2025-09-18 12:31:02 +02:00
dv-001 e418dd91fb
Fix: Correct IWYU pragmas (#2288) 2025-09-17 13:43:30 +02:00
Jan Kuhlmann 7519cc05ad
Tests: Enabled ArrayProxy test for C++Module, except for gcc <= 15 (#2277)
* enabled arrayproxy test for cxxmodule, except for gcc15

* include missing array header

* exclude gcc <16 from ArrayProxy cxxmodule test

* updated exclusion comment for ArrayProxy test
2025-09-16 17:13:41 +02:00
Jan Kuhlmann 8578ac94d5
CI: Added bleeding-edge ubuntu ci with clang 19/20 and newest cmake (4.1) (#2285)
* add bleeding-edge ubuntu ci with clang 19/20 and newest cmake

* renamed new ci workflow and removed deprecated code path
2025-09-16 08:29:10 +02:00
Jan Kuhlmann 4bbdbb434d
manually export vk::SwapchainOwns in module (#2276) 2025-09-15 10:52:02 +02:00
Andreas Süßenbach db104e1c01
Add template CppType to get from C-struct types to vk-struct types, valid with C++20 and above. (#2274) 2025-09-04 13:28:57 +02:00
Andreas Süßenbach 8f2955ba0d
Minor code cleanup (#2275) 2025-09-04 12:00:55 +02:00
Jan Kuhlmann df7099a77e
added explicit cstdlib for vulkan module with std (#2269) 2025-09-03 09:20:01 +02:00
Andreas Süßenbach 88d2ac296b
Add support for structure attribute "requiredlimittype" (#2270) 2025-09-02 13:31:57 +02:00
github-actions[bot] 16fa896427
Update Vulkan-Headers to v1.4.326 (#2267)
Co-authored-by: GitHub <noreply@github.com>
2025-09-01 13:34:17 +02:00
Andreas Süßenbach af5c6fd693
Add support of a new flavour of commands. (#2268) 2025-09-01 11:28:56 +02:00
Andreas Süßenbach 4c3b729686
Minor code cleanup. (#2265) 2025-08-28 15:38:03 +02:00
Andreas Süßenbach f42eadae3d
Add "standard" implementation for raii commands returning a structure chain. (#2263) 2025-08-26 17:03:00 +02:00
Andreas Süßenbach fb20f4b27c
Start of breaking changes documentation (#2261) 2025-08-25 13:23:46 +02:00
Andreas Süßenbach ee89dd16ea
Refactor iterations over required commands. (#2259) 2025-08-21 14:23:00 +02:00
Andreas Süßenbach 1f871772e4
Move the VulkanHppModule projects for the various test projects into the "Tests" folder. (#2258) 2025-08-18 08:33:25 +02:00
Jan Kuhlmann 60e99671c7
removed g++-12 compiler instance from ubuntu 22 CI (#2257) 2025-08-18 08:32:44 +02:00
Andreas Süßenbach 6cfec828f6
Refactor file generation functions (#2256)
* Refactor file generation functions

* Rebased on main.
2025-08-18 08:31:15 +02:00
Jan Kuhlmann 7fcd4522e0
Tests: Created std module versions of each test and enabled previously disabled tests (#2248)
* move vulkan module setup function to global scope

* use the vulkan include setup func for module setups instead of manual linking

* test setup function extended to allow for modules

* create std module variant for each test

* remove the obsolete NO_UTILS from test setup

* commented some TODOs

* only enable module tests when VULKAN_HPP_ENABLE_CPP20_MODULES is set

* reenable handles.cpp test

* remove use nested namespaces

* include array header for ArrayProxyNoTemporaries test

* include <compare> in enums for spaceship operator

* manually added <compare> to Flags.cpp test

* properly guarded <string_view> with c++17 requirement
2025-08-14 15:40:20 +02:00
Jan Kuhlmann aaf0cb61c4
CI: Reduce build times by reusing generated headers (#2254)
* reuse generated headers inbetween runs

* properly access env var

* fix windows compiler arg

* reintroduce ubuntu24 ci compilers

* fixed CXX_MODULES flag logic

* echoing build parameters, removing use of Ninja from windows CI

* fixed echo and temporarily disabled all but windows CI

* reenabled all ci

* compile glm, glfw and glslang once, fixed SPIRV include path

* remove usage of Ninja from windows ci (again)

* fixed glfw name to glfw3

* removed.. debug things

* remove dep install step from windows, enforce correct linking in utils

* compiling generators in debug mode without running them
2025-08-13 20:30:26 +02:00
Andreas Süßenbach c97b7ff82d
Minor code cleanup (#2253) 2025-08-12 09:06:23 +02:00
Jon Creighton c17f7f47cb
Fix for some drivers reporting maxImageCount as 0 (#2251) 2025-08-12 08:36:06 +02:00
Jon Creighton c90a5bac97
Fix for uninitialised deprecated members in DeviceCreateInfo constructor (#2250) 2025-08-12 08:35:01 +02:00
Andreas Süßenbach 7beac182b2
Remove the superfluous operator<=> for handles. (#2247) 2025-08-11 13:37:09 +02:00
Andreas Süßenbach 6bd3b4652c
Introduce defines VULKAN_HPP_DISPATCH_LOADER_[DYNAMIC|STATIC]_TYPE (#2244) 2025-08-11 13:36:46 +02:00
github-actions[bot] 618759b9d6
Update Vulkan-Headers to v1.4.325 (#2249)
Co-authored-by: GitHub <noreply@github.com>
2025-08-11 12:40:35 +02:00
Andreas Süßenbach 114936cae2
Remove unused flag VULKAN_HPP_SAMPLES_BUILD_ONLY_DYNAMIC from CI builds (#2243) 2025-08-07 08:17:27 +02:00
Jan Kuhlmann d996a13dfd
CMake: Only set CMAKE_CXX_STANDARD when not already set before (#2242)
* only set CMAKE_CXX_STANDARD when not already set before

* do not impose custom CXX_STANDARD for module tests
2025-08-07 08:16:26 +02:00
Andreas Süßenbach 0113967b2b
Simplified generation of the reflect function on structures (#2241) 2025-08-06 13:37:07 +02:00
Andreas Süßenbach 6b28af9f1f
Fix missing 'W' in -Wpedantic for non-MSVC builds (#2240) 2025-08-05 11:49:13 +02:00
github-actions[bot] a33145af43
Update Vulkan-Headers to v1.4.324 (#2238)
Co-authored-by: GitHub <noreply@github.com>
2025-08-05 11:44:40 +02:00
Andreas Süßenbach 621c713cf8
Fix struct constructor with deprecated members (#2236) 2025-08-04 16:38:51 +02:00
Andreas Süßenbach d6eb36b132
Add constants to vulkan_video.cppm[hpp|cppm] (#2232) 2025-07-31 16:44:52 +02:00
Andreas Süßenbach 32bd2b7ab7
Adjust order for loading vulkan library by the DynamicLoader for MacOS. (#2231) 2025-07-30 17:19:43 +02:00
Andreas Süßenbach d16c62670b
Mark deprecated struct members as deprecated. (#2230) 2025-07-30 09:36:58 +02:00
Andreas Süßenbach cc01933661
Remove outdated flag VULKAN_HPP_SAMPLES_BUILD_ONLY_DYNAMIC (#2229) 2025-07-28 17:59:43 +02:00
Andreas Süßenbach 167bb6afe0
Remove outdated flag VULKAN_HPP_TESTS_BUILD_ONLY_DYNAMIC (#2228) 2025-07-24 19:26:03 +02:00
Andreas Süßenbach 7dfe7d3ad9
Extend support of VULKAN_HPP_NO_EXCEPTIONS in the raii-namespace (#2226) 2025-07-22 13:48:50 +02:00
Andreas Süßenbach e6d0135c57
Improved error check on exports of commands. (#2225) 2025-07-21 15:11:19 +02:00
Andreas Süßenbach d82ba7c2a0
Explicitly ignore new command attribute "conditionalrendering" (#2223) 2025-07-21 11:58:50 +02:00
github-actions[bot] 11bab25e31
Update Vulkan-Headers to v1.4.323 (#2222)
Co-authored-by: GitHub <noreply@github.com>
2025-07-21 08:50:32 +02:00
Andreas Süßenbach b59d87d696
Minor cleanup work (#2220) 2025-07-18 09:01:07 +02:00
Andreas Süßenbach d3a3c6321f
Extend error check on exports of a required command being in the api list of a feature (#2221) 2025-07-18 08:58:15 +02:00
Andreas Süßenbach 8e34112311
Guard header inclusion in vulkan_video.hpp by __has_include. (#2219) 2025-07-17 12:07:03 +02:00
Jan Kuhlmann 7740791eef
fix cpp20 module test for gcc15 and remove use of dynamic dispatch macro (#2218) 2025-07-17 10:01:26 +02:00
Andreas Süßenbach fb5fd75ee8
Generalize a check on raii-handle destructor detection. (#2216) 2025-07-15 11:54:59 +02:00
Andreas Süßenbach 605be52aa0
Revert PR 2215 (#2217) 2025-07-15 08:32:59 +02:00
Andreas Süßenbach 0771d2657c
Extend support of api "vulkanbase" (#2215) 2025-07-14 17:56:07 +02:00
Andreas Süßenbach da67e807a8
Remove redundant occurrences of VULKAN_HPP_NAMESPACE:: and VULKAN_HPP_RAII_NAMESPACE:: in vulkan_raii.hpp (#2213) 2025-07-14 16:26:20 +02:00
github-actions[bot] 13da06128f
Update Vulkan-Headers to v1.4.322 (#2214)
Co-authored-by: GitHub <noreply@github.com>
2025-07-14 13:40:42 +02:00
Jan Kuhlmann e04460f454
remove faulty macro guard (#2212) 2025-07-09 17:24:43 +02:00
Andreas Süßenbach daeae97daf
Remove redundant occurrences of VULKAN_HPP_NAMESPACE:: in vulkan_to_string.hpp (#2211) 2025-07-08 12:46:22 +02:00
Andreas Süßenbach 68baf3c00f
Remove redundant occurrences of VULKAN_HPP_NAMESPACE:: in vulkan_structs.hpp (#2210) 2025-07-07 17:09:33 +02:00
github-actions[bot] 7824358518
Update Vulkan-Headers to v1.4.321 (#2209)
Co-authored-by: GitHub <noreply@github.com>
2025-07-07 11:28:32 +02:00
Andreas Süßenbach 2010d85fb4
Remove redundant occurrences of VULKAN_HPP_NAMESPACE:: in vulkan_shared.hpp (#2207) 2025-07-03 10:29:37 +02:00
LEE KYOUNGHEON de8730fd22
Use ref qualifier for RAII handles to prevent creating reference to a temporary. (#2159)
* Use ref qualifier to prevent creating reference to a temporary.

* Return const rvalue reference.
2025-07-02 18:05:25 +02:00
Andreas Süßenbach fe0190241c
Remove redundant occurrences of VULKAN_HPP_NAMESPACE:: in vulkan_handles.hpp (#2206) 2025-07-02 15:07:55 +02:00
Andreas Süßenbach 3444a16cfb
Remove redundant occurrences of VULKAN_HPP_NAMESPACE:: in vulkan_funcs.hpp and other headers (#2205) 2025-07-01 17:24:19 +02:00
Andreas Süßenbach a20b4d4438
Removed unused option INCLUDE_DIRS from makefiles. (#2204) 2025-07-01 15:59:53 +02:00
Andreas Süßenbach 9807eb5164
Use windows-2025 instead of windows-2019 (#2203) 2025-07-01 13:11:26 +02:00
github-actions[bot] de509342b4
Update Vulkan-Headers to v1.4.320 (#2202)
Co-authored-by: GitHub <noreply@github.com>
2025-06-30 11:17:30 +02:00
Andreas Süßenbach 32f2957efc
Remove redundant occurrences of VULKAN_HPP_NAMESPACE:: in vulkan_format_traits.hpp (#2200) 2025-06-26 13:40:36 +02:00
Andreas Süßenbach d6a9738739
Correct check on exported command. (#2199) 2025-06-26 13:39:05 +02:00
Andreas Süßenbach 4a6293e749
Restrict check on exports of a command to version greater/equal to 319. (#2197) 2025-06-26 08:06:30 +02:00
Andreas Süßenbach 4ccc5d34ba
Determine the headers to include in vulkan_video.hpp by the extensions names and the protections to use by the extensions comment. (#2196) 2025-06-26 08:05:15 +02:00
Andreas Süßenbach 1c6215ddfd
Remove redundant occurrences of VULKAN_HPP_NAMESPACE:: in vulkan_enums.hpp. (#2195) 2025-06-25 11:10:19 +02:00
Andreas Süßenbach 05f5b9a060
Handle new command attribute "export". (#2194) 2025-06-24 18:35:26 +02:00
Jan Kuhlmann 76be2e0fdf
Added CI test results to README (#2192) 2025-06-24 11:52:04 +02:00
github-actions[bot] a31d678939
Update Vulkan-Headers to v1.4.319 (#2193)
Co-authored-by: GitHub <noreply@github.com>
2025-06-24 10:26:51 +02:00
Andreas Süßenbach dfed90530b
Cleanup work on compare operators (#2169)
* Cleanup work on compare operators

* Use defaulted spaceship operators for handles if available, otherwise use set of explicit comparison operators.
2025-06-24 08:31:14 +02:00
Andreas Süßenbach c143eb293c
Remove redundant occurrences of VULKAN_HPP_NAMESPACE:: in vulkan.hpp. (#2191) 2025-06-18 13:32:51 +02:00
Andreas Süßenbach 3514683079
Filter multiply spec'ed handles for SharedHandles (#2190) 2025-06-16 18:02:05 +02:00
Andreas Süßenbach 01c4ae2211
Filter multiply spec'ed handles on hash generation (#2189) 2025-06-16 15:31:51 +02:00
Andreas Süßenbach 8ee3f2fabd
Filter out multiply spec'ed handles for UniqueHandles types. (#2188) 2025-06-16 12:21:35 +02:00
github-actions[bot] 5bac8fc8fc
Update Vulkan-Headers to v1.4.318 (#2185)
Co-authored-by: GitHub <noreply@github.com>
2025-06-16 11:45:04 +02:00
Andreas Süßenbach 87eaf785f8
Filter multiple required types for function debugReportObjectType (#2184) 2025-06-12 23:12:20 +02:00
Andreas Süßenbach 7fc625d3ce
Add a table of contents to the README.md (#2183) 2025-06-12 23:10:59 +02:00
Andreas Süßenbach 30eef2d002
Replace the self-hosted linux runners by the standard ubuntu 24 runners. (#2181) 2025-06-12 17:52:56 +02:00
Andreas Süßenbach ae6f3c1184
Include missing header type_traits to vulkan_enums.hpp (#2180) 2025-06-12 15:43:51 +02:00
Andreas Süßenbach 81b2f2f950
Add support for newly introduced attributes. (#2177) 2025-06-12 10:33:41 +02:00
Andreas Süßenbach ad71cabe2c
Include two new video codec headers in vulkan_video.hpp. (#2179) 2025-06-12 08:22:28 +02:00
Kévin Petit 64b72c4612
Add support for VK_ARM_tensors (#2175)
- Add two new structures to the multipleLenStructs list


Change-Id: I5fea56734eced9c96dd5bbcc4057d72260497969

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
2025-06-12 08:18:28 +02:00
github-actions[bot] 51a648fa9a
Update Vulkan-Headers to v1.4.317 (#2174)
Co-authored-by: GitHub <noreply@github.com>
2025-06-11 11:07:32 +02:00
btmxh d5b553d969
Add support for vulkan_video.cppm module (#2162)
* Add support for vulkan_video.cppm module

Fix #2151

* Add a module version for the Video test

Currently this add vulkan_video.cppm to the VulkanHppModule target,
which might not be what we want (maybe guard this by an option(), or add
another target like VulkanVideoHppModule, etc.).

* Add a separate target for `vulkan_video.cppm`

* Extract common logic to `vulkan_hpp__setup_module`

* Fix several CMakeLists.txt issues

- Add `vulkan_video.cppm` to `VK_GENERATED_VULKAN_HEADERS`.
- Remove unnecessary ${ARGN} quotes.
- Move version checks out of `vulkan_hpp__setup_module`.
- Separate `FILE_SET_NAME` from `FILE_SET`.
2025-05-15 18:11:27 +02:00
Andreas Süßenbach 54cc539ab5
Add functions vk::isColor() and vk::getAllFormats() (#2166) 2025-05-14 08:41:20 +02:00
btmxh 715aab1337
Fix undefined `assert` when using `std` module (#2165)
* Fix undefined `assert` when using `std` module

Fix #2164

* Move include `<cassert>` to before `<string.h>
2025-05-14 08:40:11 +02:00
Jan Kuhlmann 9e748f985b
C++20 Module: Exporting PFN_* symbols (#2158)
* exporting PFN_* symbols in cppm

* changed fnc signature and removed unnecessary assignment

* forgot one

* moved exports to bottom of cppm
2025-05-13 11:28:32 +02:00
github-actions[bot] 557e25cdd9
Update Vulkan-Headers to v1.4.315 (#2161)
Co-authored-by: GitHub <noreply@github.com>
2025-05-13 10:49:53 +02:00
Andreas Süßenbach 91109e1e2f
Add new functions getColorFormats, hasRedComponent, hasGreenComponent, hasBlueComponent, and hasAlphaComponent to vulkan_format_traits.hpp (#2163) 2025-05-12 16:54:37 +02:00
Andreas Süßenbach 02b78071f1
Refactor format traits generation (#2160) 2025-05-07 16:24:40 +02:00
Jan Kuhlmann ca00bfad9e
Update submodule glslang to version 15.3.0 (#2156) 2025-05-06 13:40:23 +02:00
Andreas Süßenbach 2cadbd617e
Read new feature and extension element "deprecate" (#2155) 2025-05-06 12:14:00 +02:00
github-actions[bot] 9a2cd93085
Update Vulkan-Headers to v1.4.314 (#2153)
Co-authored-by: GitHub <noreply@github.com>
2025-05-06 09:51:16 +02:00
Andreas Süßenbach 448026b9c5
Relax check for attribute "deprecated" of type category "define". (#2152) 2025-05-05 11:15:03 +02:00
Andreas Süßenbach 87f930b684
For a RAII factory function generating an aliased handle, generate the aliasing handle instead (#2150) 2025-04-30 16:00:02 +02:00
Andreas Süßenbach 38bdc9400f
Refactor a number of checking functions (#2149) 2025-04-30 09:07:39 +02:00
Jan Kuhlmann ee121fe6a4
C++20 Module: Fixing dynamic dispatch on Windows MSVC (#2146)
* export defaultDispatchLoaderDynamic symbol

* improved default dispatcher symbol export

* fixed formatting
2025-04-30 08:37:32 +02:00
Andreas Süßenbach 3f281b80b4
Add documentation of new format trait functions (#2144) 2025-04-30 08:35:45 +02:00
Andreas Süßenbach a804eaa9b2
Add missing alias classes for raii-handle wrappers (#2148) 2025-04-29 13:41:12 +02:00
Andreas Süßenbach 6dc0a4e2cf
Fix handle type detection for raii factory return statement generation (#2147) 2025-04-29 09:53:10 +02:00
Andreas Süßenbach 66da6f2b87
Introduce new format traits functions (#2143) 2025-04-23 10:54:17 +02:00
Andreas Süßenbach bdf1304837
Add some special handling for command vkExportMetalObjectsEXT (#2142) 2025-04-22 11:49:46 +02:00
github-actions[bot] 028a01abfc
Update Vulkan-Headers to v1.4.313 (#2140)
Co-authored-by: GitHub <noreply@github.com>
2025-04-22 09:55:06 +02:00
Andreas Süßenbach ee361cf520
Add BitsType to vk::Flags to get from vk::*Flags to vk::*FlagBits at compile-time (#2139) 2025-04-17 18:11:15 +02:00
Andreas Süßenbach 16915b3fa4
Add using WrappedType to FlagTraits<*FlagBits> to generically get from vk::*FlagBits to Vk*FlagBits at compile-time. (#2138) 2025-04-17 10:39:11 +02:00
Andreas Süßenbach ce7006b096
Remove deprecated Ubuntu-20 from CI. (#2136) 2025-04-16 08:32:29 +02:00
Andreas Süßenbach bdc97d096b
Add support for two new command flavours. (#2135) 2025-04-15 22:09:02 +02:00
Andreas Süßenbach fda93ae3fb
Include cassert unconditionally (#2134) 2025-04-10 13:56:09 +02:00
Andreas Süßenbach a428958b7f
Check language feature macro for existence before using it (#2133) 2025-04-10 10:49:25 +02:00
Andreas Süßenbach ce1ffedb70
Minor cleanup work on determining graphics and present queue family indices (#2129) 2025-04-08 09:35:52 +02:00
ewerness-nv 595f21ae1a
Merge pull request #2128 from asuessenbach/replaced_test
Fix generation of end of extension replacements test functions
2025-04-07 12:03:27 -07:00
asuessenbach 387ae87201 Fix generation of end of extension replacements test functions 2025-04-07 12:45:18 +02:00
github-actions[bot] 7eb8eacec5
Update Vulkan-Headers to v1.4.312 (#2127)
Co-authored-by: GitHub <noreply@github.com>
2025-04-07 11:33:00 +02:00
Andreas Süßenbach 893cc80cf9
Replace ubuntu24.04 workflow by a self-hosted linux runner (#2123) 2025-04-07 09:33:17 +02:00
Andreas Süßenbach 450a047750
Extend depends handling of extensions to allow multiple sets of dependencies for the very same vulkan version. (#2126) 2025-04-03 20:21:11 +02:00
Andreas Süßenbach 3f84a60581
Define CLANG_FORMAT_EXECUTABLE only for the generators. (#2125) 2025-04-03 13:25:12 +02:00
Andreas Süßenbach 63eff3a2e0
Re-introduce extension dependencies inspection (#2124)
* Re-introduce extension dependencies inspection.
2025-04-03 09:06:58 +02:00
Andreas Süßenbach 566e770a3b
Ignore tag on identifying no deleter functions (#2121) 2025-04-01 12:33:59 +02:00
Andreas Süßenbach 6f7fcdfbc7
Simplified member name generation for raii handles (#2120) 2025-03-31 15:51:25 +02:00
Jan Kuhlmann 624143e366
ci: C++20 module testing (#2110)
* added module compilation to ubuntu ci

* added ubuntu 24.04 with clang++-19

* exclude g++-10 from module testing

* exclude clang++-19

* only perform module tests for c++20 and up

* added module option to ci matrix

* added module ci tests for windows, trying out ci ternary

* exclude windows-2019

* ubuntu ci module tests via ternary

* enabled module testing for c++23 in ubuntu

* properly negate c++23 filter

* more concise module flag

* re-trigger ci

* spread out excluded compilers for modules over multiple lines

* fixed json escape sequence

* enable module testing in ci-ubuntu-24

* revert accidental commit of testing opts

* properly convert compiler array to json

* merge Vulkan-Headers submodule version from main

* split up macos runners similar to windows and ubuntu, also enable module compilation

* added macos-15 runner for module testing

* trigger ci

* only test modules for cpp_standard >= 20

* attempt to fix macos module compilation

* revert module attempts on macos

* macos rename + clang++-18 removal, equalized module compilation flag for windows and ubuntu
2025-03-31 14:14:49 +02:00
Andreas Süßenbach abe7295190
Add support for a new type of commands. (#2119) 2025-03-31 10:51:30 +02:00
Andreas Süßenbach 97e60d04f3
Add support for a new class of commands. (#2118) 2025-03-26 15:00:42 +01:00
Andreas Süßenbach c86d00a898
Minor cleanup work. (#2117) 2025-03-26 08:37:18 +01:00
Andreas Süßenbach fd6e74416c
Split the CI builds on ubuntu into separate runners (#2116) 2025-03-26 08:36:04 +01:00
Andreas Süßenbach e3ea28320d
Fix correctness checks for syncaccess and syncstage (#2115)
+ fix generation of structures used in a structure
2025-03-25 13:24:00 +01:00
github-actions[bot] 1fd397b801
Update Vulkan-Headers to v1.4.311 (#2114)
Co-authored-by: GitHub <noreply@github.com>
2025-03-25 10:37:38 +01:00
Jan Kuhlmann efa6cf3a25
Fix unix DL linkage (#2108) 2025-03-19 08:25:41 +01:00
Andreas Süßenbach 053eb2d62c
Adjust build files to allow test builds without sample builds (#2107) 2025-03-18 13:47:01 +01:00
Andreas Süßenbach 8fa7cf094d
Extend set of separators for required dependencies check. (#2106) 2025-03-18 09:53:31 +01:00
Jan Kuhlmann f9c5bfde49
CMake: Cleanup of vulkan target and cpp module test (#2105)
* cleanup of vulkan target

* fixed cpp module test

* extend ubuntu ci to compile cpp modules

* only test cpp modules on ubuntu 24.04

* fixed condition syntax

* exclude gcc <=14

* revert ci for ubuntu
2025-03-18 08:52:47 +01:00
Ans 04727f6695
Fixed commenting (#2103)
* Fixed commenting

* Fixed commenting
2025-03-17 12:31:27 +01:00
Andreas Süßenbach 4266ef3040
Move handling and checking of "len" members of a struct to after all members are read (#2102) 2025-03-13 23:40:28 +01:00
Andreas Süßenbach b19b7d7afb
Make the vk::to_string functions constexpr with C++20 and above. (#2101) 2025-03-13 13:44:44 +01:00
Andreas Süßenbach 538fa5d529
Minor cleanup work. (#2098) 2025-03-11 19:48:59 +01:00
Jan Kuhlmann fd13995952
temporarily remove extension dependency inspection (#2099) 2025-03-11 16:59:02 +01:00
Andreas Süßenbach 2c6d6c29b8
Remove the parallel file generation due to too many file access issues on CI builds. (#2100) 2025-03-11 16:55:02 +01:00
github-actions[bot] 1ce3fcac8b
Update Vulkan-Headers to v1.4.310 (#2097)
Co-authored-by: GitHub <noreply@github.com>
2025-03-10 17:53:35 +01:00
Victor Chernyakin fe203f86d0
Optimize `to_string` functions for enums (#2096)
* Optimize `to_string` functions for enums

* Fix `-Wunused-parameter` warning
2025-03-06 17:30:20 +01:00
Andreas Süßenbach da9db0c8a0
Replace some more "vk::" by "VULKAN_HPP_NAMESPACE::" (#2095) 2025-03-06 17:19:37 +01:00
Andreas Süßenbach 325602c26a
Remove extension dependency inspection functions (temporarily) (#2094) 2025-03-06 17:17:32 +01:00
Andreas Süßenbach 8f9db1bad6
Minor cleanup work (#2090) 2025-02-24 18:02:40 +01:00
Andreas Süßenbach f03a052717
Add support for another command flavour, returning result and three values. (#2089) 2025-02-24 13:57:17 +01:00
github-actions[bot] 16da8bd29e
Update Vulkan-Headers to v1.4.309 (#2088)
Co-authored-by: GitHub <noreply@github.com>
2025-02-24 11:46:40 +01:00
Jan Kuhlmann be9459f9c3
properly export VkGeometryInstanceFlagsKHR symbol (#2085) 2025-02-24 11:08:07 +01:00
Piers Daniell 0236fbad7d
Add additional type conversion operators to the struct classes to make it easier to interoperate with the Vulkan C API (#2087)
* Add type conversion operators to the structs

This improves compatibility with the Vulkan C API so applications can
easily use the vulkan_structs.hpp classes with the C API seamlessly.

* Minor fixes
2025-02-24 09:35:16 +01:00
Jan Kuhlmann 6922436d90
CI: Another attempt to fix windows ci.. (#2086)
* explicit flush before std::system

* retrigger ci
2025-02-24 09:25:16 +01:00
Jan Kuhlmann 2860728579
CMake: Reintroduced #2075 (#2083)
* reintroduced vulkan C header includes

* include Vulkan C headers in sample/test func
2025-02-24 09:13:43 +01:00
Jan Kuhlmann 4c8fe92a96
CI: Attempt to fix build failure on windows (#2084)
* explicit flush before clangd-format execution

* scoped ofs attempt

* retrigger ci
2025-02-20 17:15:30 +01:00
Andreas Süßenbach 8ab6cb5d8b
Add some temporary debug output in CMakeLists.txt. (#2081) 2025-02-19 13:18:44 +01:00
Andreas Süßenbach 5f4583c500
Cleanup work on correctness checks (#2079) 2025-02-19 09:11:19 +01:00
Jan Kuhlmann 03f07338be
Suppress clang warning `-Wcast-function-type` for shared destroy (#2078)
* supress clang warning for shared destroy

* ignore demoted to -Wcast-function-type

* ignore warning only for clang13 and up

* only pop warning if previously pushed
2025-02-19 09:05:30 +01:00
Andreas Süßenbach ed5993af83
Revert MR #2075 (#2080) 2025-02-18 13:32:34 +01:00
Jan Kuhlmann 85036c964c
C++20 module: Hide to_string behind VULKAN_HPP_NO_TO_STRING (#2077)
* hide to_string behind VULKAN_HPP_NO_TO_STRING

* adjusted generated cppm
2025-02-18 08:20:17 +01:00
Jan Kuhlmann 74a2ce1e91
CMake: Offer multiple choices for Vulkan C headers (#2075)
* offer multiple choices for Vulkan C headers

* replaced redundant link
2025-02-18 08:15:37 +01:00
Yilong Li 9dbf676cdb
vulkan_handles: Remove the redundant semicolon after ctor definition (#2073)
Semicolons after in-class function definitions are redundant, and may
trigger the "-Wextra-semi" warning of compilers, for example:

* gcc: https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html#index-Wextra-semi
* clang: https://clang.llvm.org/docs/DiagnosticsReference.html#wextra-semi

This change removes the redundant semicolon in the code generator and
the generated hpp file.

Bug: https://fxbug.dev/378964821
2025-02-17 14:36:07 +01:00
Andreas Süßenbach 4dc27d82a4
Move lengthy template texts into snippet files. (#2072) 2025-02-13 10:56:11 +01:00
Jan Kuhlmann 7d7c25f9be
CMake: Added unified options for `VulkanHpp` and `VulkanHppModule` compile definitions (#2066)
* added compile definitions as cmake options

* use VulkanHpp dynamic dispatch setting for module

* adjusted comments

* adjusted dynamic loader tool option

* remove dynamic loader tool option

* removed non-boolean flags

* make VULKAN_HPP_DISPATCH_LOADER_DYNAMIC depend on VK_NO_PROTOTYPES

* added descriptions to options

* adjusted formatting

* fixed typo

* deprecated module-specific cmake flag VULKAN_HPP_CPP20_MODULE_DYNAMIC_DISPATCHER

* link to vulkan-1 on static dispatch loader

* typo fix

* only optionally find vulkan, warn in case it is missing
2025-02-13 07:56:23 +01:00
Andreas Süßenbach 0ff63e9dc6
Throw on clang_format failure; fix comment (#2070) 2025-02-11 09:35:35 +01:00
Jan Kuhlmann a854add3d8
README: Fixed sorting order for *_NO_TO_STRING (#2069) 2025-02-11 09:34:04 +01:00
Andreas Süßenbach c5c8642d2a
Make BreakBeforeConceptDeclarations a boolean for clang-format 14. (#2068) 2025-02-10 16:08:40 +01:00
Andreas Süßenbach 3e53a5804a
Add support for clang_format options version 18 (#2064) 2025-02-06 17:14:29 +01:00
Andreas Süßenbach 3ec3e1c8d1
Add support for clang_format options version 17 (#2063) 2025-02-06 13:20:09 +01:00
Andreas Süßenbach 3f2fe22281
Add support for clang_format options version 16. (#2062) 2025-02-05 13:44:36 +01:00
LEE KYOUNGHEON 8672aa4aaa
Export std::{tuple_size,tuple_element} for vk::StructureChain. (#2060)
* Export std::{tuple_size,tuple_element} for vk::StructureChain.

* Add separator
2025-02-05 08:47:13 +01:00
Andreas Süßenbach d9c7a3b836
Add links into https://registry.khronos.org/vulkan/specs/latest/man/html for relevant data types (#2061) 2025-02-04 11:13:58 +01:00
Andreas Süßenbach ad9104d2b4
Add an error check for struct members with their array size at the wrong position. (#2059) 2025-02-03 17:29:23 +01:00
github-actions[bot] 6b05ffe121
Update Vulkan-Headers to v1.4.307 (#2058)
Co-authored-by: GitHub <noreply@github.com>
2025-02-03 11:44:22 +01:00
Andreas Süßenbach 1bfa987bf4
Update namespace usage of DispatchLoaderDynamic, DispatchLoaderStatic, and DynamicLoader in the readme. (#2057) 2025-01-27 14:28:32 +01:00
github-actions[bot] bc11a75f32
Update Vulkan-Headers to v1.4.306 (#2055)
Co-authored-by: GitHub <noreply@github.com>
2025-01-27 10:21:23 +01:00
Jan Kuhlmann 4ff2cb7c95
CMake: Adding generator dependency to `VulkanHpp` interface target for propagation and linking it to other targets (#2054)
* moved generator-related setup into the generator build section

* move generators and VulkanHpp* targets in front of setup functions

* make VulkanHpp potentially dependant on the generators, propagating to targets linking to it

* add local vulkan dep to VulkanHpp and propagate this and generator deps to VulkanHppModule

* link against local Vulkan::Hpp for include setup

* fix generator dep target

* fixed VULKAN_HPP_GENERATOR_BUILD option

* move warning level func in front of generators

* added build_video_hpp as a dependency for VulkanHpp
2025-01-23 13:52:14 +01:00
Jan Kuhlmann 16bfa65a59
README: Fixing extension inspection typo and RAII-classes title format (#2052)
* Fixed README typo in extension inspection

* Bring RAII-classes title format in line with other titles
2025-01-22 08:39:26 +01:00
Jan Kuhlmann f8704c9a4e
CMake: Alias for c++20 modules target (#2048)
* created alias for cxx module target

* renamed Vulkan-Hpp to VulkanHpp akin to VulkanHppModule

* provide vk-hpp include dir to module target via interface target

* fixed indent
2025-01-22 08:26:32 +01:00
Andreas Süßenbach 8703963422
Adjust update-header-pr.yml to run with an arbitrary compiler on ubuntu-latest (#2051) 2025-01-21 22:46:52 +01:00
Andreas Süßenbach 2a19ddd7e4
Switch windows workflow from looping over C++ standards to one standard per job (#2050) 2025-01-21 12:21:07 +01:00
Andreas Süßenbach 6578bfcc88
Update Vulkan-Headers to v1.4.305 (#2049) 2025-01-21 10:53:23 +01:00
Jan Kuhlmann e7a8252006
CMake: Moving options below project declaration (#2047)
* move options below project declaration

* expand cmake version dep for c++20 modules

* default VULKAN_HPP_GENERATOR_BUILD to PROJECT_IS_TOP_LEVEL

* fixed format

* moved CMAKE_CXX_STANDARD

* only set cxx standard if top-level
2025-01-21 08:21:10 +01:00
Jan Kuhlmann ce439adae2
Isolating generator targets and creating header-only interface target (#2042)
* VULKAN_HPP_GENERATOR_BUILD option for cmake targets

* Vulkan-Hpp target aliased as Vulkan::Hpp
2025-01-20 08:45:29 +01:00
Andreas Süßenbach 9790cf00ed
Add support for one more value for attribute <bits> in format component. (#2044) 2025-01-15 08:29:52 +01:00
Andreas Süßenbach 03c775461b
Use VULKAN_HPP_NO_CONSTRUCTORS and VULKAN_HPP_NO_SETTERS as documented in the readme. (#2041) 2025-01-09 15:45:43 +01:00
Andreas Süßenbach 8ca59e086c
Update Vulkan-Headers to v1.4.304 (#2039) 2025-01-09 12:33:24 +01:00
Andreas Süßenbach ed47b1d9ad
Remove special assertion on eFreeDescriptorSet in function Device::createDescriptorPool (#2038) 2025-01-08 19:47:53 +01:00
Andreas Süßenbach 752778463e
Parallelize the generation of the files. (#2035) 2025-01-08 11:53:08 +01:00
Andreas Süßenbach 264d35b58c
Introduce vk::PFN_VoidFunction as a replacement of PFN_vkVoidFunction (#2033) 2025-01-06 18:04:33 +01:00
Andreas Süßenbach d5f49e5a7b
Change using WIN32 to _WIN32 (#2032) 2025-01-06 14:20:22 +01:00
Andreas Süßenbach 0d89df69b3
Export the C-type VkGeometryInstanceFlagsKHR in vulkan.cppm. (#2023) 2025-01-06 10:16:51 +01:00
Andreas Süßenbach 1055cb5e78
Add funcpointer types to vulkan.cppm. (#2022) 2024-12-12 15:20:37 +01:00
Andreas Süßenbach d5a18dc87e
Introduce vk-version of the funcpointers (#2020) 2024-12-12 09:46:53 +01:00
Andreas Süßenbach 07cdcb909d
Adjust namespace of compare operators on vk-handles. (#2013) 2024-12-11 09:33:07 +01:00
Andreas Süßenbach 22a2be853c
Export detail::getDispatchLoaderStatic in vulkan.cppm (#2008) 2024-12-11 09:28:49 +01:00
Andreas Süßenbach bdd57b78fa
Include vulkan_to_string.hpp in vulkan.cppm (#2017) 2024-12-10 17:46:29 +01:00
Andreas Süßenbach a29adc0147
Include vulkan.hpp, instead of vulkan_enums.hpp in vulkan_to_string.hpp. (#2016) 2024-12-10 17:44:47 +01:00
Andreas Süßenbach 3e09217b97
Add some comment on windows workflow (#2014) 2024-12-09 12:17:11 +01:00
Andreas Süßenbach c2c49478e9
Re-add compare operators of vk-handles, needed for 32bit builds. (#2010) 2024-12-06 09:56:10 +01:00
github-actions[bot] 20ecea9574
Update Vulkan-Headers to v1.4.303 (#2006)
Co-authored-by: GitHub <noreply@github.com>
2024-12-04 10:30:35 +01:00
Andreas Süßenbach ab53607248
Remove building for vulkansc from VULKAN_HPP_RUN_GENERATOR (#2005) 2024-12-03 11:38:27 +01:00
Andreas Süßenbach efd575e884
Update Vulkan-Headers to v1.3.302 (#2003)
* Update Vulkan-Headers to v1.3.302

* update
2024-12-02 16:48:59 +01:00
Andreas Süßenbach 265b317356
Extend enum value alias handling. (#2004) 2024-12-02 13:50:53 +01:00
Andreas Süßenbach 1e92bf4fcd
Add inclusion of new encode file to VideoHppGenerator, add compile test for video. (#2002) 2024-12-02 08:51:02 +01:00
Andreas Süßenbach 06b91cfdc2
Add comparison operators for vk::raii handles, remove them for vk handles (#2001) 2024-11-28 08:50:43 +01:00
Andreas Süßenbach ab4a7ced0f
Adjustments for update to 1.3.302 (#1999) 2024-11-27 09:56:57 +01:00
Andreas Süßenbach cdfa83ab79
Add specializations of std::hash for all the structs and handles in the vk-namespace. (#1994) 2024-11-26 11:08:49 +01:00
Andreas Süßenbach d433715af0
Extend cases when vk::detail::DispatchLoaderStatic is defined. (#1995) 2024-11-14 12:19:22 +01:00
Andreas Süßenbach a4d53f4a22
Move extension inspection template to a snippet file. (#1992) 2024-11-11 11:41:24 +01:00
Andreas Süßenbach 4fb483e6a0
Add CI support for macos-14-large (#1989) 2024-11-06 16:53:08 +01:00
Andreas Süßenbach 43f7a18b02
Adjust loading procedure of the vk::detail::DynamicLoader on MacOS (#1991) 2024-11-05 19:52:08 +01:00
github-actions[bot] 6902b578be
Update Vulkan-Headers to v1.3.301 (#1990)
Co-authored-by: GitHub <noreply@github.com>
2024-11-05 11:47:23 +01:00
Andreas Süßenbach eaf912017f
Add CI support for ubuntu-24.04 (#1987) 2024-10-31 17:25:04 +01:00
Andreas Süßenbach ab5eb71025
Use compile option -fno-strict-aliasing to prevent breaking optimizations due to using reinterpret_cast (#1985) 2024-10-31 08:24:05 +01:00
Andreas Süßenbach 17a245e6ec
Remove macos-12 from workflow. (#1986) 2024-10-30 13:34:01 +01:00
Andreas Süßenbach 6e5489fcd9
Move all the management helper classes for SharedHandles and UniqueHandles into namespace detail. (#1984) 2024-10-30 08:14:48 +01:00
Andreas Süßenbach ed3cf7ac51
Move all the dispatcher related classes into namespace detail (#1983) 2024-10-29 08:13:51 +01:00
github-actions[bot] 24dee1ce75
Update Vulkan-Headers to v1.3.300 (#1981)
Co-authored-by: GitHub <noreply@github.com>
2024-10-28 12:45:25 +01:00
Andreas Süßenbach e80b3fae8a
Restrict commands taking an allocator as template argument to allocators of the correct data type (#1980) 2024-10-24 16:29:00 +02:00
Andreas Süßenbach eecf79d57f
Add some special handling debug code for vk::raii::DescriptorPool (#1978) 2024-10-24 08:18:43 +02:00
Andreas Süßenbach eacba56dc5
Add some docu on vk::raii classes (#1976) 2024-10-22 08:41:52 +02:00
github-actions[bot] 8444972909
Update Vulkan-Headers to v1.3.299 (#1974)
Co-authored-by: GitHub <noreply@github.com>
2024-10-21 14:58:14 +02:00
Andreas Süßenbach 64f5bbf55c
Allow the <feature>'s "name" to be a list of members (#1973) 2024-10-17 08:19:47 +02:00
github-actions[bot] 8592ed9743
Update Vulkan-Headers to v1.3.298 (#1971)
Co-authored-by: GitHub <noreply@github.com>
2024-10-14 12:32:50 +02:00
Andreas Süßenbach 56fdc0b070
Generate only the standard version for commands that would require vector-operations inside a struct. (#1970) 2024-10-09 16:06:13 +02:00
Andreas Süßenbach 00dac1bd21
Add check on <syncstage> <syncsupport> "queues" being specified with at least one command. (#1968) 2024-10-08 13:25:37 +02:00
Andreas Süßenbach b8e4e70adf
Add "BOOL" as accepted value for attribute <numericFormat> for the <component> of a <format> (#1967) 2024-10-07 17:58:00 +02:00
Andreas Süßenbach 3b9d6cced3
Upgraded check on required feature name being member of the required struct from warning to error. (#1966) 2024-10-07 17:57:38 +02:00
GitHub 26cf5590cb Update Vulkan-Headers to v1.3.297 2024-10-05 21:26:32 +02:00
Andreas Süßenbach 2af53173c8
Reshaped samples [RAII_]PhysicalDeviceProperties (#1961) 2024-09-26 09:14:35 +02:00
Andreas Süßenbach 31aac24adb
Move correctness checks on syncstage and syncaccess to checkCorrectness (#1960) 2024-09-23 13:47:05 +02:00
Andreas Süßenbach e12c05d628
Add support for multiple top-level tags <types>, <commands>, and <extensions> (#1959) 2024-09-17 15:03:34 +02:00
Andreas Süßenbach 4e6e8d3fda
Add support for multiply aliased structs in <require>-<feature> tags. (#1958) 2024-09-05 17:44:31 +02:00
Sharadh Rajaraman 6abd3f42a8
Use `import std;` guarded by macro (#1932)
* Initial build and tests setup

* Enable the `CppStdModule` test

* Snippets and generator changes

* Generated files changes

* Enable std module with macro

* Unconditionally use `import std` with C++23

* Add support for external `import std` control with `VULKAN_HPP_ENABLE_STD_MODULE`

- Rewrite `includes.hpp` and `macros.hpp`
- Unconditionally set `VULKAN_HPP_ENABLE_STD_MODULE` for `vulkan.cppm` to bug-fix
- Generated necessary files again

* Top-level CMake changes

* Reorganise logic, and propagate external macro correctly

* RAII: vulkan_hpp before ifdef

* Define `VK_USE_64_BIT_PTR_DEFINES` in `vulkan_hpp_macros.hpp`

* Generate the `VK_USE_64_BIT_PTR_DEFINES` clause from the XML instead of hardcoding it

* Refactored handling for `VK_USE_64_BIT_PTR_DEFINES`

- Updated condition to positive test for `#ifndef VK_USE_64_BIT_PTR_DEFINES` in `completeMacro`

* Added `#include <string.h>` to resolve `strnlen` missing in the module

* Use only `std.compat`

* FIx after rebase
2024-09-05 08:48:19 +02:00
Andreas Süßenbach 7d423e64bf
Extend CI to run on ubuntu-20.04 (#1956) 2024-09-04 15:37:01 +02:00
Andreas Süßenbach fbb62163a0
Mark deprecated enum values as deprecated (#1955) 2024-09-03 08:53:36 +02:00
github-actions[bot] 2fcbcfbefe
Update Vulkan-Headers to v1.3.295 (#1954)
Co-authored-by: GitHub <noreply@github.com>
2024-09-02 12:39:56 +02:00
Andreas Süßenbach 0262bef5cd
Add support for new <feature> tags. (#1953) 2024-08-27 13:33:57 +02:00
Andreas Süßenbach 98ea600e1f
Removed special handling for enumerating commands with complex size information via a struct, generating just the standard function in such cases (#1952) 2024-08-26 16:21:45 +02:00
github-actions[bot] bd70384cd4
Update Vulkan-Headers to v1.3.294 (#1951)
Co-authored-by: GitHub <noreply@github.com>
2024-08-26 16:06:58 +02:00
Andreas Süßenbach ecd4b59328
Remove move-constructor and deleted move-assignment of vk::StructureChain. (#1949) 2024-08-26 09:45:57 +02:00
Andreas Süßenbach 1069a086a6
Add g++-14 to MacOS workflow (#1948) 2024-08-21 18:06:26 +02:00
Andreas Süßenbach 3ab9238e91
Add g++-12 to MacOS workflow. (#1945) 2024-08-20 17:34:34 +02:00
Andreas Süßenbach d86b49ca04
Update Vulkan-Headers to v1.3.293 (#1944) 2024-08-19 16:23:55 +02:00
Andreas Süßenbach 61bc93f955
Remove gcc-11 for builds on macos (#1942) 2024-08-19 12:31:21 +02:00
Andreas Süßenbach b2c409dd31
Add IWYU pragmas to let code-completers use vulkan.hpp. (#1939) 2024-08-07 15:04:06 +02:00
Andreas Süßenbach fde7e0fc84
Remove deprecation message on promoted extensions. (#1938) 2024-08-07 12:09:39 +02:00
Andreas Süßenbach 6a11b182e1
Extend support of video format properties (no code generated) (#1937) 2024-08-06 09:22:31 +02:00
github-actions[bot] dd0785dbc1
Update Vulkan-Headers to v1.3.292 (#1934)
Co-authored-by: GitHub <noreply@github.com>
2024-08-05 14:58:22 +02:00
Sharadh Rajaraman 003cf8e090
Don't export symbols in `vk::detail` namespace (#1931) 2024-08-05 14:26:29 +02:00
Ilya Doroshenko 0f4e59bd95
Fix for shared handles for pool deleter (#1925)
* Fix for shared handles for pool deleter

* added pool type traits,
added special constructor for pool types

* return of assert
2024-08-05 14:21:44 +02:00
Andreas Süßenbach 763e5bf88f
Use clang++-13 with C++23 on ubuntu-latest (#1930) 2024-07-23 14:46:51 +02:00
Nikolai Siukosev ae1eb5f449
Non raii handles move exchange (#1929)
* Add move semantics for non-raii hpp handles. (#1919)

* Updated generated vulkan/* files
2024-07-23 09:55:09 +02:00
Andreas Süßenbach cdcde2bd0b
Parse <videocodecs> section (no code generated from) (#1926) 2024-07-23 09:47:41 +02:00
github-actions[bot] f7f0d8ccaa
Update Vulkan-Headers to v1.3.291 (#1924)
Co-authored-by: GitHub <noreply@github.com>
2024-07-22 13:20:20 +02:00
Andreas Süßenbach 77f6a638a7
Use clang++14 with Cpp-23 on ubuntu-latest (#1921) 2024-07-17 13:18:25 +02:00
Andreas Süßenbach a4cbf9c027
Use clang++-15 with Cpp-23 on ubuntu-latest (#1920) 2024-07-16 14:43:05 +02:00
github-actions[bot] e3b0737d57
Update Vulkan-Headers to v1.3.290 (#1918)
Co-authored-by: GitHub <noreply@github.com>
2024-07-15 12:43:47 +02:00
Janeczko Jakub 096e555640
Add alias bitmasks to module interface (#1917)
* add alias bitmasks to c++ module

* generate code

* format
2024-07-15 12:39:19 +02:00
Andreas Süßenbach 6f72ceca51
Add g++12 for ubuntu builds. (#1914) 2024-07-11 09:36:14 +02:00
github-actions[bot] 630d8da8c6
Update Vulkan-Headers to v1.3.289 (#1912)
Co-authored-by: GitHub <noreply@github.com>
2024-07-01 14:11:05 +02:00
Andreas Süßenbach 620cf05ac2
Improve IndexTypeTraits determination. (#1911) 2024-06-28 09:41:13 +02:00
Andreas Süßenbach 3b0d995a82
Introduce some special handlings for structure VkLayerSettingEXT. (#1910) 2024-06-27 13:32:31 +02:00
Andreas Süßenbach aac0b4d3ac
Simplify helper class vk::ArrayProxyNoTemporaries. (#1908) 2024-06-25 17:43:55 +02:00
Bohdan Soproniuk dceddb7e31
Update the instance extensions list for WSI (#1875)
The VK_MVK_ios_surface and VK_MVK_macos_surface extensions have been
deprecated by the VK_EXT_metal_surface extension.
The VK_KHR_mir_surface extension has been removed from the Vulkan
specification and, therefore, should not be used.
2024-06-19 09:04:07 +02:00
Andreas Süßenbach 6604f5a1d9
Make generated headers resistant to missing definition of NOMINMAX for windows builds. (#1906) 2024-06-17 14:51:12 +02:00
Andreas Süßenbach 3be51fe651
Remove superfluous const in casts of function arguments by value. (#1905) 2024-06-17 14:40:59 +02:00
github-actions[bot] bfb16c9781
Update Vulkan-Headers to v1.3.288 (#1904)
Co-authored-by: GitHub <noreply@github.com>
2024-06-17 14:13:31 +02:00
Andreas Süßenbach b7b92b1e45
Remove an outdated assertion (#1903) 2024-06-13 15:30:49 +02:00
Andreas Süßenbach 842406f2a6
Try to workaround a possible bug with clang and gcc... (#1902) 2024-06-13 14:07:04 +02:00
Andreas Süßenbach 45d90067ee
Add missing cast from VkResult to vk::Result. (#1901) 2024-06-13 13:45:46 +02:00
Andreas Süßenbach 66af8942cb
Fix command sequence for enumerating commands with just one success code. (#1900) 2024-06-13 10:08:18 +02:00
Andreas Süßenbach 235b1a2f85
Reorganized alias handling of constants. (#1899) 2024-06-13 09:47:27 +02:00
Andreas Süßenbach 71031df10a
Fix generation of the standard version of commands to only use the member handle for the first argument. (#1898) 2024-06-12 17:31:32 +02:00
Andreas Süßenbach dc6501456a
Add support for commands with three return parameters, two of them representing a vector. (#1897) 2024-06-12 16:36:03 +02:00
Andreas Süßenbach 600e6d67a2
Relax check for commands listed as required for a feature to just check if it's required for a different feature (#1896) 2024-06-12 13:52:23 +02:00
Andreas Süßenbach b35470b05f
Accept type size_t for vector size in vector-describing structure. (#1895) 2024-06-12 08:41:25 +02:00
Andreas Süßenbach d507727fd7
Add support for enumerating functions that originally take a struct with the vector information. (#1892) 2024-06-11 16:53:15 +02:00
github-actions[bot] 6fb0c202be
Update Vulkan-Headers to v1.3.287 (#1891)
Co-authored-by: GitHub <noreply@github.com>
2024-06-10 11:37:10 +02:00
Andreas Süßenbach 4d12a28006
Improve relational operators on ArrayWrapper1D. (#1890) 2024-06-06 08:35:49 +02:00
Andreas Süßenbach a64aeb648b
Improved alias handling for enum values and structs; extended error checking commands listed as required in features. (#1889) 2024-06-05 16:44:13 +02:00
Andreas Süßenbach 4557f02974
Extend vk::su::createInstance to also take a vk::InstanceCreateFlagBits. (#1888) 2024-06-04 16:35:52 +02:00
Andreas Süßenbach eb1f4cfb58
Update Vulkan-Headers to v1.3.286 (#1887) 2024-06-04 16:32:05 +02:00
Andreas Süßenbach 83b289da71
Remove some failing compilers (macos, ubuntu) from workflow. (#1886) 2024-06-04 11:51:53 +02:00
to_matih 56fb4452c6 Add version awareness to instance creation 2024-05-31 09:30:51 +02:00
github-actions[bot] b2810ca912
Update Vulkan-Headers to v1.3.285 (#1871)
Co-authored-by: GitHub <noreply@github.com>
2024-05-14 22:53:57 +02:00
Andreas Süßenbach c8dd4fb5ea
Add support for enumerating commands with more than two success codes. (#1870) 2024-05-08 18:46:23 +02:00
Andreas Süßenbach d3f062dd68
Change default for template non-type parameter value of struct CppType from 0 to Type{}. (#1868) 2024-05-07 13:45:58 +02:00
github-actions[bot] 8d46db6965
Update Vulkan-Headers to v1.3.284 (#1867)
Co-authored-by: GitHub <noreply@github.com>
2024-05-07 12:08:03 +02:00
Andreas Süßenbach 5c9e9edf07
Add macos-13 to workflow. (#1865) 2024-05-07 08:28:31 +02:00
Andreas Süßenbach 1bbd615b15
Change member initialization lists of structs to use braces {} instead of parentheses () (#1864) 2024-05-06 10:36:48 +02:00
Andreas Süßenbach 2518f528c0
Simplify handling of structextends (#1866) 2024-05-06 10:31:43 +02:00
Andreas Süßenbach c1fb25264d
Extend compilers used in workflows on macos and ubuntu (#1863) 2024-05-02 15:51:07 +02:00
Andreas Süßenbach 2d42465f64
Minor cleanup on fence and event handling in two RAII-samples. (#1859) 2024-05-02 09:37:29 +02:00
Andreas Süßenbach 48b5595082
Simplified handling of struct aliases (#1858) 2024-05-02 09:28:44 +02:00
Andreas Süßenbach da28afe109
Simplify alias handling for handles. (#1857) 2024-04-30 09:12:25 +02:00
Sharadh Rajaraman 79307b6253
Check value of `VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL` instead of existence (#1856)
* Check value of VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL instead of existence

* Also change vulkansc.cppm
2024-04-29 08:59:01 +02:00
Andreas Süßenbach 1de6e89eb2
Explicitly set the copy/move constructors/assignment operators of vk::handle to be default; add static assert on is_copy_constructible for vk::handles (#1852) 2024-04-25 13:30:52 +02:00
Andreas Süßenbach 42a688eb5f
Change CI on MacOS to use macos-12, instead of macos-latest, which is MacOS 14 Arm64, which is a change in architecture (#1853) 2024-04-25 08:27:58 +02:00
Andreas Süßenbach 7bd57c7290
Simplify handling of enum aliases (#1850) 2024-04-24 08:33:25 +02:00
github-actions[bot] 2fbc146fee
Update Vulkan-Headers to v1.3.283 (#1849)
Co-authored-by: GitHub <noreply@github.com>
2024-04-22 13:45:11 +02:00
Andreas Süßenbach 0eafe7e55a
Fix name of enum values with more than one "BIT" in its name (#1848) 2024-04-18 16:11:14 +02:00
github-actions[bot] 4bf2835dd1
Update Vulkan-Headers to v1.3.282 (#1846)
Co-authored-by: GitHub <noreply@github.com>
2024-04-15 16:55:23 +02:00
Andreas Süßenbach 11121e142a
Simplified constant alias handling (#1845) 2024-04-15 10:18:02 +02:00
Andrew H. Cox df42194eec
Fixed Validation Error for Zero MaxImageCount (#1844)
Correctly handle a zero max image count in VkSurfaceCapabilitiesKHR
which indicates no upper limit to the number of images in a swapchain.
Fixes validation error VUID-VkSwapchainCreateInfoKHR-minImageCount-01271
2024-04-11 08:44:50 +02:00
Andreas Süßenbach 3134b1b42a
Simplify alias handling for Bitmasks and Commands. (#1843) 2024-04-11 08:43:15 +02:00
Andreas Süßenbach ed5b48b517
Pay attention to struct aliases to determine struct dependencies. (#1842) 2024-04-08 18:00:46 +02:00
Andreas Süßenbach bb66ad3b04
Moved some implementation details into namespace detail. (#1840) 2024-04-08 11:40:53 +02:00
Andreas Süßenbach 4e9c7ec4c3
Add SFIXED5 as valid value for numericFormat in format::component. (#1841) 2024-04-04 08:18:15 +02:00
Andreas Süßenbach d111d68be8
Simplify handling of enum value aliases (#1838) 2024-04-03 08:29:10 +02:00
Andreas Süßenbach 8c9901c072
Extend finding an enum value to also look for the aliases. (#1839) 2024-04-02 13:25:52 +02:00
Rageking8 268fb77fb5
Minor edits to README (#1832)
* Minor edits to README

* Address feedback and perform another edit pass on README
2024-03-26 08:39:42 +01:00
Andreas Süßenbach a7ac08b8d2
Guard type trait CppType to map from VkHandle to vk::Handle by ( VK_USE_64_BIT_PTR_DEFINES == 1 ). (#1836) 2024-03-25 14:00:43 +01:00
github-actions[bot] 88d508b32f
Update Vulkan-Headers to v1.3.281 (#1834)
Co-authored-by: GitHub <noreply@github.com>
2024-03-25 13:50:59 +01:00
Andreas Süßenbach 89dd8393db
Refactored storing of enum values. (#1831) 2024-03-25 10:47:09 +01:00
Andreas Süßenbach ce84c37abf
Reorganized enum value alias handling. (#1830) 2024-03-21 08:05:15 +01:00
Andreas Süßenbach 194708b54c
Extent type trait vk::CppType to map from VkHandle to vk::Handle (#1829) 2024-03-19 14:07:03 +01:00
Shahbaz Youssefi d058397410
Add missing glslang headers (#1827) 2024-03-19 09:08:53 +01:00
Andreas Süßenbach 19f90f043f
Removed an invalid error check on structs. (#1828) 2024-03-18 12:11:31 +01:00
Andreas Süßenbach 695de1bc3a
Fix messages in checkExtensionCorrectness (#1826) 2024-03-11 11:56:56 +01:00
github-actions[bot] e35acfe752
Update Vulkan-Headers to v1.3.280 (#1824)
Co-authored-by: GitHub <noreply@github.com>
2024-03-11 11:50:46 +01:00
David Ryskalczyk 17226363e7
Fix for VULKAN_HPP_TYPESAFE_CONVERSION defined to 0 (#1806)
* Fix for VULKAN_HPP_TYPESAFE_CONVERSION defined to 0

* Remove the check if VULKAN_HPP_TYPESAFE_CONVERSION actually is defined, just check if it's 1.

---------

Co-authored-by: asuessenbach <asuessenbach@nvidia.com>
2024-03-11 09:39:39 +01:00
Andreas Süßenbach 80826e4001
Switched from using "typedef" to using "using". (#1823) 2024-03-11 09:37:43 +01:00
Andreas Süßenbach 2b35399a73
Remove unnecessary static_casts on vk::Results. (#1822) 2024-03-06 08:54:20 +01:00
Andreas Süßenbach 5e7649dcb5
Simplified generation of lists of arguments or initializers (#1821) 2024-03-05 08:16:22 +01:00
github-actions[bot] 6fb8def272
Update Vulkan-Headers to v1.3.279 (#1819)
Co-authored-by: GitHub <noreply@github.com>
2024-03-04 13:52:45 +01:00
Andreas Süßenbach 85daa22a04
Relax requirements on FlagBits types. (#1817) 2024-02-29 08:26:01 +01:00
Andreas Süßenbach 73f210a604
Three fixes: (#1816)
- do not create enhanced struct constructors, if the length of an array is determined by a member of that struct that is a pointer;
- check for error if a command parameter has a len attribute, but is not a pointer
- accept sync access and sync stage to be multiply aliased.
2024-02-28 13:04:56 +01:00
Andreas Süßenbach 789c215e74
Accept multiple XML <formats> tags. (#1814) 2024-02-26 15:38:33 +01:00
Andreas Süßenbach 29723f90a1
Update Vulkan-Headers to v1.3.278 (#1810) 2024-02-19 22:00:57 +01:00
Andreas Süßenbach 4c130b9051
Switch from using strncpy to strncpy_s. (#1809) 2024-02-19 16:06:28 +01:00
Andreas Süßenbach 38e3e8f800
Fix ordering determination of structs. (#1807) 2024-02-19 12:35:54 +01:00
Nikolai Siukosev f1a38ff729
Disabled `vk::raii::exchange()` implementation for C++14 or newer (#1803)
* Disabled `vk::raii::exchange()` implementation for C++14 or newer. Replaced with `using std::exchange`

* Regenerated raii headers
2024-02-15 08:35:02 +01:00
Andreas Süßenbach 982afd2929
Special handling for command vkGetDeviceFaultInfoEXT: changed return type from ResultValue to ResultValueType (#1800) 2024-02-08 15:30:36 +01:00
Andreas Süßenbach 7a048a0cc7
Fix issue with vk::StructureChain::assign: use auto, instead of void *, to also support structures with const void * as type for pNext. (#1799) 2024-02-08 12:32:57 +01:00
Andreas Süßenbach c74c22fb77
Use some special handling for struct vk::DeviceFaultInfoEXT (#1796) 2024-02-08 11:40:27 +01:00
Andreas Süßenbach 9a8dda30d5
add missing include files in vulkan_video.hpp (#1795) 2024-02-06 21:10:30 +01:00
Andreas Süßenbach 525429d181
Add building of vulkan_video.hpp to default build process. (#1793) 2024-02-06 15:11:31 +01:00
Andreas Süßenbach a3ecb02131
Downgrade missing attribute "type" in enums in video.xml from error to warning (#1792) 2024-02-06 13:17:39 +01:00
Andreas Süßenbach 1b6ea3c295
Resolve warning on multiple len usage in struct VkVideoDecodeAV1PictureInfoKHR (#1791) 2024-02-06 13:16:16 +01:00
Andreas Süßenbach 9fa4459c50
Add special handling for call sequence in commands for vkGetDeviceFaultInfoEXT (#1790) 2024-02-05 15:44:40 +01:00
Andreas Süßenbach 6bdba3ef31
Add support for command argument attribute "len" with value "1". (#1789) 2024-02-05 13:13:38 +01:00
mirefly42 fdf975364b
Fix typo in vk_raii_ProgrammingGuide.md (#1780) 2024-02-05 12:21:49 +01:00
226 changed files with 201127 additions and 220927 deletions

View File

@ -44,6 +44,7 @@ BraceWrapping :
SplitEmptyNamespace : true
BreakBeforeBinaryOperators : None
BreakBeforeBraces : Custom
BreakBeforeConceptDeclarations : Always
BreakBeforeTernaryOperators : true
BreakConstructorInitializers : BeforeComma
BreakInheritanceList : BeforeComma

View File

@ -45,6 +45,7 @@ BraceWrapping :
SplitEmptyNamespace : true
BreakBeforeBinaryOperators : None
BreakBeforeBraces : Custom
BreakBeforeConceptDeclarations : Always
BreakBeforeTernaryOperators : true
BreakConstructorInitializers : BeforeComma
BreakInheritanceList : BeforeComma

View File

@ -44,6 +44,8 @@ BraceWrapping :
SplitEmptyNamespace : true
BreakBeforeBinaryOperators : None
BreakBeforeBraces : Custom
# BreakBeforeConceptDeclarations seems to be a boolean with clang-format 14 ?!?
BreakBeforeConceptDeclarations : true
BreakBeforeTernaryOperators : true
BreakConstructorInitializers : BeforeComma
BreakInheritanceList : BeforeComma

View File

@ -44,6 +44,7 @@ BraceWrapping :
SplitEmptyNamespace : true
BreakBeforeBinaryOperators : None
BreakBeforeBraces : Custom
BreakBeforeConceptDeclarations : Always
BreakBeforeTernaryOperators : true
BreakConstructorInitializers : BeforeComma
BreakInheritanceList : BeforeComma

122
.clang-format_16 Normal file
View File

@ -0,0 +1,122 @@
---
AccessModifierOffset : -2
AlignAfterOpenBracket : Align
AlignArrayOfStructures : None
AlignConsecutiveAssignments : Consecutive
AlignConsecutiveBitFields : Consecutive
AlignConsecutiveDeclarations : Consecutive
AlignConsecutiveMacros : Consecutive
AlignEscapedNewlines : Left
AlignOperands : AlignAfterOperator
AlignTrailingComments :
Kind : Always
OverEmptyLines : 0
AllowAllArgumentsOnNextLine : true
AllowAllParametersOfDeclarationOnNextLine : true
AllowShortBlocksOnASingleLine : Empty
AllowShortCaseLabelsOnASingleLine : true
AllowShortEnumsOnASingleLine : true
AllowShortFunctionsOnASingleLine : Empty
AllowShortIfStatementsOnASingleLine : Never
AllowShortLambdasOnASingleLine : All
AllowShortLoopsOnASingleLine : false
AlwaysBreakAfterReturnType : None
AlwaysBreakBeforeMultilineStrings : true
AlwaysBreakTemplateDeclarations : Yes
BinPackArguments : false
BinPackParameters : false
BitFieldColonSpacing : Both
BraceWrapping :
AfterCaseLabel : true
AfterClass : true
AfterControlStatement : Always
AfterEnum : true
AfterFunction : true
AfterNamespace : true
AfterStruct : true
AfterUnion : true
AfterExternBlock : true
BeforeCatch : true
BeforeElse : true
BeforeLambdaBody : true
BeforeWhile : false
IndentBraces : false
SplitEmptyFunction : true
SplitEmptyRecord : true
SplitEmptyNamespace : true
BreakAfterAttributes: Leave
BreakBeforeBinaryOperators : None
BreakBeforeBraces : Custom
BreakBeforeConceptDeclarations : Always
BreakBeforeInlineASMColon : OnlyMultiline
BreakBeforeTernaryOperators : true
BreakConstructorInitializers : BeforeComma
BreakInheritanceList : BeforeComma
BreakStringLiterals : false
ColumnLimit : 160
CompactNamespaces : false
ConstructorInitializerIndentWidth : 2
ContinuationIndentWidth : 2
Cpp11BracedListStyle : false
EmptyLineAfterAccessModifier : Never
EmptyLineBeforeAccessModifier : LogicalBlock
FixNamespaceComments : true
IncludeBlocks : Regroup
IndentAccessModifiers : false
IndentCaseBlocks : true
IndentCaseLabels : true
IndentExternBlock : true
IndentPPDirectives : AfterHash
IndentRequiresClause : false
IndentWidth : 2
IndentWrappedFunctionNames : true
InsertBraces : false
InsertNewlineAtEOF : true
IntegerLiteralSeparator :
Binary : 4
Decimal : 0
Hex : 0
KeepEmptyLinesAtTheStartOfBlocks : false
LambdaBodyIndentation : Signature
MaxEmptyLinesToKeep : 1
NamespaceIndentation : All
PackConstructorInitializers : NextLine
PPIndentWidth : -1
PointerAlignment : Middle
ReferenceAlignment : Pointer
ReflowComments : true
RemoveBracesLLVM : false
RequiresClausePosition : OwnLine
RequiresExpressionIndentation : Keyword
SeparateDefinitionBlocks : Always
ShortNamespaceLines : 0
SortIncludes : true
SortUsingDeclarations : true
SpaceAfterCStyleCast : false
SpaceAfterLogicalNot : false
SpaceAfterTemplateKeyword : true
SpaceAroundPointerQualifiers : Both
SpaceBeforeAssignmentOperators : true
SpaceBeforeCaseColon : false
SpaceBeforeCpp11BracedList : false
SpaceBeforeCtorInitializerColon : true
SpaceBeforeInheritanceColon : true
SpaceBeforeParens : ControlStatements
SpaceBeforeRangeBasedForLoopColon : true
SpaceBeforeSquareBrackets : false
SpaceInEmptyBlock : false
SpaceInEmptyParentheses : false
SpacesBeforeTrailingComments : 2
SpacesInAngles : false
SpacesInCStyleCastParentheses : false
SpacesInConditionalStatement : true
SpacesInContainerLiterals : false
SpacesInLineCommentPrefix :
Minimum : 1
Maximum : -1
SpacesInParentheses : true
SpacesInSquareBrackets : false
Standard : Latest
UseCRLF : true
UseTab : Never
...

131
.clang-format_17 Normal file
View File

@ -0,0 +1,131 @@
---
AccessModifierOffset : -2
AlignAfterOpenBracket : Align
AlignArrayOfStructures : None
AlignConsecutiveAssignments : Consecutive
AlignConsecutiveBitFields : Consecutive
AlignConsecutiveShortCaseStatements :
Enabled : true
AcrossEmptyLines : false
AcrossComments : true
AlignCaseColons : true
AlignConsecutiveDeclarations : Consecutive
AlignConsecutiveMacros : Consecutive
AlignEscapedNewlines : Left
AlignOperands : AlignAfterOperator
AlignTrailingComments :
Kind : Always
OverEmptyLines : 0
AllowAllArgumentsOnNextLine : true
AllowAllParametersOfDeclarationOnNextLine : true
AllowShortBlocksOnASingleLine : Empty
AllowShortCaseLabelsOnASingleLine : true
AllowShortEnumsOnASingleLine : true
AllowShortFunctionsOnASingleLine : Empty
AllowShortIfStatementsOnASingleLine : Never
AllowShortLambdasOnASingleLine : All
AllowShortLoopsOnASingleLine : false
AlwaysBreakAfterReturnType : None
AlwaysBreakBeforeMultilineStrings : true
AlwaysBreakTemplateDeclarations : Yes
BinPackArguments : false
BinPackParameters : false
BitFieldColonSpacing : Both
BracedInitializerIndentWidth : 2
BraceWrapping :
AfterCaseLabel : true
AfterClass : true
AfterControlStatement : Always
AfterEnum : true
AfterFunction : true
AfterNamespace : true
AfterStruct : true
AfterUnion : true
AfterExternBlock : true
BeforeCatch : true
BeforeElse : true
BeforeLambdaBody : true
BeforeWhile : false
IndentBraces : false
SplitEmptyFunction : true
SplitEmptyRecord : true
SplitEmptyNamespace : true
BreakAfterAttributes: Leave
BreakBeforeBinaryOperators : None
BreakBeforeBraces : Custom
BreakBeforeConceptDeclarations : Always
BreakBeforeInlineASMColon : OnlyMultiline
BreakBeforeTernaryOperators : true
BreakConstructorInitializers : BeforeComma
BreakInheritanceList : BeforeComma
BreakStringLiterals : false
ColumnLimit : 160
CompactNamespaces : false
ConstructorInitializerIndentWidth : 2
ContinuationIndentWidth : 2
Cpp11BracedListStyle : false
EmptyLineAfterAccessModifier : Never
EmptyLineBeforeAccessModifier : LogicalBlock
FixNamespaceComments : true
IncludeBlocks : Regroup
IndentAccessModifiers : false
IndentCaseBlocks : true
IndentCaseLabels : true
IndentExternBlock : true
IndentPPDirectives : AfterHash
IndentRequiresClause : false
IndentWidth : 2
IndentWrappedFunctionNames : true
InsertBraces : false
InsertNewlineAtEOF : true
IntegerLiteralSeparator :
Binary : 4
Decimal : 0
Hex : 0
KeepEmptyLinesAtTheStartOfBlocks : false
LambdaBodyIndentation : Signature
MaxEmptyLinesToKeep : 1
NamespaceIndentation : All
PackConstructorInitializers : NextLine
PPIndentWidth : -1
PointerAlignment : Middle
ReferenceAlignment : Pointer
ReflowComments : true
RemoveBracesLLVM : false
RequiresClausePosition : OwnLine
RequiresExpressionIndentation : Keyword
SeparateDefinitionBlocks : Always
ShortNamespaceLines : 0
SortIncludes : true
SortUsingDeclarations : true
SpaceAfterCStyleCast : false
SpaceAfterLogicalNot : false
SpaceAfterTemplateKeyword : true
SpaceAroundPointerQualifiers : Both
SpaceBeforeAssignmentOperators : true
SpaceBeforeCaseColon : false
SpaceBeforeCpp11BracedList : false
SpaceBeforeCtorInitializerColon : true
SpaceBeforeInheritanceColon : true
SpaceBeforeParens : ControlStatements
SpaceBeforeRangeBasedForLoopColon : true
SpaceBeforeSquareBrackets : false
SpaceInEmptyBlock : false
SpaceInEmptyParentheses : false
SpacesBeforeTrailingComments : 2
SpacesInAngles : false
SpacesInContainerLiterals : false
SpacesInLineCommentPrefix :
Minimum : 1
Maximum : -1
SpacesInParens : Custom
SpacesInParensOptions :
InConditionalStatements : true
InCStyleCasts : false
InEmptyParentheses : false
Other : true
SpacesInSquareBrackets : false
Standard : Latest
UseCRLF : true
UseTab : Never
...

134
.clang-format_18 Normal file
View File

@ -0,0 +1,134 @@
---
AccessModifierOffset : -2
AlignAfterOpenBracket : Align
AlignArrayOfStructures : None
AlignConsecutiveAssignments : Consecutive
AlignConsecutiveBitFields : Consecutive
AlignConsecutiveShortCaseStatements :
Enabled : true
AcrossEmptyLines : false
AcrossComments : true
AlignCaseColons : true
AlignConsecutiveDeclarations : Consecutive
AlignConsecutiveMacros : Consecutive
AlignEscapedNewlines : Left
AlignOperands : AlignAfterOperator
AlignTrailingComments :
Kind : Always
OverEmptyLines : 0
AllowAllArgumentsOnNextLine : true
AllowAllParametersOfDeclarationOnNextLine : true
AllowBreakBeforeNoexceptSpecifier : Always
AllowShortBlocksOnASingleLine : Empty
AllowShortCaseLabelsOnASingleLine : true
AllowShortCompoundRequirementOnASingleLine : true
AllowShortEnumsOnASingleLine : true
AllowShortFunctionsOnASingleLine : Empty
AllowShortIfStatementsOnASingleLine : Never
AllowShortLambdasOnASingleLine : All
AllowShortLoopsOnASingleLine : false
AlwaysBreakAfterReturnType : None
AlwaysBreakBeforeMultilineStrings : true
AlwaysBreakTemplateDeclarations : Yes
BinPackArguments : false
BinPackParameters : false
BitFieldColonSpacing : Both
BracedInitializerIndentWidth : 2
BraceWrapping :
AfterCaseLabel : true
AfterClass : true
AfterControlStatement : Always
AfterEnum : true
AfterFunction : true
AfterNamespace : true
AfterStruct : true
AfterUnion : true
AfterExternBlock : true
BeforeCatch : true
BeforeElse : true
BeforeLambdaBody : true
BeforeWhile : false
IndentBraces : false
SplitEmptyFunction : true
SplitEmptyRecord : true
SplitEmptyNamespace : true
BreakAdjacentStringLiterals : false
BreakAfterAttributes: Leave
BreakBeforeBinaryOperators : None
BreakBeforeBraces : Custom
BreakBeforeConceptDeclarations : Always
BreakBeforeInlineASMColon : OnlyMultiline
BreakBeforeTernaryOperators : true
BreakConstructorInitializers : BeforeComma
BreakInheritanceList : BeforeComma
BreakStringLiterals : false
ColumnLimit : 160
CompactNamespaces : false
ConstructorInitializerIndentWidth : 2
ContinuationIndentWidth : 2
Cpp11BracedListStyle : false
EmptyLineAfterAccessModifier : Never
EmptyLineBeforeAccessModifier : LogicalBlock
FixNamespaceComments : true
IncludeBlocks : Regroup
IndentAccessModifiers : false
IndentCaseBlocks : true
IndentCaseLabels : true
IndentExternBlock : true
IndentPPDirectives : AfterHash
IndentRequiresClause : false
IndentWidth : 2
IndentWrappedFunctionNames : true
InsertBraces : false
InsertNewlineAtEOF : true
IntegerLiteralSeparator :
Binary : 4
Decimal : 0
Hex : 0
KeepEmptyLinesAtTheStartOfBlocks : false
LambdaBodyIndentation : Signature
MaxEmptyLinesToKeep : 1
NamespaceIndentation : All
PackConstructorInitializers : NextLine
PPIndentWidth : -1
PointerAlignment : Middle
ReferenceAlignment : Pointer
ReflowComments : true
RemoveBracesLLVM : false
RequiresClausePosition : OwnLine
RequiresExpressionIndentation : Keyword
SeparateDefinitionBlocks : Always
ShortNamespaceLines : 0
SortIncludes : true
SortUsingDeclarations : true
SpaceAfterCStyleCast : false
SpaceAfterLogicalNot : false
SpaceAfterTemplateKeyword : true
SpaceAroundPointerQualifiers : Both
SpaceBeforeAssignmentOperators : true
SpaceBeforeCaseColon : false
SpaceBeforeCpp11BracedList : false
SpaceBeforeCtorInitializerColon : true
SpaceBeforeInheritanceColon : true
SpaceBeforeParens : ControlStatements
SpaceBeforeRangeBasedForLoopColon : true
SpaceBeforeSquareBrackets : false
SpaceInEmptyBlock : false
SpaceInEmptyParentheses : false
SpacesBeforeTrailingComments : 2
SpacesInAngles : false
SpacesInContainerLiterals : false
SpacesInLineCommentPrefix :
Minimum : 1
Maximum : -1
SpacesInParens : Custom
SpacesInParensOptions :
InConditionalStatements : true
InCStyleCasts : false
InEmptyParentheses : false
Other : true
SpacesInSquareBrackets : false
Standard : Latest
UseCRLF : true
UseTab : Never
...

View File

@ -0,0 +1,52 @@
name: Self-hosted Linux
on:
pull_request:
branches: [ main ]
jobs:
build:
runs-on: [self-hosted, linux]
defaults:
run:
shell: bash
strategy:
matrix:
compiler: [clang++-16, clang++-17, clang++-18, g++-12, g++-13, g++-14]
cpp_standard: [11, 14, 17, 20, 23]
build_type: [Debug, Release]
exclude:
- cpp_standard: 23
compiler: clang++-17 # clang++-17 gives some strange errors in std::tuple !
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install libraries
run: sudo apt update && sudo apt install libgl-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev
- name: Install Ninja
uses: ashutoshvarma/setup-ninja@master
with:
version: 1.11.0
- name: Build
run: |
modules_flag=${{(contains(fromJSON('["clang++-16", "g++-12", "g++-13", "g++-14"]'), matrix.compiler) || matrix.cpp_standard < 20) && 'OFF' || 'ON'}}
cmake -B build/${{matrix.cpp_standard}}/${{matrix.build_type}} -GNinja \
-DVULKAN_HPP_SAMPLES_BUILD=ON \
-DVULKAN_HPP_TESTS_BUILD=ON \
-DVULKAN_HPP_ENABLE_CPP20_MODULES=$modules_flag \
-DVULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
-DVULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
-DVULKAN_HPP_PRECOMPILE=OFF \
-DVULKAN_HPP_RUN_GENERATOR=ON \
-DCMAKE_CXX_COMPILER=${{matrix.compiler}} \
-DCMAKE_CXX_STANDARD=${{matrix.cpp_standard}} \
-DCMAKE_BUILD_TYPE=${{matrix.build_type}}
cmake --build build/${{matrix.cpp_standard}}/${{matrix.build_type}} --parallel

View File

@ -7,11 +7,12 @@ on:
jobs:
build:
runs-on: macos-latest
runs-on: ${{matrix.os}}
strategy:
matrix:
compiler: [clang++, g++-11]
os: [macos-14, macos-15]
compiler: [clang++]
steps:
- uses: actions/checkout@v4
@ -26,24 +27,91 @@ jobs:
uses: ashutoshvarma/setup-ninja@master
with:
version: 1.11.0
- name: Loop over cpp_standards (11, 14, ...) and build_types (Debug, Release)
- name: Install glm, glfw and glslang
run: |
for cpp_standard in 11 14 17 20 23
do
for build_type in Debug Release
do
cmake -B build/$cpp_standard/$build_type -GNinja \
-DVULKAN_HPP_SAMPLES_BUILD=ON \
-DVULKAN_HPP_SAMPLES_BUILD_ONLY_DYNAMIC=ON \
-DVULKAN_HPP_TESTS_BUILD=ON \
-DVULKAN_HPP_TESTS_BUILD_ONLY_DYNAMIC=ON \
-DVULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
-DVULKAN_HPP_PRECOMPILE=OFF \
-DVULKAN_HPP_RUN_GENERATOR=ON \
-DCMAKE_CXX_COMPILER=${{matrix.compiler}} \
-DCMAKE_CXX_STANDARD=$cpp_standard \
-DCMAKE_BUILD_TYPE=$build_type
cmake --build build/$cpp_standard/$build_type --parallel
cd glm
cmake -B build -G Ninja \
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
-D CMAKE_CXX_STANDARD=11 \
-D CMAKE_BUILD_TYPE=Release \
-D GLM_BUILD_LIBRARY=ON \
-D GLM_BUILD_INSTALL=ON \
-D GLM_BUILD_TESTS=OFF
cmake --build build --parallel
sudo cmake --install build
cd ../glfw
cmake -B build -G Ninja \
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
-D CMAKE_CXX_STANDARD=11 \
-D CMAKE_BUILD_TYPE=Release \
-D GLFW_BUILD_EXAMPLES=OFF \
-D GLFW_BUILD_TESTS=OFF \
-D GLFW_BUILD_DOCS=OFF \
-D GLFW_INSTALL=ON
cmake --build build --parallel
sudo cmake --install build
cd ../glslang
cmake -B build -G Ninja \
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
-D CMAKE_CXX_STANDARD=11 \
-D CMAKE_BUILD_TYPE=Release \
-D ENABLE_OPT=OFF \
-D GLSLANG_TESTS_DEFAULT=OFF \
-D GLSLANG_ENABLE_INSTALL_DEFAULT=ON
cmake --build build --parallel
sudo cmake --install build
cd ..
- name: Generate headers
run: |
cmake -B build -G Ninja \
-D VULKAN_HPP_GENERATOR_BUILD=ON \
-D VULKAN_HPP_RUN_GENERATOR=OFF \
-D VULKAN_HPP_SAMPLES_BUILD=OFF \
-D VULKAN_HPP_TESTS_BUILD=OFF \
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
-D VULKAN_HPP_PRECOMPILE=OFF \
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
-D CMAKE_CXX_STANDARD=20 \
-D CMAKE_BUILD_TYPE=Debug
cmake --build build --parallel
cmake -B build -G Ninja --fresh \
-D VULKAN_HPP_GENERATOR_BUILD=ON \
-D VULKAN_HPP_RUN_GENERATOR=ON \
-D VULKAN_HPP_SAMPLES_BUILD=OFF \
-D VULKAN_HPP_TESTS_BUILD=OFF \
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
-D VULKAN_HPP_PRECOMPILE=OFF \
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
-D CMAKE_CXX_STANDARD=20 \
-D CMAKE_BUILD_TYPE=Release
cmake --build build --parallel --clean-first
- name: Build samples and tests
run: |
for CXX_STANDARD in 11 14 17 20 23; do
for BUILD_TYPE in Debug Release; do
echo "================================================================================="
echo "Building C++$CXX_STANDARD in $BUILD_TYPE"
echo "================================================================================="
cmake -B build -G Ninja --fresh \
-D VULKAN_HPP_GENERATOR_BUILD=OFF \
-D VULKAN_HPP_RUN_GENERATOR=OFF \
-D VULKAN_HPP_SAMPLES_BUILD=ON \
-D VULKAN_HPP_TESTS_BUILD=ON \
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
-D VULKAN_HPP_PRECOMPILE=OFF \
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
-D CMAKE_CXX_STANDARD=$CXX_STANDARD \
-D CMAKE_BUILD_TYPE=$BUILD_TYPE
cmake --build build --parallel --clean-first
done
done

125
.github/workflows/ci-ubuntu-22.yml vendored Normal file
View File

@ -0,0 +1,125 @@
name: CI Ubuntu 22
on:
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
strategy:
matrix:
compiler: [clang++-13, clang++-14, clang++-15, g++-10, g++-11]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install libraries
run: sudo apt update && sudo apt install libgl-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev
- name: Install Ninja
uses: ashutoshvarma/setup-ninja@master
with:
version: 1.11.0
- name: Install glm, glfw and glslang
run: |
cd glm
cmake -B build -G Ninja \
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
-D CMAKE_CXX_STANDARD=11 \
-D CMAKE_BUILD_TYPE=Release \
-D GLM_BUILD_LIBRARY=ON \
-D GLM_BUILD_INSTALL=ON \
-D GLM_BUILD_TESTS=OFF
cmake --build build --parallel
sudo cmake --install build
cd ../glfw
cmake -B build -G Ninja \
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
-D CMAKE_CXX_STANDARD=11 \
-D CMAKE_BUILD_TYPE=Release \
-D GLFW_BUILD_EXAMPLES=OFF \
-D GLFW_BUILD_TESTS=OFF \
-D GLFW_BUILD_DOCS=OFF \
-D GLFW_INSTALL=ON
cmake --build build --parallel
sudo cmake --install build
cd ../glslang
cmake -B build -G Ninja \
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
-D CMAKE_CXX_STANDARD=11 \
-D CMAKE_BUILD_TYPE=Release \
-D ENABLE_OPT=OFF \
-D GLSLANG_TESTS_DEFAULT=OFF \
-D GLSLANG_ENABLE_INSTALL_DEFAULT=ON
cmake --build build --parallel
sudo cmake --install build
cd ..
- name: Generate headers
run: |
cmake -B build -G Ninja \
-D VULKAN_HPP_GENERATOR_BUILD=ON \
-D VULKAN_HPP_RUN_GENERATOR=OFF \
-D VULKAN_HPP_SAMPLES_BUILD=OFF \
-D VULKAN_HPP_TESTS_BUILD=OFF \
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
-D VULKAN_HPP_PRECOMPILE=OFF \
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
-D CMAKE_CXX_STANDARD=20 \
-D CMAKE_BUILD_TYPE=Debug
cmake --build build --parallel
cmake -B build -G Ninja --fresh \
-D VULKAN_HPP_GENERATOR_BUILD=ON \
-D VULKAN_HPP_RUN_GENERATOR=ON \
-D VULKAN_HPP_SAMPLES_BUILD=OFF \
-D VULKAN_HPP_TESTS_BUILD=OFF \
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
-D VULKAN_HPP_PRECOMPILE=OFF \
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
-D CMAKE_CXX_STANDARD=20 \
-D CMAKE_BUILD_TYPE=Release
cmake --build build --parallel --clean-first
- name: Build samples and tests
run: |
for CXX_STANDARD in 11 14 17 20 23; do
for BUILD_TYPE in Debug Release; do
if [ ${{matrix.compiler}} == g++-10 ]; then
if [ $CXX_STANDARD == 20 ] || [ $CXX_STANDARD == 23 ]; then
continue
fi
fi
echo "================================================================================="
echo "Building C++$CXX_STANDARD in $BUILD_TYPE"
echo "================================================================================="
cmake -B build -G Ninja --fresh \
-D VULKAN_HPP_GENERATOR_BUILD=OFF \
-D VULKAN_HPP_RUN_GENERATOR=OFF \
-D VULKAN_HPP_SAMPLES_BUILD=ON \
-D VULKAN_HPP_TESTS_BUILD=ON \
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
-D VULKAN_HPP_PRECOMPILE=OFF \
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
-D CMAKE_CXX_STANDARD=$CXX_STANDARD \
-D CMAKE_BUILD_TYPE=$BUILD_TYPE
cmake --build build --parallel --clean-first
done
done

130
.github/workflows/ci-ubuntu-24.yml vendored Normal file
View File

@ -0,0 +1,130 @@
name: CI Ubuntu 24
on:
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-24.04
defaults:
run:
shell: bash
strategy:
matrix:
compiler: [clang++-16, clang++-17, clang++-18, g++-12, g++-13, g++-14]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install libraries
run: sudo apt update && sudo apt install libgl-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev
- name: Install Ninja
uses: ashutoshvarma/setup-ninja@master
with:
version: 1.11.0
- name: Install glm, glfw and glslang
run: |
cd glm
cmake -B build -G Ninja \
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
-D CMAKE_CXX_STANDARD=11 \
-D CMAKE_BUILD_TYPE=Release \
-D GLM_BUILD_LIBRARY=ON \
-D GLM_BUILD_INSTALL=ON \
-D GLM_BUILD_TESTS=OFF
cmake --build build --parallel
sudo cmake --install build
cd ../glfw
cmake -B build -G Ninja \
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
-D CMAKE_CXX_STANDARD=11 \
-D CMAKE_BUILD_TYPE=Release \
-D GLFW_BUILD_EXAMPLES=OFF \
-D GLFW_BUILD_TESTS=OFF \
-D GLFW_BUILD_DOCS=OFF \
-D GLFW_INSTALL=ON
cmake --build build --parallel
sudo cmake --install build
cd ../glslang
cmake -B build -G Ninja \
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
-D CMAKE_CXX_STANDARD=11 \
-D CMAKE_BUILD_TYPE=Release \
-D ENABLE_OPT=OFF \
-D GLSLANG_TESTS_DEFAULT=OFF \
-D GLSLANG_ENABLE_INSTALL_DEFAULT=ON
cmake --build build --parallel
sudo cmake --install build
cd ..
- name: Generate headers
run: |
cmake -B build -G Ninja \
-D VULKAN_HPP_GENERATOR_BUILD=ON \
-D VULKAN_HPP_RUN_GENERATOR=OFF \
-D VULKAN_HPP_SAMPLES_BUILD=OFF \
-D VULKAN_HPP_TESTS_BUILD=OFF \
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
-D VULKAN_HPP_PRECOMPILE=OFF \
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
-D CMAKE_CXX_STANDARD=20 \
-D CMAKE_BUILD_TYPE=Debug
cmake --build build --parallel
cmake -B build -G Ninja --fresh \
-D VULKAN_HPP_GENERATOR_BUILD=ON \
-D VULKAN_HPP_RUN_GENERATOR=ON \
-D VULKAN_HPP_SAMPLES_BUILD=OFF \
-D VULKAN_HPP_TESTS_BUILD=OFF \
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
-D VULKAN_HPP_PRECOMPILE=OFF \
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
-D CMAKE_CXX_STANDARD=20 \
-D CMAKE_BUILD_TYPE=Release
cmake --build build --parallel --clean-first
- name: Build samples and tests
run: |
for CXX_STANDARD in 11 14 17 20 23; do
for BUILD_TYPE in Debug Release; do
if [ ${{matrix.compiler}} == clang++-17 ] && [ $CXX_STANDARD == 23 ]; then
continue
fi
CXX_MODULES=ON
for compiler in "clang++-16" "g++-12" "g++-13" "g++-14"; do
if [ ${{matrix.compiler}} == $compiler ] || [ $CXX_STANDARD -lt 20 ]; then
CXX_MODULES=OFF
fi
done
echo "================================================================================="
echo "Building C++$CXX_STANDARD in $BUILD_TYPE"
echo "================================================================================="
cmake -B build -G Ninja --fresh \
-D VULKAN_HPP_GENERATOR_BUILD=OFF \
-D VULKAN_HPP_RUN_GENERATOR=OFF \
-D VULKAN_HPP_SAMPLES_BUILD=ON \
-D VULKAN_HPP_TESTS_BUILD=ON \
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
-D VULKAN_HPP_PRECOMPILE=OFF \
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
-D CMAKE_CXX_STANDARD=$CXX_STANDARD \
-D CMAKE_BUILD_TYPE=$BUILD_TYPE
cmake --build build --parallel --clean-first
done
done

136
.github/workflows/ci-ubuntu-ext.yml vendored Normal file
View File

@ -0,0 +1,136 @@
name: CI Ubuntu EXT
on:
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-24.04
defaults:
run:
shell: bash
strategy:
matrix:
clang_version: [19, 20]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install libraries
run: sudo apt update && sudo apt install libgl-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev
- name: Install Ninja
uses: ashutoshvarma/setup-ninja@master
with:
version: 1.11.0
- name: Install Clang and CMake
run: |
sudo apt-get update && sudo apt-get install lsb-release gpg software-properties-common wget
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh ${{matrix.clang_version}} all
sudo apt purge --auto-remove cmake
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ noble main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null
sudo apt update && sudo apt install cmake
- name: Install glm, glfw and glslang
run: |
cd glm
cmake -B build -G Ninja \
-D CMAKE_CXX_COMPILER=clang++-${{matrix.clang_version}} \
-D CMAKE_CXX_STANDARD=11 \
-D CMAKE_BUILD_TYPE=Release \
-D GLM_BUILD_LIBRARY=ON \
-D GLM_BUILD_INSTALL=ON \
-D GLM_BUILD_TESTS=OFF
cmake --build build --parallel
sudo cmake --install build
cd ../glfw
cmake -B build -G Ninja \
-D CMAKE_CXX_COMPILER=clang++-${{matrix.clang_version}} \
-D CMAKE_CXX_STANDARD=11 \
-D CMAKE_BUILD_TYPE=Release \
-D GLFW_BUILD_EXAMPLES=OFF \
-D GLFW_BUILD_TESTS=OFF \
-D GLFW_BUILD_DOCS=OFF \
-D GLFW_INSTALL=ON
cmake --build build --parallel
sudo cmake --install build
cd ../glslang
cmake -B build -G Ninja \
-D CMAKE_CXX_COMPILER=clang++-${{matrix.clang_version}} \
-D CMAKE_CXX_STANDARD=11 \
-D CMAKE_BUILD_TYPE=Release \
-D ENABLE_OPT=OFF \
-D GLSLANG_TESTS_DEFAULT=OFF \
-D GLSLANG_ENABLE_INSTALL_DEFAULT=ON
cmake --build build --parallel
sudo cmake --install build
cd ..
- name: Generate headers
run: |
cmake -B build -G Ninja \
-D VULKAN_HPP_GENERATOR_BUILD=ON \
-D VULKAN_HPP_RUN_GENERATOR=OFF \
-D VULKAN_HPP_SAMPLES_BUILD=OFF \
-D VULKAN_HPP_TESTS_BUILD=OFF \
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
-D VULKAN_HPP_PRECOMPILE=OFF \
-D CMAKE_CXX_COMPILER=clang++-${{matrix.clang_version}} \
-D CMAKE_CXX_STANDARD=20 \
-D CMAKE_BUILD_TYPE=Debug
cmake --build build --parallel
cmake -B build -G Ninja --fresh \
-D VULKAN_HPP_GENERATOR_BUILD=ON \
-D VULKAN_HPP_RUN_GENERATOR=ON \
-D VULKAN_HPP_SAMPLES_BUILD=OFF \
-D VULKAN_HPP_TESTS_BUILD=OFF \
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
-D VULKAN_HPP_PRECOMPILE=OFF \
-D CMAKE_CXX_COMPILER=clang++-${{matrix.clang_version}} \
-D CMAKE_CXX_STANDARD=20 \
-D CMAKE_BUILD_TYPE=Release
cmake --build build --parallel --clean-first
- name: Build samples and tests
run: |
for CXX_STANDARD in 11 14 17 20 23; do
for BUILD_TYPE in Debug Release; do
CXX_MODULES=ON
if [ $CXX_STANDARD -lt 20 ]; then
CXX_MODULES=OFF
fi
echo "================================================================================="
echo "Building C++$CXX_STANDARD in $BUILD_TYPE"
echo "================================================================================="
cmake -B build -G Ninja --fresh \
-D VULKAN_HPP_GENERATOR_BUILD=OFF \
-D VULKAN_HPP_RUN_GENERATOR=OFF \
-D VULKAN_HPP_SAMPLES_BUILD=ON \
-D VULKAN_HPP_TESTS_BUILD=ON \
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
-D VULKAN_HPP_PRECOMPILE=OFF \
-D CMAKE_CXX_COMPILER=clang++-${{matrix.clang_version}} \
-D CMAKE_CXX_STANDARD=$CXX_STANDARD \
-D CMAKE_BUILD_TYPE=$BUILD_TYPE
cmake --build build --parallel --clean-first
done
done

View File

@ -1,75 +0,0 @@
name: CI Ubuntu
on:
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
matrix:
compiler: [clang++-13, clang++-14, g++-9, g++-10, g++-11]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install libraries
run: sudo apt update && sudo apt install libgl-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev
- name: Install Ninja
uses: ashutoshvarma/setup-ninja@master
with:
version: 1.11.0
- name: Loop over cpp_standards (11, 14, ...) and build_types (Debug, Release)
run: |
for cpp_standard in 11 14 17 20
do
for build_type in Debug Release
do
cmake -B build/$cpp_standard/$build_type -GNinja \
-DVULKAN_HPP_SAMPLES_BUILD=ON \
-DVULKAN_HPP_SAMPLES_BUILD_ONLY_DYNAMIC=ON \
-DVULKAN_HPP_TESTS_BUILD=ON \
-DVULKAN_HPP_TESTS_BUILD_ONLY_DYNAMIC=ON \
-DVULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
-DVULKAN_HPP_PRECOMPILE=OFF \
-DVULKAN_HPP_RUN_GENERATOR=ON \
-DCMAKE_CXX_COMPILER=${{matrix.compiler}} \
-DCMAKE_CXX_STANDARD=$cpp_standard \
-DCMAKE_BUILD_TYPE=$build_type
cmake --build build/$cpp_standard/$build_type --parallel
done
done
- name: Loop over build_types (Debug, Release) with cpp_standard 23 for g++-11 only
run: |
if [ ${{matrix.compiler}} == g++-11 ]
then
cpp_standard=23
for build_type in Debug Release
do
cmake -B build/$cpp_standard/$build_type -GNinja \
-DVULKAN_HPP_SAMPLES_BUILD=ON \
-DVULKAN_HPP_SAMPLES_BUILD_ONLY_DYNAMIC=ON \
-DVULKAN_HPP_TESTS_BUILD=ON \
-DVULKAN_HPP_TESTS_BUILD_ONLY_DYNAMIC=ON \
-DVULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
-DVULKAN_HPP_PRECOMPILE=OFF \
-DVULKAN_HPP_RUN_GENERATOR=ON \
-DCMAKE_CXX_COMPILER=${{matrix.compiler}} \
-DCMAKE_CXX_STANDARD=$cpp_standard \
-DCMAKE_BUILD_TYPE=$build_type
cmake --build build/$cpp_standard/$build_type --parallel
done
fi

118
.github/workflows/ci-windows-clang.yml vendored Normal file
View File

@ -0,0 +1,118 @@
name: CI Windows Clang
on:
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ${{matrix.os}}
defaults:
run:
shell: bash
strategy:
matrix:
os: [windows-2022, windows-2025]
architecture: [x64]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup MSVC
uses: TheMrMilchmann/setup-msvc-dev@v2
with:
arch: ${{matrix.architecture}}
# - name: Install glm, glfw and glslang
# run: |
# cd glm
# cmake -B build -G Ninja \
# -D CMAKE_CXX_COMPILER=clang-cl \
# -D CMAKE_CXX_STANDARD=11 \
# -D CMAKE_BUILD_TYPE=Release \
# -D GLM_BUILD_LIBRARY=ON \
# -D GLM_BUILD_INSTALL=ON \
# -D GLM_BUILD_TESTS=OFF
# cmake --build build --parallel
# cmake --install build
# cd ../glfw
# cmake -B build -G Ninja \
# -D CMAKE_C_COMPILER=clang-cl \
# -D CMAKE_BUILD_TYPE=Release \
# -D GLFW_BUILD_EXAMPLES=OFF \
# -D GLFW_BUILD_TESTS=OFF \
# -D GLFW_BUILD_DOCS=OFF \
# -D GLFW_INSTALL=ON
# cmake --build build --parallel
# cmake --install build
# cd ../glslang
# cmake -B build -G Ninja \
# -D CMAKE_C_COMPILER=clang-cl \
# -D CMAKE_CXX_COMPILER=clang-cl \
# -D CMAKE_CXX_STANDARD=11 \
# -D CMAKE_BUILD_TYPE=Release \
# -D ENABLE_OPT=OFF \
# -D GLSLANG_TESTS_DEFAULT=OFF \
# -D GLSLANG_ENABLE_INSTALL_DEFAULT=ON
# cmake --build build --parallel
# cmake --install build
# cd ..
- name: Generate headers
run: |
cmake -B build -G Ninja \
-D VULKAN_HPP_GENERATOR_BUILD=ON \
-D VULKAN_HPP_RUN_GENERATOR=OFF \
-D VULKAN_HPP_SAMPLES_BUILD=OFF \
-D VULKAN_HPP_TESTS_BUILD=OFF \
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
-D VULKAN_HPP_PRECOMPILE=OFF \
-D CMAKE_BUILD_TYPE=Debug \
-D CMAKE_CXX_COMPILER=clang-cl \
-D CMAKE_CXX_STANDARD=20
cmake --build build --parallel
cmake -B build -G Ninja --fresh \
-D VULKAN_HPP_GENERATOR_BUILD=ON \
-D VULKAN_HPP_RUN_GENERATOR=ON \
-D VULKAN_HPP_SAMPLES_BUILD=OFF \
-D VULKAN_HPP_TESTS_BUILD=OFF \
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
-D VULKAN_HPP_PRECOMPILE=OFF \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_CXX_COMPILER=clang-cl \
-D CMAKE_CXX_STANDARD=20
cmake --build build --parallel --clean-first
- name: Build samples and tests
run: |
for CXX_STANDARD in 11 14 17 20 23; do
for BUILD_TYPE in Debug Release; do
echo "================================================================================="
echo "Building C++$CXX_STANDARD in $BUILD_TYPE with architecture ${{matrix.architecture}}"
echo "================================================================================="
cmake -B build -G Ninja --fresh \
-D VULKAN_HPP_GENERATOR_BUILD=OFF \
-D VULKAN_HPP_RUN_GENERATOR=OFF \
-D VULKAN_HPP_SAMPLES_BUILD=ON \
-D VULKAN_HPP_TESTS_BUILD=ON \
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
-D VULKAN_HPP_PRECOMPILE=OFF \
-D CMAKE_BUILD_TYPE=$BUILD_TYPE \
-D CMAKE_C_COMPILER=clang-cl \
-D CMAKE_CXX_COMPILER=clang-cl \
-D CMAKE_CXX_STANDARD=$CXX_STANDARD
cmake --build build --parallel --clean-first
done
done

97
.github/workflows/ci-windows-msvc.yml vendored Normal file
View File

@ -0,0 +1,97 @@
name: CI Windows MSVC
on:
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ${{matrix.os}}
defaults:
run:
shell: bash
strategy:
matrix:
os: [windows-2022, windows-2025]
architecture: [x86, x64]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup MSVC
uses: TheMrMilchmann/setup-msvc-dev@v2
with:
arch: ${{matrix.architecture}}
# - name: Install glm, glfw and glslang
# run: |
# cd glm
# cmake -B build \
# -D CMAKE_CXX_STANDARD=11 \
# -D GLM_BUILD_LIBRARY=ON \
# -D GLM_BUILD_INSTALL=ON \
# -D GLM_BUILD_TESTS=OFF
# cmake --build build --parallel --config Release
# cmake --install build --config Release
# cd ../glfw
# cmake -B build \
# -D CMAKE_CXX_STANDARD=11 \
# -D GLFW_BUILD_EXAMPLES=OFF \
# -D GLFW_BUILD_TESTS=OFF \
# -D GLFW_BUILD_DOCS=OFF \
# -D GLFW_INSTALL=ON
# cmake --build build --parallel --config Release
# cmake --install build --config Release
# cd ../glslang
# cmake -B build \
# -D CMAKE_CXX_STANDARD=11 \
# -D ENABLE_OPT=OFF \
# -D GLSLANG_TESTS_DEFAULT=OFF \
# -D GLSLANG_ENABLE_INSTALL_DEFAULT=ON
# cmake --build build --parallel --config Release
# cmake --install build --config Release
# cd ..
- name: Generate headers
run: |
cmake -B build \
-D VULKAN_HPP_GENERATOR_BUILD=ON \
-D VULKAN_HPP_RUN_GENERATOR=OFF \
-D VULKAN_HPP_SAMPLES_BUILD=OFF \
-D VULKAN_HPP_TESTS_BUILD=OFF \
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
-D VULKAN_HPP_PRECOMPILE=OFF \
-D CMAKE_CXX_STANDARD=20
cmake --build build --parallel --config Debug
cmake --build build --parallel --config Release
- name: Build samples and tests
run: |
for CXX_STANDARD in 11 14 17 20 23; do
echo "================================================================================="
echo "Building C++$CXX_STANDARD in Debug with architecture ${{matrix.architecture}}"
echo "================================================================================="
cmake -B build --fresh \
-D VULKAN_HPP_GENERATOR_BUILD=OFF \
-D VULKAN_HPP_RUN_GENERATOR=OFF \
-D VULKAN_HPP_SAMPLES_BUILD=ON \
-D VULKAN_HPP_TESTS_BUILD=ON \
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
-D VULKAN_HPP_PRECOMPILE=OFF \
-D CMAKE_CXX_STANDARD=$CXX_STANDARD
cmake --build build --parallel --clean-first --config Debug
echo "================================================================================="
echo "Building C++$CXX_STANDARD in Release with architecture ${{matrix.architecture}}"
echo "================================================================================="
cmake --build build --parallel --config Release
done

View File

@ -1,49 +0,0 @@
name: CI Windows
on:
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ${{matrix.os}}
defaults:
run:
shell: bash
strategy:
matrix:
os: [windows-latest, windows-2019]
architecture: [x86, x64]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup MSVC
uses: TheMrMilchmann/setup-msvc-dev@v2
with:
arch: ${{matrix.architecture}}
- name: Loop over cpp_standards (11, 14, ...) and build_types (Debug, Release)
run: |
for cpp_standard in 11 14 17 20 23
do
for build_type in Debug Release
do
cmake -B build/$cpp_standard/$build_type \
-DVULKAN_HPP_SAMPLES_BUILD=ON \
-DVULKAN_HPP_SAMPLES_BUILD_ONLY_DYNAMIC=ON \
-DVULKAN_HPP_TESTS_BUILD=ON \
-DVULKAN_HPP_TESTS_BUILD_ONLY_DYNAMIC=ON \
-DVULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
-DVULKAN_HPP_PRECOMPILE=OFF \
-DVULKAN_HPP_RUN_GENERATOR=ON \
-DCMAKE_CXX_STANDARD=$cpp_standard \
-DCMAKE_BUILD_TYPE=$build_type
cmake --build build/$cpp_standard/$build_type --parallel
done
done

View File

@ -11,7 +11,6 @@ jobs:
strategy:
matrix:
build_type: [Debug]
cxx_compiler: [g++-9]
cxx_standard: [11]
steps:
@ -41,7 +40,6 @@ jobs:
-DVULKAN_HPP_SAMPLES_BUILD=OFF
-DVULKAN_HPP_TESTS_BUILD=OFF
-DVULKAN_HPP_RUN_GENERATOR=ON
-DCMAKE_CXX_COMPILER=${{matrix.cxx_compiler}}
-DCMAKE_CXX_STANDARD=${{matrix.cxx_standard}}
- name: Build

View File

@ -24,63 +24,47 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
if ( NOT CMAKE_CXX_STANDARD )
cmake_minimum_required( VERSION 3.22 )
include( CMakeDependentOption )
project( VulkanHppGenerator LANGUAGES CXX )
if ( NOT DEFINED CMAKE_CXX_STANDARD AND PROJECT_IS_TOP_LEVEL )
set( CMAKE_CXX_STANDARD 11 )
endif()
# all the options for this project
option( VULKAN_HPP_PRECOMPILE "Precompile vulkan.hpp and vulkan_raii.hpp for sample builds" ON )
option( VULKAN_HPP_RUN_GENERATOR "Run the HPP generator" OFF )
option( VULKAN_HPP_GENERATOR_BUILD "Build the HPP generator" ${PROJECT_IS_TOP_LEVEL} )
option( VULKAN_HPP_SAMPLES_BUILD "Build samples" OFF )
option( VULKAN_HPP_TESTS_BUILD "Build tests" OFF )
option( VULKAN_HPP_SAMPLES_BUILD_ONLY_DYNAMIC "Build only dynamic. Required in case the Vulkan SDK is not available" OFF )
option( VULKAN_HPP_TESTS_BUILD_ONLY_DYNAMIC "Build only dynamic" OFF )
option( VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP "Build with local Vulkan headers" ON )
option( VULKAN_HPP_ENABLE_CPP20_MODULES "Build Vulkan-Hpp as C++20 module; requires minimum CMake version 3.28" OFF )
option( VULKAN_HPP_CPP20_MODULE_DYNAMIC_DISPATCHER "Build C++20 module with dynamic Dispatcher" ON )
cmake_dependent_option( VULKAN_HPP_BUILD_CXX_MODULE "Build and test the C++ named module." ON [[ TARGET __CMAKE::CXX23 ]] OFF)
if ( VULKAN_HPP_ENABLE_CPP20_MODULES )
cmake_minimum_required( VERSION 3.28 )
else()
cmake_minimum_required( VERSION 3.12 )
# options for vulkan hpp compile definitions (see https://github.com/KhronosGroup/Vulkan-Hpp/tree/main?tab=readme-ov-file#configuration-options for details)
option( VULKAN_HPP_DISABLE_ENHANCED_MODE "Disable all enhanced functionality apart from scoped enums, bitmasks, default initialization and vk::StructureChain" OFF )
option( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC "Select the dynamic (ON) or static (OFF) dispatch loader (defaults to VK_NO_PROTOTYPES)" ${VK_NO_PROTOTYPES} )
option( VULKAN_HPP_FLAGS_MASK_TYPE_AS_PUBLIC "Change the m_mask access modifier in vk::Flags to public" OFF )
option( VULKAN_HPP_HANDLE_ERROR_OUT_OF_DATE_AS_SUCCESS "Handles VK_ERROR_OUT_OF_DATE_KHR like a success code" OFF )
option( VULKAN_HPP_HANDLES_MOVE_EXCHANGE "Enable 'm_handle = exchange( rhs.m_handle, {} )' in move constructors" OFF )
option( VULKAN_HPP_NO_CONSTRUCTORS "Remove constructors from structs and unions to enable C++20 designated initializers" OFF )
option( VULKAN_HPP_NO_EXCEPTIONS "Do not throw exceptions when vulkan functions return an error code" OFF )
option( VULKAN_HPP_NO_NODISCARD_WARNINGS "Remove C++17 [[nodiscard]] from function signatures that return something" OFF )
option( VULKAN_HPP_NO_SETTERS "Remove setters for structs and unions" OFF )
option( VULKAN_HPP_NO_SMART_HANDLE "Remove the vk::UniqueHandle helper class" OFF )
option( VULKAN_HPP_NO_SPACESHIP_OPERATOR "Remove the C++20 <=> (spaceship) operator" OFF )
option( VULKAN_HPP_NO_TO_STRING "Remove inclusion of vulkan_to_string.hpp from vulkan.hpp" OFF )
option( VULKAN_HPP_NO_WIN32_PROTOTYPES "Remove HINSTANCE, LoadLibraryA and other symbols, which are declared if VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL is enabled on Win32" OFF )
option( VULKAN_HPP_RAII_NO_EXCEPTIONS "Do not throw exceptions when vulkan functions from vk::raii return an error code." OFF )
option( VULKAN_HPP_SMART_HANDLE_IMPLICIT_CAST "Enable implicit casts from vk::UniqueHandle and vk::SharedHandle to their matching vk::Handle" OFF )
option( VULKAN_HPP_TYPESAFE_CONVERSION "Enable copy constructors for non-dispatchable handles" ON )
option( VULKAN_HPP_USE_REFLECT "Adds reflect function to structures, which returns an iterable tuple" OFF )
# manually set VK_NO_PROTOTYPES if undefined
if ( NOT DEFINED VK_NO_PROTOTYPES )
set ( VK_NO_PROTOTYPES ${VULKAN_HPP_DISPATCH_LOADER_DYNAMIC} )
endif()
project( VulkanHppGenerator LANGUAGES CXX )
function( vulkan_hpp__setup_platform )
set( options )
set( oneValueArgs NAME )
set( multiValueArgs )
cmake_parse_arguments( TARGET "{options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
if( WIN32 )
target_compile_definitions( ${TARGET_NAME} PUBLIC NOMINMAX VK_USE_PLATFORM_WIN32_KHR )
elseif( APPLE )
target_compile_definitions( ${TARGET_NAME} PUBLIC VK_USE_PLATFORM_MACOS_MVK )
elseif( UNIX )
target_compile_definitions( ${TARGET_NAME} PUBLIC VK_USE_PLATFORM_XCB_KHR )
else()
message( FATAL_ERROR, "Vulkan-Hpp: unhandled platform!" )
endif()
endfunction()
function( vulkan_hpp__setup_vulkan_include )
set( options )
set( oneValueArgs NAME )
set( multiValueArgs )
cmake_parse_arguments( TARGET "{options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
if( VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP )
target_include_directories( ${TARGET_NAME} PUBLIC "${CMAKE_CURRENT_FUNCTION_LIST_DIR}" )
target_include_directories( ${TARGET_NAME} PUBLIC "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/Vulkan-Headers/include" )
if( VULKAN_HPP_RUN_GENERATOR )
add_dependencies( ${TARGET_NAME} build_vulkan_hpp )
endif()
else()
target_include_directories( ${TARGET_NAME} PUBLIC "${Vulkan_INCLUDE_DIRS}" )
endif()
endfunction()
function( vulkan_hpp__setup_warning_level )
set( options )
set( oneValueArgs NAME )
@ -93,7 +77,293 @@ function( vulkan_hpp__setup_warning_level )
target_compile_options( ${TARGET_NAME} PRIVATE /permissive- )
endif()
else()
target_compile_options( ${TARGET_NAME} PRIVATE -Wall -Wextra -pedantic -Werror )
target_compile_options( ${TARGET_NAME} PRIVATE -Wall -Wextra -Wpedantic -Werror )
endif()
endfunction()
# Build Vulkan-Hpp and Video-Hpp generators
if ( VULKAN_HPP_GENERATOR_BUILD )
set_property( GLOBAL PROPERTY USE_FOLDERS ON )
# look for the file vk.xml, the ultimate source of truth for vulkan, to generate the headers from
if( NOT DEFINED VulkanRegistry_DIR )
if( DEFINED VULKAN_HPP_VULKAN_HEADERS_SRC_DIR )
set( VulkanRegistry_DIR "${VULKAN_HPP_VULKAN_HEADERS_SRC_DIR}/registry" )
else()
set( VulkanRegistry_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Vulkan-Headers/registry" )
endif()
endif()
file( TO_NATIVE_PATH ${VulkanRegistry_DIR}/vk.xml vk_spec )
string( REPLACE "\\" "\\\\" vk_spec ${vk_spec} )
# gather the tinyxml2 sources, to be used directly in the generator project
if( NOT DEFINED VULKAN_HPP_TINYXML2_SRC_DIR )
set( VULKAN_HPP_TINYXML2_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tinyxml2" )
endif()
set( TINYXML2_SOURCES ${VULKAN_HPP_TINYXML2_SRC_DIR}/tinyxml2.cpp )
set( TINYXML2_HEADERS ${VULKAN_HPP_TINYXML2_SRC_DIR}/tinyxml2.h )
source_group( TinyXML2 FILES ${TINYXML2_HEADERS} ${TINYXML2_SOURCES} )
# The generator executable
add_executable( VulkanHppGenerator VulkanHppGenerator.cpp VulkanHppGenerator.hpp XMLHelper.hpp ${TINYXML2_SOURCES} ${TINYXML2_HEADERS} )
vulkan_hpp__setup_warning_level( NAME VulkanHppGenerator )
target_compile_definitions( VulkanHppGenerator PUBLIC BASE_PATH="${CMAKE_CURRENT_SOURCE_DIR}" VK_SPEC="${vk_spec}" )
target_include_directories( VulkanHppGenerator PRIVATE ${VULKAN_HPP_TINYXML2_SRC_DIR} )
set_target_properties( VulkanHppGenerator PROPERTIES CXX_STANDARD 20 CXX_STANDARD_REQUIRED ON )
if( UNIX )
target_link_libraries( VulkanHppGenerator PUBLIC pthread )
endif()
# The video generator executable
add_executable( VideoHppGenerator VideoHppGenerator.cpp VideoHppGenerator.hpp XMLHelper.hpp ${TINYXML2_SOURCES} ${TINYXML2_HEADERS} )
vulkan_hpp__setup_warning_level( NAME VideoHppGenerator )
file( TO_NATIVE_PATH ${VulkanRegistry_DIR}/video.xml video_spec )
string( REPLACE "\\" "\\\\" video_spec ${video_spec} )
target_compile_definitions( VideoHppGenerator PUBLIC BASE_PATH="${CMAKE_CURRENT_SOURCE_DIR}" VIDEO_SPEC="${video_spec}" )
target_include_directories( VideoHppGenerator PRIVATE ${VULKAN_HPP_TINYXML2_SRC_DIR} )
set_target_properties( VideoHppGenerator PROPERTIES CXX_STANDARD 20 CXX_STANDARD_REQUIRED ON )
# find a clang-format version to format the generated header files
find_program(CLANG_FORMAT_EXECUTABLE NAMES clang-format)
if( CLANG_FORMAT_EXECUTABLE )
# get the clang-format version string
execute_process( COMMAND ${CLANG_FORMAT_EXECUTABLE} "--version" OUTPUT_VARIABLE clangFormatVersion )
# filter out the actual version
string( REGEX MATCH [0123456789.]+ clangFormatVersion "${clangFormatVersion}" )
# we need at least version 7.0.0 !
if( clangFormatVersion VERSION_LESS 7.0.0 )
message( WARNING " Found too old clang-format version <" ${clangFormatVersion} ">, we need version 7 and up to nicely format vulkan.hpp and vulkan_raii.hpp" )
else()
message( STATUS " Found clang-format version <" ${clangFormatVersion} ">." )
if( clangFormatVersion VERSION_LESS 11.0.0 )
message( STATUS " Using .clang-format version 7." )
file( READ ".clang-format_7" clangFormat )
elseif( clangFormatVersion VERSION_LESS 12.0.0 )
message( STATUS " Using .clang-format version 11." )
file( READ ".clang-format_11" clangFormat )
elseif( clangFormatVersion VERSION_LESS 13.0.0 )
message( STATUS " Using .clang-format version 12." )
file( READ ".clang-format_12" clangFormat )
elseif( clangFormatVersion VERSION_LESS 14.0.0 )
message( STATUS " Using .clang-format version 13." )
file( READ ".clang-format_13" clangFormat )
elseif( clangFormatVersion VERSION_LESS 15.0.0 )
message( STATUS " Using .clang-format version 14." )
file( READ ".clang-format_14" clangFormat )
elseif( clangFormatVersion VERSION_LESS 16.0.0 )
message( STATUS " Using .clang-format version 15." )
file( READ ".clang-format_15" clangFormat )
elseif( clangFormatVersion VERSION_LESS 17.0.0 )
message( STATUS " Using .clang-format version 16." )
file( READ ".clang-format_16" clangFormat )
elseif( clangFormatVersion VERSION_LESS 18.0.0 )
message( STATUS " Using .clang-format version 17." )
file( READ ".clang-format_17" clangFormat )
else()
message(STATUS " Using .clang-format version 18." )
file( READ ".clang-format_18" clangFormat )
endif()
file( WRITE ".clang-format" ${clangFormat} )
target_compile_definitions( VulkanHppGenerator PUBLIC CLANG_FORMAT_EXECUTABLE="${CLANG_FORMAT_EXECUTABLE}" )
target_compile_definitions( VideoHppGenerator PUBLIC CLANG_FORMAT_EXECUTABLE="${CLANG_FORMAT_EXECUTABLE}" )
endif()
else()
message( WARNING " Could not find clang-format. Generated vulkan.hpp and vulkan_raii.hpp will not be nicely formatted." )
endif()
endif()
# if the generators are to be run, add a custom commands and targets
if( VULKAN_HPP_RUN_GENERATOR )
if( NOT DEFINED VulkanHeaders_INCLUDE_DIR )
if( DEFINED VULKAN_HPP_PATH )
set( VulkanHeaders_INCLUDE_DIR ${VULKAN_HPP_PATH} )
else()
set( VulkanHeaders_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" )
endif()
endif()
file( TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan.hpp vulkan_hpp )
string( REPLACE "\\" "\\\\" vulkan_hpp ${vulkan_hpp} )
add_custom_command(
COMMAND VulkanHppGenerator
OUTPUT "${vulkan_hpp}"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
COMMENT "run VulkanHppGenerator"
DEPENDS VulkanHppGenerator "${vk_spec}" )
add_custom_target( build_vulkan_hpp ALL DEPENDS "${vulkan_hpp}" "${vk_spec}" )
file( TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_video.hpp vulkan_video_hpp )
string( REPLACE "\\" "\\\\" vulkan_video_hpp ${vulkan_video_hpp} )
add_custom_command(
COMMAND VideoHppGenerator
OUTPUT "${vulkan_video_hpp}"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
COMMENT "run VideoHppGenerator"
DEPENDS VideoHppGenerator "${video_spec}" )
add_custom_target( build_video_hpp ALL DEPENDS "${vulkan_video_hpp}" "${video_spec}" )
endif()
# Create Vulkan-Hpp interface target
add_library( VulkanHpp INTERFACE )
add_library( Vulkan::Hpp ALIAS VulkanHpp )
target_include_directories( VulkanHpp INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}" )
if( VULKAN_HPP_RUN_GENERATOR )
add_dependencies( VulkanHpp build_vulkan_hpp build_video_hpp )
endif()
# set up compile definitions
if( VULKAN_HPP_DISABLE_ENHANCED_MODE )
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_DISABLE_ENHANCED_MODE" )
endif()
if( VK_NO_PROTOTYPES )
target_compile_definitions(VulkanHpp INTERFACE "VK_NO_PROTOTYPES" )
endif()
if( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC )
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_DISPATCH_LOADER_DYNAMIC" )
if( UNIX )
target_link_libraries( VulkanHpp INTERFACE ${CMAKE_DL_LIBS} )
endif()
else()
find_package( Vulkan )
if ( Vulkan_FOUND )
target_link_libraries( VulkanHpp INTERFACE ${Vulkan_LIBRARIES} )
else()
message(WARNING "Could not link to vulkan-1 libraries, consider using VULKAN_HPP_DISPATCH_LOADER_DYNAMIC")
endif()
endif()
if( VULKAN_HPP_USE_REFLECT )
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_USE_REFLECT" )
endif()
if( NOT VULKAN_HPP_TYPESAFE_CONVERSION )
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_TYPESAFE_CONVERSION=0" )
endif()
if( VULKAN_HPP_HANDLES_MOVE_EXCHANGE )
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_HANDLES_MOVE_EXCHANGE" )
endif()
if( VULKAN_HPP_FLAGS_MASK_TYPE_AS_PUBLIC )
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_FLAGS_MASK_TYPE_AS_PUBLIC" )
endif()
if( VULKAN_HPP_HANDLE_ERROR_OUT_OF_DATE_AS_SUCCESS )
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_HANDLE_ERROR_OUT_OF_DATE_AS_SUCCESS" )
endif()
if( VULKAN_HPP_SMART_HANDLE_IMPLICIT_CAST )
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_SMART_HANDLE_IMPLICIT_CAST" )
endif()
if( VULKAN_HPP_NO_SETTERS )
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_NO_SETTERS" )
endif()
if( VULKAN_HPP_NO_TO_STRING )
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_NO_TO_STRING" )
endif()
if( VULKAN_HPP_NO_EXCEPTIONS )
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_NO_EXCEPTIONS" )
endif()
if( VULKAN_HPP_NO_CONSTRUCTORS )
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_NO_CONSTRUCTORS" )
endif()
if( VULKAN_HPP_NO_SMART_HANDLE )
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_NO_SMART_HANDLE" )
endif()
if( VULKAN_HPP_RAII_NO_EXCEPTIONS )
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_RAII_NO_EXCEPTIONS" )
endif()
if( VULKAN_HPP_NO_WIN32_PROTOTYPES )
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_NO_WIN32_PROTOTYPES" )
endif()
if( VULKAN_HPP_NO_NODISCARD_WARNINGS )
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_NO_NODISCARD_WARNINGS" )
endif()
if( VULKAN_HPP_NO_SPACESHIP_OPERATOR )
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_NO_SPACESHIP_OPERATOR" )
endif()
function( vulkan_hpp__setup_vulkan_include )
set( options )
set( oneValueArgs NAME )
set( multiValueArgs )
cmake_parse_arguments( TARGET "{options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
if( VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP )
# Vulkan C++ headers
target_link_libraries( ${TARGET_NAME} PUBLIC Vulkan::Hpp )
# Vulkan C headers
if ( EXISTS "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/Vulkan-Headers/include" )
target_include_directories( VulkanHpp INTERFACE "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/Vulkan-Headers/include" )
else()
message( WARNING "Could not find vulkan C headers locally, pull the Vulkan-Headers submodule or disable VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP" )
endif()
else()
find_package( Vulkan REQUIRED )
target_include_directories( ${TARGET_NAME} PUBLIC "${Vulkan_INCLUDE_DIRS}" )
endif()
endfunction()
function( vulkan_hpp__setup_vulkan_module )
set( options )
set( oneValueArgs NAME FILE_SET_NAME )
set( multiValueArgs FILE_SET ALIAS )
cmake_parse_arguments( TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
if ( NOT TARGET_NAME )
message( FATAL_ERROR "NAME must be defined in vulkan_hpp__setup_module" )
endif()
add_library( ${TARGET_NAME} )
foreach( TARGET_ALIAS_NAME IN LISTS TARGET_ALIAS )
add_library(${TARGET_ALIAS_NAME} ALIAS ${TARGET_NAME})
endforeach()
target_compile_features( ${TARGET_NAME} PUBLIC cxx_std_23 )
set_target_properties( ${TARGET_NAME} PROPERTIES CXX_MODULE_STD ON )
if ( NOT TARGET_FILE_SET )
message( FATAL_ERROR "FILE_SET must be defined in vulkan_hpp__setup_module" )
endif()
list(LENGTH TARGET_FILE_SET TARGET_FILE_SET_LENGTH)
if ( TARGET_FILE_SET_LENGTH LESS 1 )
message(FATAL_ERROR "FILE_SET in vulkan_hpp__setup_module must at least one source file")
endif()
target_sources( ${TARGET_NAME} PUBLIC
FILE_SET ${TARGET_FILE_SET_NAME}
BASE_DIRS ${CMAKE_CURRENT_FUNCTION_LIST_DIR}
TYPE CXX_MODULES
FILES ${TARGET_FILE_SET} )
vulkan_hpp__setup_vulkan_include( NAME ${TARGET_NAME} )
endfunction()
# Build Vulkan-Hpp as a module
if( VULKAN_HPP_BUILD_CXX_MODULE )
# create targets providing VulkanHpp and VulkanVideoHpp as C++ named modules
vulkan_hpp__setup_vulkan_module( NAME VulkanHppModule
FILE_SET_NAME vulkan_module_file
FILE_SET
vulkan/vulkan.cppm
vulkan/vulkan_video.cppm
ALIAS Vulkan::HppModule ) # TODO: respect VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP
endif()
function( vulkan_hpp__setup_platform )
set( options )
set( oneValueArgs NAME )
set( multiValueArgs )
cmake_parse_arguments( TARGET "{options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
if( WIN32 )
target_compile_definitions( ${TARGET_NAME} PUBLIC VK_USE_PLATFORM_WIN32_KHR )
elseif( APPLE )
target_compile_definitions( ${TARGET_NAME} PUBLIC VK_USE_PLATFORM_METAL_EXT )
elseif( UNIX )
target_compile_definitions( ${TARGET_NAME} PUBLIC VK_USE_PLATFORM_XCB_KHR )
else()
message( FATAL_ERROR, "Vulkan-Hpp: unhandled platform!" )
endif()
if( !MSVC )
target_compile_options( ${TARGET_NAME} PRIVATE -fno-strict-aliasing )
endif()
endfunction()
@ -133,10 +403,10 @@ endfunction()
function( vulkan_hpp__setup_sample )
set( options )
set( oneValueArgs FOLDER NAME PCH_REUSE )
set( multiValueArgs HEADERS INCLUDE_DIRS LIBS PCH SOURCES )
set( multiValueArgs HEADERS LIBS PCH SOURCES )
cmake_parse_arguments( TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
if( NOT (VULKAN_HPP_SAMPLES_BUILD_ONLY_DYNAMIC AND VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP) )
if( NOT VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP )
find_package( Vulkan REQUIRED )
endif()
@ -154,10 +424,6 @@ function( vulkan_hpp__setup_sample )
set_target_properties( ${TARGET_NAME} PROPERTIES FOLDER "${TARGET_FOLDER}" )
endif()
if( TARGET_INCLUDE_DIRS )
target_include_directories( ${TARGET_NAME} PUBLIC ${TARGET_INCLUDE_DIRS} )
endif()
if( TARGET_LIBS )
target_link_libraries( ${TARGET_NAME} PRIVATE "${TARGET_LIBS}" )
endif()
@ -177,28 +443,26 @@ function( vulkan_hpp__setup_sample_static )
set( multiValueArgs )
cmake_parse_arguments( TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
if( NOT VULKAN_HPP_SAMPLES_BUILD_ONLY_DYNAMIC )
if( NOT TARGET_NAME )
message( FATAL_ERROR "NAME must be defined in vulkan_hpp__setup_sample_static" )
endif()
find_package( Vulkan REQUIRED )
vulkan_hpp__setup_sample(
NAME ${TARGET_NAME}
FOLDER Samples
PCH <vulkan/vulkan.hpp>
SOURCES ${TARGET_NAME}.cpp
LIBS ${Vulkan_LIBRARIES} )
target_compile_definitions( ${TARGET_NAME} PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=0 )
if( NOT TARGET_NAME )
message( FATAL_ERROR "NAME must be defined in vulkan_hpp__setup_sample_static" )
endif()
find_package( Vulkan REQUIRED )
vulkan_hpp__setup_sample(
NAME ${TARGET_NAME}
FOLDER Samples
PCH <vulkan/vulkan.hpp>
SOURCES ${TARGET_NAME}.cpp
LIBS ${Vulkan_LIBRARIES} )
target_compile_definitions( ${TARGET_NAME} PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=0 )
endfunction()
function( vulkan_hpp__setup_sample_dynamic )
set( options )
set( oneValueArgs NAME )
set( multiValueArgs HEADERS INCLUDE_DIRS SOURCES )
set( multiValueArgs HEADERS SOURCES )
cmake_parse_arguments( TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
if( NOT TARGET_NAME )
@ -212,7 +476,6 @@ function( vulkan_hpp__setup_sample_dynamic )
NAME ${TARGET_NAME}
FOLDER Samples
PCH_REUSE utils
INCLUDE_DIRS ${TARGET_INCLUDE_DIRS}
HEADERS ${TARGET_HEADERS}
SOURCES ${TARGET_SOURCES}
LIBS utils )
@ -221,7 +484,7 @@ endfunction()
function( vulkan_hpp__setup_sample_raii )
set( options )
set( oneValueArgs NAME )
set( multiValueArgs HEADERS INCLUDE_DIRS SOURCES )
set( multiValueArgs HEADERS SOURCES )
cmake_parse_arguments( TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
if( NOT TARGET_NAME )
@ -235,179 +498,84 @@ function( vulkan_hpp__setup_sample_raii )
NAME RAII_${TARGET_NAME}
FOLDER RAII_Samples
PCH_REUSE utils
INCLUDE_DIRS ${TARGET_INCLUDE_DIRS}
HEADERS ${TARGET_HEADERS}
SOURCES ${TARGET_SOURCES}
LIBS utils )
endfunction()
function( vulkan_hpp__setup_test )
set( options NO_UTILS )
set( oneValueArgs CXX_STANDARD NAME )
set( multiValueArgs LIBRARIES )
set( options CXX_MODULE )
set( oneValueArgs NAME )
set( multiValueArgs LIBRARIES COMPILE_DEFINITIONS )
cmake_parse_arguments( TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
if( NOT (VULKAN_HPP_TESTS_BUILD_ONLY_DYNAMIC AND VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP) )
find_package( Vulkan REQUIRED )
endif()
if( NOT TARGET_NAME )
message( FATAL_ERROR "NAME must be defined in vulkan_hpp__setup_test" )
endif()
if( NOT TARGET_CXX_STANDARD )
set( TARGET_CXX_STANDARD ${CMAKE_CXX_STANDARD} )
set( CPP_FILE ${TARGET_NAME}.cpp )
if ( TARGET_CXX_MODULE )
set( TARGET_NAME ${TARGET_NAME}_module )
endif()
vulkan_hpp__setup_project( NAME ${TARGET_NAME} )
add_executable( ${TARGET_NAME} ${CPP_FILE} )
add_executable( ${TARGET_NAME} ${TARGET_NAME}.cpp )
# use a variant for the module version
if( TARGET_CXX_MODULE )
set_target_properties( ${TARGET_NAME} PROPERTIES CXX_SCAN_FOR_MODULES ON )
# set up new vulkan module when custom compile definitions are needed
list( LENGTH TARGET_COMPILE_DEFINITIONS COMPILE_DEFINITIONS_LENGTH )
if ( COMPILE_DEFINITIONS_LENGTH GREATER 0 )
vulkan_hpp__setup_vulkan_module( NAME ${TARGET_NAME}_VulkanHppModule
FILE_SET_NAME vulkan_module_file
FILE_SET "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/vulkan/vulkan.cppm" ) # TODO: respect VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP
target_compile_definitions( ${TARGET_NAME}_VulkanHppModule PUBLIC ${TARGET_COMPILE_DEFINITIONS} )
set_target_properties( ${TARGET_NAME}_VulkanHppModule PROPERTIES CXX_STANDARD_REQUIRED ON FOLDER "Tests" )
target_link_libraries( ${TARGET_NAME} PRIVATE ${TARGET_NAME}_VulkanHppModule )
else()
target_link_libraries( ${TARGET_NAME} PRIVATE Vulkan::HppModule )
endif()
# set macro to hint usage of the vulkan module, it is up to the test source file to respect this
target_compile_definitions( ${TARGET_NAME} PUBLIC VULKAN_HPP_USE_CXX_MODULE )
else()
vulkan_hpp__setup_vulkan_include( NAME ${TARGET_NAME} )
target_compile_definitions( ${TARGET_NAME} PUBLIC ${TARGET_COMPILE_DEFINITIONS} )
endif()
vulkan_hpp__setup_platform( NAME ${TARGET_NAME} )
vulkan_hpp__setup_vulkan_include( NAME ${TARGET_NAME} )
vulkan_hpp__setup_warning_level( NAME ${TARGET_NAME} )
set_target_properties( ${TARGET_NAME} PROPERTIES CXX_STANDARD ${TARGET_CXX_STANDARD} CXX_STANDARD_REQUIRED ON FOLDER "Tests" )
target_include_directories( ${TARGET_NAME} PUBLIC ${VulkanHeaders_INCLUDE_DIR} )
target_include_directories( ${TARGET_NAME} PUBLIC "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/glm" )
if ( NOT ${TARGET_NO_UTILS} )
target_link_libraries( ${TARGET_NAME} PRIVATE utils )
endif()
set_target_properties( ${TARGET_NAME} PROPERTIES CXX_STANDARD_REQUIRED ON FOLDER "Tests" )
target_link_libraries( ${TARGET_NAME} PRIVATE ${TARGET_LIBRARIES} )
endfunction()
set_property( GLOBAL PROPERTY USE_FOLDERS ON )
# find a clang-format version to format the generated header files
find_program(CLANG_FORMAT_EXECUTABLE NAMES clang-format)
if( CLANG_FORMAT_EXECUTABLE )
# get the clang-format version string
execute_process( COMMAND ${CLANG_FORMAT_EXECUTABLE} "--version" OUTPUT_VARIABLE clangFormatVersion )
# filter out the actual version
string( REGEX MATCH [0123456789.]+ clangFormatVersion "${clangFormatVersion}" )
# we need at least version 7.0.0 !
if( clangFormatVersion VERSION_LESS 7.0.0 )
message( WARNING " Found too old clang-format version <" ${clangFormatVersion} ">, we need version 7 and up to nicely format vulkan.hpp and vulkan_raii.hpp" )
else()
message( STATUS " Found clang-format version <" ${clangFormatVersion} ">." )
add_definitions( -DCLANG_FORMAT_EXECUTABLE="${CLANG_FORMAT_EXECUTABLE}" )
if( clangFormatVersion VERSION_LESS 11.0.0 )
message( STATUS " Using .clang-format version 7." )
file( READ ".clang-format_7" clangFormat )
elseif( clangFormatVersion VERSION_LESS 12.0.0 )
message( STATUS " Using .clang-format version 11." )
file( READ ".clang-format_11" clangFormat )
elseif( clangFormatVersion VERSION_LESS 13.0.0 )
message( STATUS " Using .clang-format version 12." )
file( READ ".clang-format_12" clangFormat )
elseif( clangFormatVersion VERSION_LESS 14.0.0 )
message( STATUS " Using .clang-format version 13." )
file( READ ".clang-format_13" clangFormat )
elseif( clangFormatVersion VERSION_LESS 15.0.0 )
message( STATUS " Using .clang-format version 14." )
file( READ ".clang-format_14" clangFormat )
else()
message(STATUS " Using .clang-format version 15." )
file( READ ".clang-format_15" clangFormat )
endif()
file( WRITE ".clang-format" ${clangFormat} )
if( VULKAN_HPP_SAMPLES_BUILD OR VULKAN_HPP_TESTS_BUILD )
# external libraries
find_package( glm QUIET )
if( NOT glm_FOUND )
add_subdirectory( glm )
endif()
else()
message( WARNING " Could not find clang-format. Generated vulkan.hpp and vulkan_raii.hpp will not be nicely formatted." )
endif()
# look for the file vk.xml, the ultimate source of truth for vulkan, to generate the headers from
if( NOT DEFINED VulkanRegistry_DIR )
if( DEFINED VULKAN_HPP_VULKAN_HEADERS_SRC_DIR )
set( VulkanRegistry_DIR "${VULKAN_HPP_VULKAN_HEADERS_SRC_DIR}/registry" )
else()
set( VulkanRegistry_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Vulkan-Headers/registry" )
find_package( glfw3 QUIET )
if( NOT glfw3_FOUND )
set( GLFW_BUILD_EXAMPLES OFF )
set( GLFW_BUILD_TESTS OFF )
add_subdirectory( glfw )
endif()
endif()
file( TO_NATIVE_PATH ${VulkanRegistry_DIR}/vk.xml vk_spec )
string( REPLACE "\\" "\\\\" vk_spec ${vk_spec} )
# gather the tinyxml2 sources, to be used directly in the generator project
if( NOT DEFINED VULKAN_HPP_TINYXML2_SRC_DIR )
set( VULKAN_HPP_TINYXML2_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tinyxml2" )
endif()
set( TINYXML2_SOURCES ${VULKAN_HPP_TINYXML2_SRC_DIR}/tinyxml2.cpp )
set( TINYXML2_HEADERS ${VULKAN_HPP_TINYXML2_SRC_DIR}/tinyxml2.h )
source_group( TinyXML2 FILES ${TINYXML2_HEADERS} ${TINYXML2_SOURCES} )
# Build Vulkan-Hpp as a module
if( VULKAN_HPP_ENABLE_CPP20_MODULES )
# create a target to provide VulkanHpp as C++20 module
add_library( VulkanHppModule )
set_target_properties( VulkanHppModule PROPERTIES
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF )
if ( VULKAN_HPP_CPP20_MODULE_DYNAMIC_DISPATCHER )
target_compile_definitions( VulkanHppModule PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1 )
else()
target_compile_definitions( VulkanHppModule PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=0 )
find_package( glslang QUIET )
if( NOT glslang_FOUND )
set( ENABLE_OPT OFF ) # could use ALLOW_EXTERNAL_SPIRV_TOOLS=ON instead
add_subdirectory( glslang )
endif()
target_compile_features( VulkanHppModule PUBLIC cxx_std_20 )
target_sources( VulkanHppModule
PUBLIC
FILE_SET vulkan_module_file BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} TYPE CXX_MODULES FILES vulkan/vulkan.cppm )
target_include_directories( VulkanHppModule PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} )
target_include_directories( VulkanHppModule PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/Vulkan-Headers/include" )
endif()
# The generator executable
add_executable( VulkanHppGenerator VulkanHppGenerator.cpp VulkanHppGenerator.hpp XMLHelper.hpp ${TINYXML2_SOURCES} ${TINYXML2_HEADERS} )
vulkan_hpp__setup_warning_level( NAME VulkanHppGenerator )
target_compile_definitions( VulkanHppGenerator PUBLIC BASE_PATH="${CMAKE_CURRENT_SOURCE_DIR}" VK_SPEC="${vk_spec}" )
target_include_directories( VulkanHppGenerator PRIVATE ${VULKAN_HPP_TINYXML2_SRC_DIR} )
set_target_properties( VulkanHppGenerator PROPERTIES CXX_STANDARD 20 CXX_STANDARD_REQUIRED ON )
# The video generator executable
add_executable( VideoHppGenerator VideoHppGenerator.cpp VideoHppGenerator.hpp XMLHelper.hpp ${TINYXML2_SOURCES} ${TINYXML2_HEADERS} )
vulkan_hpp__setup_warning_level( NAME VideoHppGenerator )
file( TO_NATIVE_PATH ${VulkanRegistry_DIR}/video.xml video_spec )
string( REPLACE "\\" "\\\\" video_spec ${video_spec} )
target_compile_definitions( VideoHppGenerator PUBLIC BASE_PATH="${CMAKE_CURRENT_SOURCE_DIR}" VIDEO_SPEC="${video_spec}" )
target_include_directories( VideoHppGenerator PRIVATE ${VULKAN_HPP_TINYXML2_SRC_DIR} )
set_target_properties( VideoHppGenerator PROPERTIES CXX_STANDARD 20 CXX_STANDARD_REQUIRED ON )
# if the generators are to be run, add a custom commands and targets
if( VULKAN_HPP_RUN_GENERATOR )
if( NOT DEFINED VulkanHeaders_INCLUDE_DIR )
if( DEFINED VULKAN_HPP_PATH )
set( VulkanHeaders_INCLUDE_DIR ${VULKAN_HPP_PATH} )
else()
set( VulkanHeaders_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" )
endif()
endif()
file( TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan.hpp vulkan_hpp )
string( REPLACE "\\" "\\\\" vulkan_hpp ${vulkan_hpp} )
add_custom_command(
COMMAND VulkanHppGenerator
COMMAND VulkanHppGenerator -api vulkansc
OUTPUT "${vulkan_hpp}"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
COMMENT "run VulkanHppGenerator"
DEPENDS VulkanHppGenerator "${vk_spec}" )
add_custom_target( build_vulkan_hpp ALL DEPENDS "${vulkan_hpp}" "${vk_spec}" )
add_custom_command(
COMMAND VideoHppGenerator
OUTPUT "${vulkan_video_hpp}"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
COMMENT "run VulkanVideoGenerator"
DEPENDS VulkanVideoGenerator "${video_spec}" )
add_custom_target( build_vulkan_video ALL DEPENDS "${vulkan_video_hpp}" "${video_spec}" )
add_subdirectory( samples/utils )
add_subdirectory( RAII_Samples/utils )
endif()
if( VULKAN_HPP_SAMPLES_BUILD )
# external libraries
add_subdirectory( glm )
set( GLFW_BUILD_EXAMPLES OFF )
set( GLFW_BUILD_TESTS OFF )
add_subdirectory( glfw )
add_subdirectory( glslang )
# samples
add_subdirectory( samples )
add_subdirectory( RAII_Samples )
@ -427,12 +595,14 @@ if( ${VULKAN_HPP_INSTALL} )
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_handles.hpp
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_hash.hpp
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_hpp_macros.hpp
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan.hpp
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_raii.hpp
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_static_assertions.hpp
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_structs.hpp
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_to_string.hpp
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_video.hpp
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan.cppm
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_video.cppm
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan.hpp
)
install( FILES ${VK_GENERATED_VULKAN_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/vulkan )

View File

@ -42,7 +42,7 @@ int main( int /*argc*/, char ** /*argv*/ )
uint32_t height = 64;
vk::su::WindowData window = vk::su::createWindow( AppName, { width, height } );
VkSurfaceKHR _surface;
glfwCreateWindowSurface( static_cast<VkInstance>( *instance ), window.handle, nullptr, &_surface );
glfwCreateWindowSurface( *instance, window.handle, nullptr, &_surface );
vk::raii::SurfaceKHR surface( instance, _surface );
// determine a queueFamilyIndex that suports present
@ -93,7 +93,7 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::SurfaceCapabilitiesKHR surfaceCapabilities = physicalDevice.getSurfaceCapabilitiesKHR( surface );
vk::Extent2D swapchainExtent;
if ( surfaceCapabilities.currentExtent.width == std::numeric_limits<uint32_t>::max() )
if ( surfaceCapabilities.currentExtent.width == (std::numeric_limits<uint32_t>::max)() )
{
// If the surface size is undefined, the size is set to the size of the images requested.
swapchainExtent.width = vk::su::clamp( width, surfaceCapabilities.minImageExtent.width, surfaceCapabilities.maxImageExtent.width );
@ -120,7 +120,7 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::SwapchainCreateInfoKHR swapChainCreateInfo( vk::SwapchainCreateFlagsKHR(),
surface,
vk::su::clamp( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
vk::su::clampSurfaceImageCount( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
format,
vk::ColorSpaceKHR::eSrgbNonlinear,
swapchainExtent,

View File

@ -17,7 +17,7 @@
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>

View File

@ -29,7 +29,7 @@
#include "../../samples/utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>

View File

@ -29,7 +29,7 @@
#include "../../samples/utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>
#include <thread>

View File

@ -55,7 +55,7 @@ int main( int /*argc*/, char ** /*argv*/ )
if ( loader_major_version > desiredMajorVersion || ( loader_major_version == desiredMajorVersion && loader_minor_version >= desiredMinorVersion ) )
{
// Create the instance
vk::raii::Instance instance = vk::raii::su::makeInstance( context, AppName, EngineName, {}, vk::su::getInstanceExtensions() );
vk::raii::Instance instance = vk::raii::su::makeInstance( context, AppName, EngineName, {}, vk::su::getInstanceExtensions(), desiredVersion );
#if !defined( NDEBUG )
vk::raii::DebugUtilsMessengerEXT debugUtilsMessenger( instance, vk::su::makeDebugUtilsMessengerCreateInfoEXT() );
#endif

View File

@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
add_subdirectory( utils )
add_subdirectory( 01_InitInstance )
add_subdirectory( 02_EnumerateDevices )
add_subdirectory( 03_InitDevice )

View File

@ -78,11 +78,8 @@ int main( int /*argc*/, char ** /*argv*/ )
assert( imageIndex < swapChainData.images.size() );
commandBuffer.begin( vk::CommandBufferBeginInfo() );
vk::raii::su::setImageLayout( commandBuffer,
static_cast<vk::Image>( swapChainData.images[imageIndex] ),
swapChainData.colorFormat,
vk::ImageLayout::eUndefined,
vk::ImageLayout::eTransferDstOptimal );
vk::raii::su::setImageLayout(
commandBuffer, swapChainData.images[imageIndex], swapChainData.colorFormat, vk::ImageLayout::eUndefined, vk::ImageLayout::eTransferDstOptimal );
// in order to get a clean desctruction sequence, instantiate the DeviceMemory for the image first
vk::raii::DeviceMemory deviceMemory( nullptr );
@ -150,7 +147,7 @@ int main( int /*argc*/, char ** /*argv*/ )
// Intend to blit from this image, set the layout accordingly
vk::raii::su::setImageLayout( commandBuffer, blitSourceImage, swapChainData.colorFormat, vk::ImageLayout::eGeneral, vk::ImageLayout::eTransferSrcOptimal );
vk::Image blitDestinationImage = static_cast<vk::Image>( swapChainData.images[imageIndex] );
vk::Image blitDestinationImage = swapChainData.images[imageIndex];
// Do a 32x32 blit to all of the dst image - should get big squares
vk::ImageSubresourceLayers imageSubresourceLayers( vk::ImageAspectFlagBits::eColor, 0, 0, 1 );
@ -203,9 +200,9 @@ int main( int /*argc*/, char ** /*argv*/ )
result = presentQueue.presentKHR( presentInfoKHR );
switch ( result )
{
case vk::Result::eSuccess: break;
case vk::Result::eSuccess : break;
case vk::Result::eSuboptimalKHR: std::cout << "vk::Queue::presentKHR returned vk::Result::eSuboptimalKHR !\n"; break;
default: assert( false ); // an unexpected result is returned !
default : assert( false ); // an unexpected result is returned !
}
std::this_thread::sleep_for( std::chrono::milliseconds( 1000 ) );

View File

@ -24,15 +24,14 @@
static char const * AppName = "CreateDebugReportMessenger";
static char const * EngineName = "Vulkan.hpp";
VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
VkDebugUtilsMessageTypeFlagsEXT messageTypes,
VkDebugUtilsMessengerCallbackDataEXT const * pCallbackData,
VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( vk::DebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
vk::DebugUtilsMessageTypeFlagsEXT messageTypes,
vk::DebugUtilsMessengerCallbackDataEXT const * pCallbackData,
void * /*pUserData*/ )
{
std::ostringstream message;
message << vk::to_string( static_cast<vk::DebugUtilsMessageSeverityFlagBitsEXT>( messageSeverity ) ) << ": "
<< vk::to_string( static_cast<vk::DebugUtilsMessageTypeFlagsEXT>( messageTypes ) ) << ":\n";
message << vk::to_string( messageSeverity ) << ": " << vk::to_string( messageTypes ) << ":\n";
message << std::string( "\t" ) << "messageIDName = <" << pCallbackData->pMessageIdName << ">\n";
message << std::string( "\t" ) << "messageIdNumber = " << pCallbackData->messageIdNumber << "\n";
message << std::string( "\t" ) << "message = <" << pCallbackData->pMessage << ">\n";
@ -58,7 +57,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( VkDebugUtilsMessageSeverityFlag
for ( uint32_t i = 0; i < pCallbackData->objectCount; i++ )
{
message << std::string( "\t\t" ) << "Object " << i << "\n";
message << std::string( "\t\t\t" ) << "objectType = " << vk::to_string( static_cast<vk::ObjectType>( pCallbackData->pObjects[i].objectType ) ) << "\n";
message << std::string( "\t\t\t" ) << "objectType = " << vk::to_string( pCallbackData->pObjects[i].objectType ) << "\n";
message << std::string( "\t\t\t" ) << "objectHandle = " << pCallbackData->pObjects[i].objectHandle << "\n";
if ( pCallbackData->pObjects[i].pObjectName )
{

View File

@ -47,9 +47,7 @@ int main( int /*argc*/, char ** /*argv*/ )
/* VULKAN_KEY_START */
vk::DebugUtilsObjectNameInfoEXT debugUtilsObjectNameInfo(
vk::ObjectType::eImage, NON_DISPATCHABLE_HANDLE_TO_UINT64_CAST( VkImage, static_cast<vk ::Image>( image ) ), "Image name" );
device.setDebugUtilsObjectNameEXT( debugUtilsObjectNameInfo );
device.setDebugUtilsObjectNameEXT( *image, "Image name" );
/* VULKAN_KEY_END */
}

View File

@ -19,7 +19,7 @@
#include "../../samples/utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>
#include <thread>

View File

@ -23,7 +23,7 @@
#include "../../samples/utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>
#include <thread>

View File

@ -17,7 +17,8 @@
#if defined( _MSC_VER )
// no need to ignore any warnings with MSVC
#elif defined( __clang__ )
#endif
#if defined( __clang__ )
# pragma clang diagnostic ignored "-Wunused-variable"
#elif defined( __GNUC__ )
# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
@ -51,15 +52,14 @@ VKAPI_ATTR void VKAPI_CALL vkDestroyDebugUtilsMessengerEXT( VkInstance instance,
return pfnVkDestroyDebugUtilsMessengerEXT( instance, messenger, pAllocator );
}
VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
VkDebugUtilsMessageTypeFlagsEXT messageTypes,
VkDebugUtilsMessengerCallbackDataEXT const * pCallbackData,
VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( vk::DebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
vk::DebugUtilsMessageTypeFlagsEXT messageTypes,
vk::DebugUtilsMessengerCallbackDataEXT const * pCallbackData,
void * /*pUserData*/ )
{
std::string message;
message += vk::to_string( static_cast<vk::DebugUtilsMessageSeverityFlagBitsEXT>( messageSeverity ) ) + ": " +
vk::to_string( static_cast<vk::DebugUtilsMessageTypeFlagsEXT>( messageTypes ) ) + ":\n";
message += vk::to_string( messageSeverity ) + ": " + vk::to_string( messageTypes ) + ":\n";
message += std::string( "\t" ) + "messageIDName = <" + pCallbackData->pMessageIdName + ">\n";
message += std::string( "\t" ) + "messageIdNumber = " + std::to_string( pCallbackData->messageIdNumber ) + "\n";
message += std::string( "\t" ) + "message = <" + pCallbackData->pMessage + ">\n";
@ -84,7 +84,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( VkDebugUtilsMessageSeverityFlag
for ( uint32_t i = 0; i < pCallbackData->objectCount; i++ )
{
message += std::string( "\t" ) + "Object " + std::to_string( i ) + "\n";
message += std::string( "\t\t" ) + "objectType = " + vk::to_string( static_cast<vk::ObjectType>( pCallbackData->pObjects[i].objectType ) ) + "\n";
message += std::string( "\t\t" ) + "objectType = " + vk::to_string( pCallbackData->pObjects[i].objectType ) + "\n";
message += std::string( "\t\t" ) + "objectHandle = " + std::to_string( pCallbackData->pObjects[i].objectHandle ) + "\n";
if ( pCallbackData->pObjects[i].pObjectName )
{

View File

@ -58,7 +58,7 @@ int main( int /*argc*/, char ** /*argv*/ )
int timeouts = -1;
do
{
result = device.waitForFences( { fence }, true, vk::su::FenceTimeout );
result = device.waitForFences( *fence, true, vk::su::FenceTimeout );
timeouts++;
} while ( result == vk::Result::eTimeout );
assert( result == vk::Result::eSuccess );
@ -75,16 +75,16 @@ int main( int /*argc*/, char ** /*argv*/ )
commandPool.reset();
commandBuffer.begin( vk::CommandBufferBeginInfo() );
commandBuffer.waitEvents( { event }, vk::PipelineStageFlagBits::eHost, vk::PipelineStageFlagBits::eBottomOfPipe, nullptr, nullptr, nullptr );
commandBuffer.waitEvents( *event, vk::PipelineStageFlagBits::eHost, vk::PipelineStageFlagBits::eBottomOfPipe, nullptr, nullptr, nullptr );
commandBuffer.end();
device.resetFences( { fence } );
device.resetFences( *fence );
// Note that stepping through this code in the debugger is a bad idea because the GPU can TDR waiting for the event.
// Execute the code from vk::Queue::submit() through vk::Device::setEvent() without breakpoints
graphicsQueue.submit( submitInfo, fence );
// We should timeout waiting for the fence because the GPU should be waiting on the event
result = device.waitForFences( { fence }, true, vk::su::FenceTimeout );
result = device.waitForFences( *fence, true, vk::su::FenceTimeout );
if ( result != vk::Result::eTimeout )
{
std::cout << "Didn't get expected timeout in vk::Device::waitForFences, exiting\n";
@ -96,11 +96,11 @@ int main( int /*argc*/, char ** /*argv*/ )
event.set();
do
{
result = device.waitForFences( { fence }, true, vk::su::FenceTimeout );
result = device.waitForFences( *fence, true, vk::su::FenceTimeout );
} while ( result == vk::Result::eTimeout );
assert( result == vk::Result::eSuccess );
device.resetFences( { fence } );
device.resetFences( *fence );
event.reset();
// reset the command buffer by resetting the complete command pool
@ -116,7 +116,7 @@ int main( int /*argc*/, char ** /*argv*/ )
assert( result == vk::Result::eEventReset );
// Send the command buffer and loop waiting for the event
graphicsQueue.submit( submitInfo, fence );
graphicsQueue.submit( submitInfo, *fence );
int polls = 0;
do
@ -128,7 +128,7 @@ int main( int /*argc*/, char ** /*argv*/ )
do
{
result = device.waitForFences( { fence }, true, vk::su::FenceTimeout );
result = device.waitForFences( *fence, true, vk::su::FenceTimeout );
} while ( result == vk::Result::eTimeout );
assert( result == vk::Result::eSuccess );

View File

@ -31,7 +31,7 @@
#include "../../samples/utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>
#include <thread>

View File

@ -17,7 +17,8 @@
#if defined( _MSC_VER )
// no need to ignore any warnings with MSVC
#elif defined( __clang__ )
#endif
#if defined( __clang__ )
# pragma clang diagnostic ignored "-Wunused-variable"
#elif defined( __GNUC__ )
# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
@ -25,11 +26,11 @@
// unknow compiler... just ignore the warnings for yourselves ;)
#endif
#include "../samples/utils/geometries.hpp"
#include "../samples/utils/math.hpp"
#include "../../samples/utils/geometries.hpp"
#include "../../samples/utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>

View File

@ -29,7 +29,7 @@
#include "../../samples/utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>
#include <thread>

View File

@ -31,7 +31,7 @@
#include "../../samples/utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>
#include <thread>

View File

@ -19,7 +19,7 @@
#include "../../samples/utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>
#include <thread>

View File

@ -40,22 +40,19 @@ int main( int /*argc*/, char ** /*argv*/ )
for ( size_t i = 0; i < groupProperties.size(); i++ )
{
std::cout << "Group Properties " << i << " :\n";
std::cout << "\t"
<< "physicalDeviceCount = " << groupProperties[i].physicalDeviceCount << "\n";
std::cout << "\t"
<< "physicalDevices:\n";
std::cout << "\t" << "physicalDeviceCount = " << groupProperties[i].physicalDeviceCount << "\n";
std::cout << "\t" << "physicalDevices:\n";
for ( size_t j = 0; j < groupProperties[i].physicalDeviceCount; j++ )
{
vk::raii::PhysicalDevice physicalDevice( instance, static_cast<VkPhysicalDevice>( groupProperties[i].physicalDevices[j] ) );
vk::raii::PhysicalDevice physicalDevice( instance, groupProperties[i].physicalDevices[j] );
std::cout << "\t\t" << j << " : " << physicalDevice.getProperties().deviceName << "\n";
}
std::cout << "\t"
<< "subsetAllocation = " << !!groupProperties[i].subsetAllocation << "\n";
std::cout << "\t" << "subsetAllocation = " << !!groupProperties[i].subsetAllocation << "\n";
std::cout << "\n";
if ( 1 < groupProperties[i].physicalDeviceCount )
{
vk::raii::PhysicalDevice physicalDevice( instance, static_cast<VkPhysicalDevice>( groupProperties[i].physicalDevices[0] ) );
vk::raii::PhysicalDevice physicalDevice( instance, groupProperties[i].physicalDevices[0] );
// get the QueueFamilyProperties of the first PhysicalDevice
std::vector<vk::QueueFamilyProperties> queueFamilyProperties = physicalDevice.getQueueFamilyProperties();

View File

@ -48,7 +48,6 @@ int main( int /*argc*/, char ** /*argv*/ )
std::cout << "PhysicalDevice " << i << " :" << std::endl;
// need to explicitly specify all the template arguments for getQueueFamilyProperties2 to make the compiler happy
using Chain = vk::StructureChain<vk::QueueFamilyProperties2, vk::QueueFamilyCheckpointPropertiesNV>;
auto queueFamilyProperties2 = physicalDevices[i].getQueueFamilyProperties2<Chain>();
for ( size_t j = 0; j < queueFamilyProperties2.size(); j++ )

View File

@ -28,14 +28,14 @@
#include "../../samples/utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <fstream>
#include <iomanip>
#include <thread>
// For timestamp code (getMilliseconds)
#ifdef WIN32
#ifdef _WIN32
# include <Windows.h>
#else
# include <sys/time.h>
@ -45,7 +45,7 @@ typedef unsigned long long timestamp_t;
timestamp_t getMilliseconds()
{
#ifdef WIN32
#ifdef _WIN32
LARGE_INTEGER frequency;
BOOL useQPC = QueryPerformanceFrequency( &frequency );
if ( useQPC )
@ -142,8 +142,7 @@ int main( int /*argc*/, char ** /*argv*/ )
/* VULKAN_KEY_START */
// Check disk for existing cache data
size_t startCacheSize = 0;
char * startCacheData = nullptr;
std::vector<char> startCacheData;
std::string cacheFileName = "pipeline_cache_data.bin";
std::ifstream readCacheStream( cacheFileName, std::ios_base::in | std::ios_base::binary );
@ -151,14 +150,14 @@ int main( int /*argc*/, char ** /*argv*/ )
{
// Determine cache size
readCacheStream.seekg( 0, readCacheStream.end );
startCacheSize = static_cast<size_t>( readCacheStream.tellg() );
size_t startCacheSize = static_cast<size_t>( readCacheStream.tellg() );
readCacheStream.seekg( 0, readCacheStream.beg );
// Allocate memory to hold the initial cache data
startCacheData = (char *)std::malloc( startCacheSize );
startCacheData.resize( startCacheSize );
// Read the data into our buffer
readCacheStream.read( startCacheData, startCacheSize );
readCacheStream.read( startCacheData.data(), startCacheData.size() );
// Clean up and print results
readCacheStream.close();
@ -171,7 +170,7 @@ int main( int /*argc*/, char ** /*argv*/ )
std::cout << " Pipeline cache miss!\n";
}
if ( startCacheData != nullptr )
if ( !startCacheData.empty() )
{
// Check for cache validity
//
@ -207,11 +206,12 @@ int main( int /*argc*/, char ** /*argv*/ )
uint32_t deviceID = 0;
uint8_t pipelineCacheUUID[VK_UUID_SIZE] = {};
memcpy( &headerLength, (uint8_t *)startCacheData + 0, 4 );
memcpy( &cacheHeaderVersion, (uint8_t *)startCacheData + 4, 4 );
memcpy( &vendorID, (uint8_t *)startCacheData + 8, 4 );
memcpy( &deviceID, (uint8_t *)startCacheData + 12, 4 );
memcpy( pipelineCacheUUID, (uint8_t *)startCacheData + 16, VK_UUID_SIZE );
uint8_t * startCacheDataPtr = reinterpret_cast<uint8_t *>( startCacheData.data() );
memcpy( &headerLength, startCacheDataPtr + 0, 4 );
memcpy( &cacheHeaderVersion, startCacheDataPtr + 4, 4 );
memcpy( &vendorID, startCacheDataPtr + 8, 4 );
memcpy( &deviceID, startCacheDataPtr + 12, 4 );
memcpy( pipelineCacheUUID, startCacheDataPtr + 16, VK_UUID_SIZE );
// Check each field and report bad values before freeing existing cache
bool badCache = false;
@ -257,9 +257,7 @@ int main( int /*argc*/, char ** /*argv*/ )
if ( badCache )
{
// Don't submit initial cache data if any version info is incorrect
free( startCacheData );
startCacheSize = 0;
startCacheData = nullptr;
startCacheData.clear();
// And clear out the old cache file for use in next run
std::cout << " Deleting cache entry " << cacheFileName << " to repopulate.\n";
@ -272,12 +270,11 @@ int main( int /*argc*/, char ** /*argv*/ )
}
// Feed the initial cache data into cache creation
vk::PipelineCacheCreateInfo pipelineCacheCreateInfo( {}, startCacheSize, startCacheData );
vk::PipelineCacheCreateInfo pipelineCacheCreateInfo( {}, startCacheData.size(), startCacheData.data() );
vk::raii::PipelineCache pipelineCache( device, pipelineCacheCreateInfo );
// Free our initialData now that pipeline cache has been created
free( startCacheData );
startCacheData = NULL;
startCacheData.clear();
// Time (roughly) taken to create the graphics pipeline
timestamp_t start = getMilliseconds();

View File

@ -28,7 +28,7 @@
#include "../../samples/utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <thread>

View File

@ -28,7 +28,7 @@
#include "../../samples/utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>
#include <thread>

View File

@ -20,7 +20,7 @@
#include "../../samples/utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>
#include <thread>

View File

@ -14,11 +14,6 @@
vulkan_hpp__setup_sample_raii(
NAME RayTracing
INCLUDE_DIRS
${CMAKE_SOURCE_DIR}/samples/RayTracing/common
${CMAKE_SOURCE_DIR}/samples/RayTracing/vulkannv
${CMAKE_SOURCE_DIR}/stb
${CMAKE_SOURCE_DIR}/tinyobjloader
HEADERS
CameraManipulator.hpp
SOURCES

View File

@ -28,6 +28,7 @@
#include "CameraManipulator.hpp"
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/glm.hpp>
#include <glm/gtx/rotate_vector.hpp>

View File

@ -44,7 +44,7 @@
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "CameraManipulator.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <glm/glm.hpp>
#include <glm/gtc/matrix_inverse.hpp>
@ -580,7 +580,7 @@ static void keyCallback( GLFWwindow * window, int key, int /*scancode*/, int act
switch ( key )
{
case GLFW_KEY_ESCAPE:
case 'Q': glfwSetWindowShouldClose( window, 1 ); break;
case 'Q' : glfwSetWindowShouldClose( window, 1 ); break;
case 'R':
{
AppInfo * appInfo = reinterpret_cast<AppInfo *>( glfwGetWindowUserPointer( window ) );
@ -724,7 +724,7 @@ int main( int /*argc*/, char ** /*argv*/ )
// Create Window Surface (using glfw)
VkSurfaceKHR glfwSurface;
VkResult err = glfwCreateWindowSurface( static_cast<VkInstance>( *instance ), window, nullptr, &glfwSurface );
VkResult err = glfwCreateWindowSurface( *instance, window, nullptr, &glfwSurface );
check_vk_result( err );
vk::raii::SurfaceKHR surface( instance, glfwSurface );
@ -1151,9 +1151,9 @@ int main( int /*argc*/, char ** /*argv*/ )
swapChainData.swapChain.acquireNextImage( vk::su::FenceTimeout, *perFrameData[frameIndex].presentCompleteSemaphore );
assert( result == vk::Result::eSuccess );
while ( vk::Result::eTimeout == device.waitForFences( { *perFrameData[frameIndex].fence }, VK_TRUE, vk::su::FenceTimeout ) )
while ( vk::Result::eTimeout == device.waitForFences( *perFrameData[frameIndex].fence, VK_TRUE, vk::su::FenceTimeout ) )
;
device.resetFences( { *perFrameData[frameIndex].fence } );
device.resetFences( *perFrameData[frameIndex].fence );
// reset the command buffer by resetting the complete command pool of this frame
perFrameData[frameIndex].commandPool.reset();
@ -1187,11 +1187,8 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::WriteDescriptorSet writeDescriptorSet( *rayTracingDescriptorSets[backBufferIndex], 1, 0, bindings[1].descriptorType, imageInfo );
device.updateDescriptorSets( writeDescriptorSet, nullptr );
vk::raii::su::setImageLayout( commandBuffer,
static_cast<vk::Image>( swapChainData.images[backBufferIndex] ),
surfaceFormat.format,
vk::ImageLayout::eUndefined,
vk::ImageLayout::eGeneral );
vk::raii::su::setImageLayout(
commandBuffer, swapChainData.images[backBufferIndex], surfaceFormat.format, vk::ImageLayout::eUndefined, vk::ImageLayout::eGeneral );
commandBuffer.bindPipeline( vk::PipelineBindPoint::eRayTracingNV, *rayTracingPipeline );
@ -1213,11 +1210,8 @@ int main( int /*argc*/, char ** /*argv*/ )
windowExtent.height,
1 );
vk::raii::su::setImageLayout( commandBuffer,
static_cast<vk::Image>( swapChainData.images[backBufferIndex] ),
surfaceFormat.format,
vk::ImageLayout::eGeneral,
vk::ImageLayout::ePresentSrcKHR );
vk::raii::su::setImageLayout(
commandBuffer, swapChainData.images[backBufferIndex], surfaceFormat.format, vk::ImageLayout::eGeneral, vk::ImageLayout::ePresentSrcKHR );
}
// frame end
@ -1235,9 +1229,9 @@ int main( int /*argc*/, char ** /*argv*/ )
result = presentQueue.presentKHR( presentInfoKHR );
switch ( result )
{
case vk::Result::eSuccess: break;
case vk::Result::eSuccess : break;
case vk::Result::eSuboptimalKHR: std::cout << "vk::Queue::presentKHR returned vk::Result::eSuboptimalKHR !\n"; break;
default: assert( false ); // an unexpected result is returned !
default : assert( false ); // an unexpected result is returned !
}
frameIndex = ( frameIndex + 1 ) % IMGUI_VK_QUEUED_FRAMES;

View File

@ -29,7 +29,7 @@
#include "../../samples/utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>
#include <thread>
@ -146,11 +146,8 @@ int main( int /*argc*/, char ** /*argv*/ )
assert( result == vk::Result::eSuccess );
assert( imageIndex < swapChainData.images.size() );
vk::raii::su::setImageLayout( commandBuffer,
static_cast<vk::Image>( swapChainData.images[imageIndex] ),
swapChainData.colorFormat,
vk::ImageLayout::eUndefined,
vk::ImageLayout::eColorAttachmentOptimal );
vk::raii::su::setImageLayout(
commandBuffer, swapChainData.images[imageIndex], swapChainData.colorFormat, vk::ImageLayout::eUndefined, vk::ImageLayout::eColorAttachmentOptimal );
const vk::DeviceSize offset = 0;
vk::Viewport viewport( 0.0f, 0.0f, 200.0f, 200.0f, 0.0f, 1.0f );
@ -197,7 +194,7 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::ImageLayout::ePresentSrcKHR,
VK_QUEUE_FAMILY_IGNORED,
VK_QUEUE_FAMILY_IGNORED,
static_cast<vk::Image>( swapChainData.images[imageIndex] ),
swapChainData.images[imageIndex],
imageSubresourceRange );
commandBuffer.pipelineBarrier(
vk::PipelineStageFlagBits::eColorAttachmentOutput, vk::PipelineStageFlagBits::eBottomOfPipe, vk::DependencyFlags(), nullptr, nullptr, prePresentBarrier );
@ -215,9 +212,9 @@ int main( int /*argc*/, char ** /*argv*/ )
result = presentQueue.presentKHR( vk::PresentInfoKHR( {}, *swapChainData.swapChain, imageIndex, {} ) );
switch ( result )
{
case vk::Result::eSuccess: break;
case vk::Result::eSuccess : break;
case vk::Result::eSuboptimalKHR: std::cout << "vk::Queue::presentKHR returned vk::Result::eSuboptimalKHR !\n"; break;
default: assert( false ); // an unexpected result is returned !
default : assert( false ); // an unexpected result is returned !
}
std::this_thread::sleep_for( std::chrono::milliseconds( 1000 ) );

View File

@ -28,7 +28,7 @@
#include "../../samples/utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>
#include <thread>

View File

@ -84,12 +84,11 @@ int main( int /*argc*/, char ** /*argv*/ )
std::cout << "PhysicalDevice " << i << "\n";
if ( supportsGetSurfaceCapabilities2 )
{
auto surfaceCapabilities2 =
physicalDevices[i]
.getSurfaceCapabilities2KHR<vk::SurfaceCapabilities2KHR,
vk::DisplayNativeHdrSurfaceCapabilitiesAMD,
vk::SharedPresentSurfaceCapabilitiesKHR,
vk::SurfaceProtectedCapabilitiesKHR>( { static_cast<vk::SurfaceKHR>( surfaceData.surface ) } );
auto surfaceCapabilities2 = physicalDevices[i]
.getSurfaceCapabilities2KHR<vk::SurfaceCapabilities2KHR,
vk::DisplayNativeHdrSurfaceCapabilitiesAMD,
vk::SharedPresentSurfaceCapabilitiesKHR,
vk::SurfaceProtectedCapabilitiesKHR>( { *surfaceData.surface } );
vk::SurfaceCapabilitiesKHR const & surfaceCapabilities = surfaceCapabilities2.get<vk::SurfaceCapabilities2KHR>().surfaceCapabilities;
cout( surfaceCapabilities );

View File

@ -19,7 +19,7 @@
#include "../../samples/utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>
#include <thread>

View File

@ -19,7 +19,7 @@
#include "../../samples/utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>
#include <thread>

View File

@ -101,20 +101,20 @@ namespace vk
switch ( oldImageLayout )
{
case vk::ImageLayout::eTransferDstOptimal: sourceAccessMask = vk::AccessFlagBits::eTransferWrite; break;
case vk::ImageLayout::ePreinitialized: sourceAccessMask = vk::AccessFlagBits::eHostWrite; break;
case vk::ImageLayout::eGeneral: // sourceAccessMask is empty
case vk::ImageLayout::eUndefined: break;
default: assert( false ); break;
case vk::ImageLayout::ePreinitialized : sourceAccessMask = vk::AccessFlagBits::eHostWrite; break;
case vk::ImageLayout::eGeneral : // sourceAccessMask is empty
case vk::ImageLayout::eUndefined : break;
default : assert( false ); break;
}
vk::PipelineStageFlags sourceStage;
switch ( oldImageLayout )
{
case vk::ImageLayout::eGeneral:
case vk::ImageLayout::ePreinitialized: sourceStage = vk::PipelineStageFlagBits::eHost; break;
case vk::ImageLayout::ePreinitialized : sourceStage = vk::PipelineStageFlagBits::eHost; break;
case vk::ImageLayout::eTransferDstOptimal: sourceStage = vk::PipelineStageFlagBits::eTransfer; break;
case vk::ImageLayout::eUndefined: sourceStage = vk::PipelineStageFlagBits::eTopOfPipe; break;
default: assert( false ); break;
case vk::ImageLayout::eUndefined : sourceStage = vk::PipelineStageFlagBits::eTopOfPipe; break;
default : assert( false ); break;
}
vk::AccessFlags destinationAccessMask;
@ -125,24 +125,24 @@ namespace vk
destinationAccessMask = vk::AccessFlagBits::eDepthStencilAttachmentRead | vk::AccessFlagBits::eDepthStencilAttachmentWrite;
break;
case vk::ImageLayout::eGeneral: // empty destinationAccessMask
case vk::ImageLayout::ePresentSrcKHR: break;
case vk::ImageLayout::ePresentSrcKHR : break;
case vk::ImageLayout::eShaderReadOnlyOptimal: destinationAccessMask = vk::AccessFlagBits::eShaderRead; break;
case vk::ImageLayout::eTransferSrcOptimal: destinationAccessMask = vk::AccessFlagBits::eTransferRead; break;
case vk::ImageLayout::eTransferDstOptimal: destinationAccessMask = vk::AccessFlagBits::eTransferWrite; break;
default: assert( false ); break;
case vk::ImageLayout::eTransferSrcOptimal : destinationAccessMask = vk::AccessFlagBits::eTransferRead; break;
case vk::ImageLayout::eTransferDstOptimal : destinationAccessMask = vk::AccessFlagBits::eTransferWrite; break;
default : assert( false ); break;
}
vk::PipelineStageFlags destinationStage;
switch ( newImageLayout )
{
case vk::ImageLayout::eColorAttachmentOptimal: destinationStage = vk::PipelineStageFlagBits::eColorAttachmentOutput; break;
case vk::ImageLayout::eColorAttachmentOptimal : destinationStage = vk::PipelineStageFlagBits::eColorAttachmentOutput; break;
case vk::ImageLayout::eDepthStencilAttachmentOptimal: destinationStage = vk::PipelineStageFlagBits::eEarlyFragmentTests; break;
case vk::ImageLayout::eGeneral: destinationStage = vk::PipelineStageFlagBits::eHost; break;
case vk::ImageLayout::ePresentSrcKHR: destinationStage = vk::PipelineStageFlagBits::eBottomOfPipe; break;
case vk::ImageLayout::eShaderReadOnlyOptimal: destinationStage = vk::PipelineStageFlagBits::eFragmentShader; break;
case vk::ImageLayout::eTransferDstOptimal:
case vk::ImageLayout::eTransferSrcOptimal: destinationStage = vk::PipelineStageFlagBits::eTransfer; break;
default: assert( false ); break;
case vk::ImageLayout::eGeneral : destinationStage = vk::PipelineStageFlagBits::eHost; break;
case vk::ImageLayout::ePresentSrcKHR : destinationStage = vk::PipelineStageFlagBits::eBottomOfPipe; break;
case vk::ImageLayout::eShaderReadOnlyOptimal : destinationStage = vk::PipelineStageFlagBits::eFragmentShader; break;
case vk::ImageLayout::eTransferDstOptimal :
case vk::ImageLayout::eTransferSrcOptimal : destinationStage = vk::PipelineStageFlagBits::eTransfer; break;
default : assert( false ); break;
}
vk::ImageAspectFlags aspectMask;
@ -246,9 +246,9 @@ namespace vk
vk::raii::Buffer buffer = nullptr;
#if !defined( NDEBUG )
private:
vk::DeviceSize m_size;
vk::BufferUsageFlags m_usage;
vk::MemoryPropertyFlags m_propertyFlags;
vk::DeviceSize m_size = 0;
vk::BufferUsageFlags m_usage = {};
vk::MemoryPropertyFlags m_propertyFlags = {};
#endif
};
@ -315,7 +315,7 @@ namespace vk
: extent( extent_ ), window( vk::su::createWindow( windowName, extent ) )
{
VkSurfaceKHR _surface;
VkResult err = glfwCreateWindowSurface( static_cast<VkInstance>( *instance ), window.handle, nullptr, &_surface );
VkResult err = glfwCreateWindowSurface( *instance, window.handle, nullptr, &_surface );
if ( err != VK_SUCCESS )
throw std::runtime_error( "Failed to create window!" );
surface = vk::raii::SurfaceKHR( instance, _surface );
@ -342,7 +342,7 @@ namespace vk
vk::SurfaceCapabilitiesKHR surfaceCapabilities = physicalDevice.getSurfaceCapabilitiesKHR( surface );
vk::Extent2D swapchainExtent;
if ( surfaceCapabilities.currentExtent.width == std::numeric_limits<uint32_t>::max() )
if ( surfaceCapabilities.currentExtent.width == ( std::numeric_limits<uint32_t>::max )() )
{
// If the surface size is undefined, the size is set to the size of the images requested.
swapchainExtent.width = vk::su::clamp( extent.width, surfaceCapabilities.minImageExtent.width, surfaceCapabilities.maxImageExtent.width );
@ -364,7 +364,7 @@ namespace vk
vk::PresentModeKHR presentMode = vk::su::pickPresentMode( physicalDevice.getSurfacePresentModesKHR( surface ) );
vk::SwapchainCreateInfoKHR swapChainCreateInfo( {},
surface,
vk::su::clamp( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
vk::su::clampSurfaceImageCount( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
colorFormat,
surfaceFormat.colorSpace,
swapchainExtent,
@ -509,7 +509,7 @@ namespace vk
vk::raii::SurfaceKHR const & surface )
{
std::vector<vk::QueueFamilyProperties> queueFamilyProperties = physicalDevice.getQueueFamilyProperties();
assert( queueFamilyProperties.size() < std::numeric_limits<uint32_t>::max() );
assert( queueFamilyProperties.size() < ( std::numeric_limits<uint32_t>::max )() );
uint32_t graphicsQueueFamilyIndex = vk::su::findGraphicsQueueFamilyIndex( queueFamilyProperties );
if ( physicalDevice.getSurfaceSupportKHR( graphicsQueueFamilyIndex, surface ) )
@ -749,7 +749,7 @@ namespace vk
#else
vk::StructureChain<vk::InstanceCreateInfo, vk::DebugUtilsMessengerCreateInfoEXT>
#endif
instanceCreateInfoChain = vk::su::makeInstanceCreateInfoChain( applicationInfo, enabledLayers, enabledExtensions );
instanceCreateInfoChain = vk::su::makeInstanceCreateInfoChain( {}, applicationInfo, enabledLayers, enabledExtensions );
return vk::raii::Instance( context, instanceCreateInfoChain.get<vk::InstanceCreateInfo>() );
}
@ -896,5 +896,5 @@ namespace vk
}
} // namespace su
} // namespace raii
} // namespace raii
} // namespace vk

668
README.md

File diff suppressed because it is too large Load Diff

View File

@ -16,6 +16,7 @@
#include "XMLHelper.hpp"
#include <algorithm>
#include <iostream>
#include <vector>
@ -32,44 +33,21 @@ VideoHppGenerator::VideoHppGenerator( tinyxml2::XMLDocument const & document )
checkCorrectness();
}
void VideoHppGenerator::generateCppmFile() const
{
generateFileFromTemplate(
"vulkan_video.cppm", "VideoCppmTemplate.hpp", { { "copyrightMessage", m_copyrightMessage }, { "usings", generateCppModuleUsings() } } );
}
void VideoHppGenerator::generateHppFile() const
{
std::string const video_hpp = std::string( BASE_PATH ) + "/vulkan/" + "vulkan_video.hpp";
std::cout << "VideoHppGenerator: Generating " << video_hpp << " ... " << std::endl;
std::string const videoHppTemplate = R"(${copyrightMessage}
#ifndef VULKAN_VIDEO_HPP
#define VULKAN_VIDEO_HPP
#include <vk_video/vulkan_video_codecs_common.h>
#include <vk_video/vulkan_video_codec_h264std.h>
#include <vk_video/vulkan_video_codec_h264std_decode.h>
#include <vk_video/vulkan_video_codec_h264std_encode.h>
#include <vk_video/vulkan_video_codec_h265std.h>
#include <vk_video/vulkan_video_codec_h265std_decode.h>
#include <vk_video/vulkan_video_codec_h265std_encode.h>
#include <vulkan/vulkan.hpp>
#if !defined( VULKAN_HPP_VIDEO_NAMESPACE )
# define VULKAN_HPP_VIDEO_NAMESPACE video
#endif
namespace VULKAN_HPP_NAMESPACE
{
namespace VULKAN_HPP_VIDEO_NAMESPACE
{
${enums}
${structs}
} // namespace VULKAN_HPP_VIDEO_NAMESPACE
} // namespace VULKAN_HPP_NAMESPACE
#endif
)";
std::string str =
replaceWithMap( videoHppTemplate, { { "copyrightMessage", m_copyrightMessage }, { "enums", generateEnums() }, { "structs", generateStructs() } } );
writeToFile( str, video_hpp );
generateFileFromTemplate( "vulkan_video.hpp",
"VideoHppTemplate.hpp",
{ { "constants", generateConstants() },
{ "copyrightMessage", m_copyrightMessage },
{ "enums", generateEnums() },
{ "includes", generateIncludes() },
{ "structs", generateStructs() } } );
}
void VideoHppGenerator::addImplicitlyRequiredTypes()
@ -114,6 +92,14 @@ std::vector<std::string>::iterator VideoHppGenerator::addImplicitlyRequiredTypes
return reqIt;
}
void VideoHppGenerator::checkAttributes( int line,
std::map<std::string, std::string> const & attributes,
std::map<std::string, std::set<std::string>> const & required,
std::map<std::string, std::set<std::string>> const & optional ) const
{
::checkAttributes( "VideoHppGenerator", line, attributes, required, optional );
}
void VideoHppGenerator::checkCorrectness() const
{
// only structs to check here!
@ -126,8 +112,7 @@ void VideoHppGenerator::checkCorrectness() const
checkForError( !typeIt->second.requiredBy.empty(), structure.second.xmlLine, "structure <" + structure.first + "> not required by any extension" );
assert( typeIt->second.requiredBy.size() == 1 );
auto extIt =
std::find_if( m_extensions.begin(), m_extensions.end(), [&typeIt]( ExtensionData const & ed ) { return ed.name == *typeIt->second.requiredBy.begin(); } );
auto extIt = std::ranges::find_if( m_extensions, [&typeIt]( ExtensionData const & ed ) { return ed.name == *typeIt->second.requiredBy.begin(); } );
assert( extIt != m_extensions.end() );
// checks on the members of a struct
@ -156,7 +141,7 @@ void VideoHppGenerator::checkCorrectness() const
{
checkForError(
!extIt->depends.empty(), extIt->xmlLine, "struct member <" + member.name + "> uses unknown constant <" + arraySize + "> as array size" );
auto depIt = std::find_if( m_extensions.begin(), m_extensions.end(), [&extIt]( ExtensionData const & ed ) { return ed.name == extIt->depends; } );
auto depIt = std::ranges::find_if( m_extensions, [&extIt]( ExtensionData const & ed ) { return ed.name == extIt->depends; } );
assert( depIt != m_extensions.end() );
checkForError( depIt->requireData.constants.contains( arraySize ),
member.xmlLine,
@ -168,6 +153,60 @@ void VideoHppGenerator::checkCorrectness() const
}
}
void VideoHppGenerator::checkElements( int line,
std::vector<tinyxml2::XMLElement const *> const & elements,
std::map<std::string, bool> const & required,
std::set<std::string> const & optional ) const
{
::checkElements( "VideoHppGenerator", line, elements, required, optional );
}
void VideoHppGenerator::checkForError( bool condition, int line, std::string const & message ) const
{
::checkForError( "VideoHppGenerator", condition, line, message );
}
void VideoHppGenerator::checkForWarning( bool condition, int line, std::string const & message ) const
{
::checkForWarning( "VideoHppGenerator", condition, line, message );
}
std::string VideoHppGenerator::generateConstants() const
{
{
const std::string enumsTemplate = R"(
//=================
//=== CONSTANTs ===
//=================
${constants}
)";
std::string constants;
for ( auto const & extension : m_extensions )
{
constants += generateConstants( extension );
}
return replaceWithMap( enumsTemplate, { { "constants", constants } } );
}
}
std::string VideoHppGenerator::generateConstants( ExtensionData const & extensionData ) const
{
std::string str;
for ( auto const & constant : extensionData.requireData.constants )
{
str += "VULKAN_HPP_CONSTEXPR_INLINE " + constant.second.type + " " + toCamelCase( stripPrefix( constant.first, "STD_VIDEO_" ), true ) + " = " +
constant.second.value + ";\n";
}
if ( !str.empty() )
{
str = "\n#if defined( " + extensionData.protect + " )\n //=== " + extensionData.name + " ===\n" + str + "#endif\n";
}
return str;
}
std::string VideoHppGenerator::generateEnum( std::pair<std::string, EnumData> const & enumData ) const
{
std::string enumValues;
@ -182,6 +221,14 @@ std::string VideoHppGenerator::generateEnum( std::pair<std::string, EnumData> co
std::string valueName = "e" + toCamelCase( stripPrefix( value.name, prefix ), true );
assert( valueToNameMap.insert( { valueName, value.name } ).second );
enumValues += " " + valueName + " = " + value.name + ",\n";
for ( auto const & alias : value.aliases )
{
std::string aliasName = "e" + toCamelCase( stripPrefix( alias.first, prefix ), true );
assert( valueToNameMap.insert( { aliasName, alias.first } ).second );
enumValues += " " + aliasName + " VULKAN_HPP_DEPRECATED_17( \"" + aliasName + " is deprecated, " + valueName +
" should be used instead.\" ) = " + alias.first + ",\n";
}
}
if ( !enumValues.empty() )
@ -213,17 +260,17 @@ ${enums}
std::string enums;
for ( auto const & extension : m_extensions )
{
enums += generateEnums( extension.requireData, extension.name );
enums += generateEnums( extension );
}
return replaceWithMap( enumsTemplate, { { "enums", enums } } );
}
}
std::string VideoHppGenerator::generateEnums( RequireData const & requireData, std::string const & title ) const
std::string VideoHppGenerator::generateEnums( ExtensionData const & extensionData ) const
{
std::string str;
for ( auto const & type : requireData.types )
for ( auto const & type : extensionData.requireData.types )
{
auto enumIt = m_enums.find( type );
if ( enumIt != m_enums.end() )
@ -233,11 +280,91 @@ std::string VideoHppGenerator::generateEnums( RequireData const & requireData, s
}
if ( !str.empty() )
{
str = "\n //=== " + title + " ===\n" + str;
str = "\n#if defined( " + extensionData.protect + " )\n //=== " + extensionData.name + " ===\n" + str + "#endif\n";
}
return str;
}
std::string VideoHppGenerator::generateIncludes() const
{
std::string includes;
for ( auto const & extension : m_extensions )
{
std::string include = "<vk_video/" + extension.name + ".h>";
includes += "#if __has_include( " + include + " )\n";
includes += "# include <vk_video/" + extension.name + ".h>\n";
includes += "#endif\n";
}
return includes;
}
std::string VideoHppGenerator::generateCppModuleConstantUsings() const
{
const std::string enumsTemplate = R"(
//=================
//=== CONSTANTs ===
//=================
${constants}
)";
std::string constants;
for ( auto const & extension : m_extensions )
{
std::string constantsPerExtension;
for ( auto const & type : extension.requireData.constants )
{
constantsPerExtension +=
"using VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE::" + toCamelCase( stripPrefix( type.first, "STD_VIDEO_" ), true ) + ";\n";
}
if ( !constantsPerExtension.empty() )
{
constantsPerExtension = "\n#if defined( " + extension.protect + " )\n //=== " + extension.name + " ===\n" + constantsPerExtension + "#endif\n";
}
constants += constantsPerExtension;
}
return replaceWithMap( enumsTemplate, { { "constants", constants } } );
}
std::string VideoHppGenerator::generateCppModuleEnumUsings() const
{
auto const usingTemplate = std::string{
R"( using VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE::${enumName};
)"
};
const std::string enumsTemplate = R"(
//=============
//=== ENUMs ===
//=============
${enums}
)";
std::string enums;
for ( auto const & extension : m_extensions )
{
std::string enumsPerExtension;
for ( auto const & type : extension.requireData.types )
{
auto enumIt = m_enums.find( type );
if ( enumIt != m_enums.end() )
{
enumsPerExtension += replaceWithMap( usingTemplate, { { "enumName", stripPrefix( enumIt->first, "StdVideo" ) } } );
}
}
if ( !enumsPerExtension.empty() )
{
enumsPerExtension = "\n#if defined( " + extension.protect + " )\n //=== " + extension.name + " ===\n" + enumsPerExtension + "#endif\n";
}
enums += enumsPerExtension;
}
return replaceWithMap( enumsTemplate, { { "enums", enums } } );
}
std::string VideoHppGenerator::generateStruct( std::pair<std::string, StructureData> const & structData ) const
{
static const std::string structureTemplate = R"( struct ${structureType}
@ -253,6 +380,16 @@ std::string VideoHppGenerator::generateStruct( std::pair<std::string, StructureD
{
return *reinterpret_cast<StdVideo${structureType}*>( this );
}
operator StdVideo${structureType} const *() const VULKAN_HPP_NOEXCEPT
{
return reinterpret_cast<const StdVideo${structureType}*>( this );
}
operator StdVideo${structureType} *() VULKAN_HPP_NOEXCEPT
{
return reinterpret_cast<StdVideo${structureType}*>( this );
}
${compareOperators}
public:
${members}
@ -322,12 +459,12 @@ std::string VideoHppGenerator::generateStructMembers( std::pair<std::string, Str
}
else if ( member.arraySizes.empty() )
{
type = member.type.compose( "VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE", "StdVideo" );
type = member.type.compose( "StdVideo", "VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE" );
}
else
{
assert( member.type.prefix.empty() && member.type.postfix.empty() );
type = generateStandardArrayWrapper( member.type.compose( "VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE" ), member.arraySizes );
type = generateStandardArrayWrapper( member.type.compose( "" ), member.arraySizes );
}
members += type + " " + member.name;
@ -374,15 +511,15 @@ ${structs}
std::string structs;
for ( auto const & extension : m_extensions )
{
structs += generateStructs( extension.requireData, extension.name );
structs += generateStructs( extension );
}
return replaceWithMap( structsTemplate, { { "structs", structs } } );
}
std::string VideoHppGenerator::generateStructs( RequireData const & requireData, std::string const & title ) const
std::string VideoHppGenerator::generateStructs( ExtensionData const & extensionData ) const
{
std::string str;
for ( auto const & type : requireData.types )
for ( auto const & type : extensionData.requireData.types )
{
auto structIt = m_structs.find( type );
if ( structIt != m_structs.end() )
@ -392,25 +529,72 @@ std::string VideoHppGenerator::generateStructs( RequireData const & requireData,
}
if ( !str.empty() )
{
str = "\n //=== " + title + " ===\n" + str;
str = "\n#if defined( " + extensionData.protect + " )\n //=== " + extensionData.name + " ===\n" + str + "#endif\n";
}
return str;
}
std::string VideoHppGenerator::generateCppModuleStructUsings() const
{
auto const usingTemplate = std::string{
R"( using VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE::${structName};
)"
};
const std::string structsTemplate = R"(
//===============
//=== STRUCTS ===
//===============
${structs}
)";
std::string structs;
for ( auto const & extension : m_extensions )
{
std::string structsPerExtension;
for ( auto const & type : extension.requireData.types )
{
auto structIt = m_structs.find( type );
if ( structIt != m_structs.end() )
{
structsPerExtension += replaceWithMap( usingTemplate, { { "structName", stripPrefix( structIt->first, "StdVideo" ) } } );
}
}
if ( !structsPerExtension.empty() )
{
structsPerExtension = "\n#if defined( " + extension.protect + " )\n //=== " + extension.name + " ===\n" + structsPerExtension + "#endif\n";
}
structs += structsPerExtension;
}
return replaceWithMap( structsTemplate, { { "structs", structs } } );
}
std::string VideoHppGenerator::generateCppModuleUsings() const
{
return generateCppModuleConstantUsings() + generateCppModuleEnumUsings() + generateCppModuleStructUsings();
}
bool VideoHppGenerator::isExtension( std::string const & name ) const
{
return std::any_of( m_extensions.begin(), m_extensions.end(), [&name]( ExtensionData const & ed ) { return ed.name == name; } );
return std::ranges::any_of( m_extensions, [&name]( ExtensionData const & ed ) { return ed.name == name; } );
}
std::string VideoHppGenerator::readComment( tinyxml2::XMLElement const * element ) const
{
return ::readComment( "VideoHppGenerator", element );
}
void VideoHppGenerator::readEnums( tinyxml2::XMLElement const * element )
{
int line = element->GetLineNum();
std::map<std::string, std::string> attributes = getAttributes( element );
checkAttributes( line, attributes, { { "name", {} }, { "type", { "enum" } } }, {} );
checkAttributes( line, attributes, { { "name", {} } }, { { "type", { "enum" } } } );
std::vector<tinyxml2::XMLElement const *> children = getChildElements( element );
checkElements( line, children, { { "enum", {} } }, { "comment" } );
std::string name, type;
std::string name;
for ( auto const & attribute : attributes )
{
if ( attribute.first == "name" )
@ -419,7 +603,8 @@ void VideoHppGenerator::readEnums( tinyxml2::XMLElement const * element )
}
else if ( attribute.first == "type" )
{
type = attribute.second;
assert( !name.empty() );
checkForError( attribute.second == "enum", line, "unknown type <" + attribute.second + "> for enum <" + name + ">" );
}
}
@ -443,30 +628,60 @@ void VideoHppGenerator::readEnumsEnum( tinyxml2::XMLElement const * element, std
{
int line = element->GetLineNum();
std::map<std::string, std::string> attributes = getAttributes( element );
checkAttributes( line, attributes, { { "name", {} }, { "value", {} } }, { { "comment", {} } } );
checkElements( line, getChildElements( element ), {} );
std::string name, value;
for ( auto const & attribute : attributes )
if ( attributes.contains( "alias" ) )
{
if ( attribute.first == "name" )
checkAttributes( line, attributes, { { "alias", {} }, { "deprecated", { "aliased" } }, { "name", {} } }, {} );
checkElements( line, getChildElements( element ), {} );
std::string alias, name;
for ( auto const & attribute : attributes )
{
name = attribute.second;
}
else if ( attribute.first == "value" )
{
value = attribute.second;
if ( attribute.first == "alias" )
{
alias = attribute.second;
}
else if ( attribute.first == "name" )
{
name = attribute.second;
}
}
assert( !name.empty() );
auto valueIt = std::ranges::find_if( enumIt->second.values, [&alias]( EnumValueData const & evd ) { return evd.name == alias; } );
checkForError( valueIt != enumIt->second.values.end(), line, "enum value <" + name + "> uses unknown alias <" + alias + ">" );
checkForError( std::ranges::find_if( valueIt->aliases, [&name]( auto const & alias ) { return alias.first == name; } ) == valueIt->aliases.end(),
line,
"enum alias <" + name + "> already listed for enum value <" + alias + ">" );
valueIt->aliases.push_back( { name, line } );
}
else
{
checkAttributes( line, attributes, { { "name", {} }, { "value", {} } }, { { "comment", {} } } );
checkElements( line, getChildElements( element ), {} );
std::string prefix = toUpperCase( enumIt->first ) + "_";
checkForError( name.starts_with( prefix ), line, "encountered enum value <" + name + "> that does not begin with expected prefix <" + prefix + ">" );
checkForError( isNumber( value ) || isHexNumber( value ), line, "enum value uses unknown constant <" + value + ">" );
std::string name, value;
for ( auto const & attribute : attributes )
{
if ( attribute.first == "name" )
{
name = attribute.second;
}
else if ( attribute.first == "value" )
{
value = attribute.second;
}
}
checkForError( std::none_of( enumIt->second.values.begin(), enumIt->second.values.end(), [&name]( EnumValueData const & evd ) { return evd.name == name; } ),
line,
"enum value <" + name + "> already part of enum <" + enumIt->first + ">" );
enumIt->second.values.push_back( { name, value, line } );
std::string prefix = toUpperCase( enumIt->first ) + "_";
checkForError( name.starts_with( prefix ), line, "encountered enum value <" + name + "> that does not begin with expected prefix <" + prefix + ">" );
checkForError( isNumber( value ) || isHexNumber( value ), line, "enum value uses unknown constant <" + value + ">" );
checkForError( std::ranges::none_of( enumIt->second.values, [&name]( EnumValueData const & evd ) { return evd.name == name; } ),
line,
"enum value <" + name + "> already part of enum <" + enumIt->first + ">" );
enumIt->second.values.push_back( { {}, name, value, line } );
}
}
void VideoHppGenerator::readExtension( tinyxml2::XMLElement const * element )
@ -475,18 +690,32 @@ void VideoHppGenerator::readExtension( tinyxml2::XMLElement const * element )
std::map<std::string, std::string> attributes = getAttributes( element );
std::vector<tinyxml2::XMLElement const *> children = getChildElements( element );
checkAttributes( line, attributes, { { "name", {} }, { "comment", {} }, { "supported", { "vulkan" } } }, {} );
checkAttributes( line, attributes, { { "name", {} }, { "comment", {} }, { "number", {} }, { "supported", { "vulkan" } } }, {} );
checkElements( line, children, { { "require", false } } );
ExtensionData extensionData{ .xmlLine = line };
std::string supported;
for ( auto const & attribute : attributes )
{
if ( attribute.first == "name" )
if ( attribute.first == "comment" )
{
checkForError(
attribute.second.starts_with( "protect with VULKAN_VIDEO_CODEC" ), line, "unexpected content of attribute <comment>: \"" + attribute.second + "\"" );
extensionData.protect = attribute.second.substr( strlen( "protect with " ) );
}
else if ( attribute.first == "name" )
{
extensionData.name = attribute.second;
checkForError( !isExtension( extensionData.name ), line, "already encountered extension <" + extensionData.name + ">" );
}
else if ( attribute.first == "number" )
{
extensionData.number = attribute.second;
checkForError( isNumber( extensionData.number ), line, "extension number <" + extensionData.number + "> is not a number" );
checkForError( std::ranges::none_of( m_extensions, [&extensionData]( auto const & extension ) { return extension.number == extensionData.number; } ),
line,
"extension number <" + extensionData.number + "> already encountered" );
}
else if ( attribute.first == "supported" )
{
supported = attribute.second;
@ -544,6 +773,11 @@ void VideoHppGenerator::readExtensions( tinyxml2::XMLElement const * element )
}
}
std::pair<std::vector<std::string>, std::string> VideoHppGenerator::readModifiers( tinyxml2::XMLNode const * node ) const
{
return ::readModifiers( "VulkanHppGenerator", node );
}
void VideoHppGenerator::readRegistry( tinyxml2::XMLElement const * element )
{
int line = element->GetLineNum();
@ -584,15 +818,19 @@ void VideoHppGenerator::readRequireEnum( tinyxml2::XMLElement const * element, s
int line = element->GetLineNum();
std::map<std::string, std::string> attributes = getAttributes( element );
checkElements( line, getChildElements( element ), {} );
checkAttributes( line, attributes, { { "name", {} }, { "value", {} } }, {} );
checkAttributes( line, attributes, { { "name", {} }, { "value", {} } }, { { "type", { "uint32_t", "uint8_t" } } } );
std::string name, value;
std::string name, type, value;
for ( auto const & attribute : attributes )
{
if ( attribute.first == "name" )
{
name = attribute.second;
}
else if ( attribute.first == "type" )
{
type = attribute.second;
}
else if ( attribute.first == "value" )
{
value = attribute.second;
@ -601,8 +839,9 @@ void VideoHppGenerator::readRequireEnum( tinyxml2::XMLElement const * element, s
if ( !name.ends_with( "_SPEC_VERSION" ) && !name.ends_with( "_EXTENSION_NAME" ) )
{
checkForError( !type.empty(), line, "constant <" + name + "> has no type specified" );
checkForError( isNumber( value ) || isHexNumber( value ), line, "enum value uses unknown constant <" + value + ">" );
checkForError( constants.insert( { name, { value, line } } ).second, line, "required enum <" + name + "> already specified" );
checkForError( constants.insert( { name, { type, value, line } } ).second, line, "required enum <" + name + "> already specified" );
}
}
@ -634,13 +873,26 @@ void VideoHppGenerator::readStructMember( tinyxml2::XMLElement const * element,
(void)members;
int line = element->GetLineNum();
std::map<std::string, std::string> attributes = getAttributes( element );
checkAttributes( line, attributes, {}, {} );
checkAttributes( line, attributes, {}, { { "len", {} }, { "optional", { "false", "true" } } } );
std::vector<tinyxml2::XMLElement const *> children = getChildElements( element );
checkElements( line, children, { { "name", true }, { "type", true } }, { "comment", "enum" } );
MemberData memberData;
memberData.xmlLine = line;
for ( auto const & attribute : attributes )
{
if ( attribute.first == "len" )
{
memberData.len = attribute.second;
// the "len" attribute can be something completely unrelated to this struct!! Can't to a checkForError whatsoever.
}
else if ( attribute.first == "optional" )
{
memberData.optional = attribute.second;
}
}
std::string name;
for ( auto child : children )
{
@ -672,9 +924,8 @@ void VideoHppGenerator::readStructMember( tinyxml2::XMLElement const * element,
}
assert( !name.empty() );
checkForError( std::none_of( members.begin(), members.end(), [&name]( MemberData const & md ) { return md.name == name; } ),
line,
"struct member name <" + name + "> already used" );
checkForError(
std::ranges::none_of( members, [&name]( MemberData const & md ) { return md.name == name; } ), line, "struct member name <" + name + "> already used" );
memberData.name = name;
members.push_back( memberData );
}
@ -816,7 +1067,7 @@ void VideoHppGenerator::readTypeStruct( tinyxml2::XMLElement const * element, st
checkForError( require.empty() || m_types.contains( require ), line, "struct <" + name + "> requires unknown type <" + require + ">" );
checkForError( m_types.insert( { name, TypeData{ TypeCategory::Struct, {}, line } } ).second, line, "struct <" + name + "> already specified" );
assert( !m_structs.contains( name ) );
std::map<std::string, StructureData>::iterator it = m_structs.insert( std::make_pair( name, structureData ) ).first;
std::map<std::string, StructureData>::iterator it = m_structs.insert( { name, structureData } ).first;
for ( auto child : children )
{
@ -899,10 +1150,9 @@ void VideoHppGenerator::sortStructs()
#if !defined( NDEBUG )
else
{
auto depIt = std::find_if( m_extensions.begin(), m_extensions.end(), [&ext]( ExtensionData const & ed ) { return ed.name == ext.depends; } );
assert( ( depIt != m_extensions.end() ) && std::any_of( depIt->requireData.types.begin(),
depIt->requireData.types.end(),
[&member]( std::string const & type ) { return type == member.type.type; } ) );
auto depIt = std::ranges::find_if( m_extensions, [&ext]( ExtensionData const & ed ) { return ed.name == ext.depends; } );
assert( ( depIt != m_extensions.end() ) &&
std::ranges::any_of( depIt->requireData.types, [&member]( std::string const & type ) { return type == member.type.type; } ) );
}
#endif
}
@ -959,6 +1209,7 @@ int main( int argc, char ** argv )
std::cout << "VideoHppGenerator: Parsing " << filename << std::endl;
VideoHppGenerator generator( doc );
generator.generateCppmFile();
generator.generateHppFile();
#if !defined( CLANG_FORMAT_EXECUTABLE )

View File

@ -25,11 +25,13 @@ class VideoHppGenerator
public:
VideoHppGenerator( tinyxml2::XMLDocument const & document );
void generateCppmFile() const;
void generateHppFile() const;
private:
struct ConstantData
{
std::string type = {};
std::string value = {};
int xmlLine = {};
};
@ -42,9 +44,10 @@ private:
struct EnumValueData
{
std::string name = {};
std::string value = {};
int xmlLine = {};
std::vector<std::pair<std::string, int>> aliases = {};
std::string name = {};
std::string value = {};
int xmlLine = {};
};
struct EnumData
@ -64,6 +67,8 @@ private:
{
std::string depends = {};
std::string name = {};
std::string number = {};
std::string protect = {};
RequireData requireData = {};
int xmlLine = 0;
};
@ -74,6 +79,8 @@ private:
std::string name = {};
std::vector<std::string> arraySizes = {};
std::string bitCount = {};
std::string len = {};
std::string optional = {};
int xmlLine = {};
};
@ -87,33 +94,52 @@ private:
void addImplicitlyRequiredTypes();
std::vector<std::string>::iterator
addImplicitlyRequiredTypes( std::map<std::string, TypeData>::iterator typeIt, ExtensionData & extensionData, std::vector<std::string>::iterator reqIt );
void checkAttributes( int line,
std::map<std::string, std::string> const & attributes,
std::map<std::string, std::set<std::string>> const & required,
std::map<std::string, std::set<std::string>> const & optional = {} ) const;
void checkCorrectness() const;
std::string generateEnum( std::pair<std::string, EnumData> const & enumData ) const;
std::string generateEnums() const;
std::string generateEnums( RequireData const & requireData, std::string const & title ) const;
std::string generateStruct( std::pair<std::string, StructureData> const & structData ) const;
std::string generateStructCompareOperators( std::pair<std::string, StructureData> const & structData ) const;
std::string generateStructMembers( std::pair<std::string, StructureData> const & structData ) const;
std::string generateStructs() const;
std::string generateStructs( RequireData const & requireData, std::string const & title ) const;
bool isExtension( std::string const & name ) const;
void readEnums( tinyxml2::XMLElement const * element );
void readEnumsEnum( tinyxml2::XMLElement const * element, std::map<std::string, EnumData>::iterator enumIt );
void readExtension( tinyxml2::XMLElement const * element );
void readExtensionRequire( tinyxml2::XMLElement const * element, ExtensionData & extensionData );
void readExtensions( tinyxml2::XMLElement const * element );
void readRegistry( tinyxml2::XMLElement const * element );
void readRequireEnum( tinyxml2::XMLElement const * element, std::map<std::string, ConstantData> & constants );
void readRequireType( tinyxml2::XMLElement const * element, ExtensionData & extensionData );
void readStructMember( tinyxml2::XMLElement const * element, std::vector<MemberData> & members );
void readTypeDefine( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
void readTypeEnum( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
void readTypeInclude( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
void readTypeRequires( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
void readTypes( tinyxml2::XMLElement const * element );
void readTypeStruct( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
void readTypesType( tinyxml2::XMLElement const * element );
void sortStructs();
void checkElements( int line,
std::vector<tinyxml2::XMLElement const *> const & elements,
std::map<std::string, bool> const & required,
std::set<std::string> const & optional = {} ) const;
void checkForError( bool condition, int line, std::string const & message ) const;
void checkForWarning( bool condition, int line, std::string const & message ) const;
std::string generateConstants() const;
std::string generateConstants( ExtensionData const & extensionData ) const;
std::string generateEnum( std::pair<std::string, EnumData> const & enumData ) const;
std::string generateEnums() const;
std::string generateEnums( ExtensionData const & extensionData ) const;
std::string generateIncludes() const;
std::string generateStruct( std::pair<std::string, StructureData> const & structData ) const;
std::string generateStructCompareOperators( std::pair<std::string, StructureData> const & structData ) const;
std::string generateStructMembers( std::pair<std::string, StructureData> const & structData ) const;
std::string generateStructs() const;
std::string generateStructs( ExtensionData const & extensionData ) const;
std::string generateCppModuleConstantUsings() const;
std::string generateCppModuleEnumUsings() const;
std::string generateCppModuleStructUsings() const;
std::string generateCppModuleUsings() const;
bool isExtension( std::string const & name ) const;
std::string readComment( tinyxml2::XMLElement const * element ) const;
void readEnums( tinyxml2::XMLElement const * element );
void readEnumsEnum( tinyxml2::XMLElement const * element, std::map<std::string, EnumData>::iterator enumIt );
void readExtension( tinyxml2::XMLElement const * element );
void readExtensionRequire( tinyxml2::XMLElement const * element, ExtensionData & extensionData );
void readExtensions( tinyxml2::XMLElement const * element );
std::pair<std::vector<std::string>, std::string> readModifiers( tinyxml2::XMLNode const * node ) const;
void readRegistry( tinyxml2::XMLElement const * element );
void readRequireEnum( tinyxml2::XMLElement const * element, std::map<std::string, ConstantData> & constants );
void readRequireType( tinyxml2::XMLElement const * element, ExtensionData & extensionData );
void readStructMember( tinyxml2::XMLElement const * element, std::vector<MemberData> & members );
void readTypeDefine( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
void readTypeEnum( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
void readTypeInclude( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
void readTypeRequires( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
void readTypes( tinyxml2::XMLElement const * element );
void readTypeStruct( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
void readTypesType( tinyxml2::XMLElement const * element );
void sortStructs();
private:
std::string m_copyrightMessage;
@ -124,4 +150,4 @@ private:
std::map<std::string, IncludeData> m_includes;
std::map<std::string, StructureData> m_structs;
std::map<std::string, TypeData> m_types;
};
};

@ -1 +1 @@
Subproject commit 5a5c9a643484d888873e32c5d7d484fae8e71d3d
Subproject commit 2fa203425eb4af9dfc6b03f97ef72b0b5bcb8350

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -14,37 +14,44 @@
#pragma once
#include <algorithm>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <map>
#include <mutex>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tinyxml2.h>
#include <vector>
struct TypeInfo;
void checkAttributes( int line,
std::map<std::string, std::string> const & attributes,
std::map<std::string, std::set<std::string>> const & required,
std::map<std::string, std::set<std::string>> const & optional );
void checkElements( int line,
std::vector<tinyxml2::XMLElement const *> const & elements,
std::map<std::string, bool> const & required,
std::set<std::string> const & optional = {} );
void checkForError( bool condition, int line, std::string const & message );
void checkForWarning( bool condition, int line, std::string const & message );
std::string generateCopyrightMessage( std::string const & comment );
std::string generateStandardArrayWrapper( std::string const & type, std::vector<std::string> const & sizes );
void checkAttributes( std::string const & intro,
int line,
std::map<std::string, std::string> const & attributes,
std::map<std::string, std::set<std::string>> const & required,
std::map<std::string, std::set<std::string>> const & optional );
void checkElements( std::string const & intro,
int line,
std::vector<tinyxml2::XMLElement const *> const & elements,
std::map<std::string, bool> const & required,
std::set<std::string> const & optional = {} );
void checkForError( std::string const & intro, bool condition, int line, std::string const & message );
void checkForWarning( std::string const & intro, bool condition, int line, std::string const & message );
std::string generateCopyrightMessage( std::string const & comment );
void generateFileFromTemplate( std::string const & fileName, std::string const & snippetFile, std::map<std::string, std::string> const & replacements );
std::string generateStandardArrayWrapper( std::string const & type, std::vector<std::string> const & sizes );
std::map<std::string, std::string> getAttributes( tinyxml2::XMLElement const * element );
template <typename ElementContainer>
std::vector<tinyxml2::XMLElement const *> getChildElements( ElementContainer const * element );
std::string readComment( tinyxml2::XMLElement const * element );
std::pair<std::vector<std::string>, std::string> readModifiers( tinyxml2::XMLNode const * node );
std::string readComment( std::string const & intro, tinyxml2::XMLElement const * element );
std::pair<std::vector<std::string>, std::string> readModifiers( std::string const & intro, tinyxml2::XMLNode const * node );
std::string readSnippet( std::string const & snippetFile );
TypeInfo readTypeInfo( tinyxml2::XMLElement const * element );
std::string replaceWithMap( std::string const & input, std::map<std::string, std::string> replacements );
std::string replaceWithMap( std::string const & input, std::map<std::string, std::string> const & replacements );
std::string stripPostfix( std::string const & value, std::string const & postfix );
std::string stripPrefix( std::string const & value, std::string const & prefix );
std::string toCamelCase( std::string const & value, bool keepSeparatedNumbersSeparated = false );
@ -56,12 +63,29 @@ std::string trimEnd( std::string const & in
std::string trimStars( std::string const & input );
void writeToFile( std::string const & str, std::string const & fileName );
class SyncedMessageHandler
{
public:
void message( std::string const & m )
{
std::lock_guard<std::mutex> guard( m_messageMutex );
std::cout << m;
}
private:
std::mutex m_messageMutex;
};
SyncedMessageHandler messager;
struct TypeInfo
{
std::string compose( std::string const & nameSpace, std::string const & prefix_ = "Vk" ) const
std::string compose( std::string const & prefixToStrip, std::string const & nameSpace = "" ) const
{
return prefix + ( prefix.empty() ? "" : " " ) +
( nameSpace.empty() ? type : ( ( ( type.starts_with( prefix_ ) ) ? ( nameSpace + "::" ) : "" ) + stripPrefix( type, prefix_ ) ) ) +
( prefixToStrip.empty()
? type
: ( ( ( type.starts_with( prefixToStrip ) && !nameSpace.empty() ) ? ( nameSpace + "::" ) : "" ) + stripPrefix( type, prefixToStrip ) ) ) +
( postfix.empty() ? "" : " " ) + postfix;
}
@ -140,11 +164,13 @@ struct TypeData
};
// check the validity of an attributes map
// intro : an intro to any warning or error message
// line : the line in the xml file where the attributes are listed
// attributes : the map of name/value pairs of the encountered attributes
// required : the required attributes, with a set of allowed values per attribute
// optional : the optional attributes, with a set of allowed values per attribute
inline void checkAttributes( int line,
inline void checkAttributes( std::string const & intro,
int line,
std::map<std::string, std::string> const & attributes,
std::map<std::string, std::set<std::string>> const & required,
std::map<std::string, std::set<std::string>> const & optional )
@ -154,13 +180,13 @@ inline void checkAttributes( int
for ( auto const & r : required )
{
auto attributesIt = attributes.find( r.first );
checkForError( attributesIt != attributes.end(), line, "missing attribute <" + r.first + ">" );
checkForError( intro, attributesIt != attributes.end(), line, "missing attribute <" + r.first + ">" );
if ( !r.second.empty() )
{
std::vector<std::string> values = tokenize( attributesIt->second, "," );
for ( auto const & v : values )
{
checkForError( r.second.find( v ) != r.second.end(), line, "unexpected attribute value <" + v + "> in attribute <" + attributesIt->first + ">" );
checkForError( intro, r.second.find( v ) != r.second.end(), line, "unexpected attribute value <" + v + "> in attribute <" + attributesIt->first + ">" );
}
}
}
@ -173,7 +199,7 @@ inline void checkAttributes( int
auto optionalIt = optional.find( a.first );
if ( optionalIt == optional.end() )
{
checkForWarning( false, line, "unknown attribute <" + a.first + ">" );
checkForWarning( intro, false, line, "unknown attribute <" + a.first + ">" );
continue;
}
else if ( !optionalIt->second.empty() )
@ -181,15 +207,16 @@ inline void checkAttributes( int
std::vector<std::string> values = tokenize( a.second, "," );
for ( auto const & v : values )
{
checkForWarning(
optionalIt->second.find( v ) != optionalIt->second.end(), line, "unexpected attribute value <" + v + "> in attribute <" + a.first + ">" );
checkForError(
intro, optionalIt->second.find( v ) != optionalIt->second.end(), line, "unexpected attribute value <" + v + "> in attribute <" + a.first + ">" );
}
}
}
}
}
inline void checkElements( int line,
inline void checkElements( std::string const & intro,
int line,
std::vector<tinyxml2::XMLElement const *> const & elements,
std::map<std::string, bool> const & required,
std::set<std::string> const & optional )
@ -200,32 +227,34 @@ inline void checkElements( int lin
std::string value = e->Value();
encountered[value]++;
checkForWarning(
( required.find( value ) != required.end() ) || ( optional.find( value ) != optional.end() ), e->GetLineNum(), "unknown element <" + value + ">" );
intro, ( required.find( value ) != required.end() ) || ( optional.find( value ) != optional.end() ), e->GetLineNum(), "unknown element <" + value + ">" );
}
for ( auto const & r : required )
{
auto encounteredIt = encountered.find( r.first );
checkForError( encounteredIt != encountered.end(), line, "missing required element <" + r.first + ">" );
checkForError( intro, encounteredIt != encountered.end(), line, "missing required element <" + r.first + ">" );
// check: r.second (means: required excactly once) => (encouteredIt->second == 1)
checkForError( !r.second || ( encounteredIt->second == 1 ),
checkForError( intro,
!r.second || ( encounteredIt->second == 1 ),
line,
"required element <" + r.first + "> is supposed to be listed exactly once, but is listed " + std::to_string( encounteredIt->second ) );
"required element <" + r.first + "> is supposed to be listed exactly once, but is listed " + std::to_string( encounteredIt->second ) +
" times" );
}
}
inline void checkForError( bool condition, int line, std::string const & message )
inline void checkForError( std::string const & intro, bool condition, int line, std::string const & message )
{
if ( !condition )
{
throw std::runtime_error( "VulkanHppGenerator: Spec error on line " + std::to_string( line ) + ": " + message );
throw std::runtime_error( intro + ": Spec error on line " + std::to_string( line ) + ": " + message );
}
}
inline void checkForWarning( bool condition, int line, std::string const & message )
inline void checkForWarning( std::string const & intro, bool condition, int line, std::string const & message )
{
if ( !condition )
{
std::cerr << "VulkanHppGenerator: Spec warning on line " << std::to_string( line ) << ": " << message << "!" << std::endl;
std::cerr << intro << ": Spec warning on line " << std::to_string( line ) << ": " << message << "!" << std::endl;
}
}
@ -246,9 +275,16 @@ inline std::string generateCopyrightMessage( std::string const & comment )
return trim( copyrightMessage ) + "\n";
}
inline void generateFileFromTemplate( std::string const & fileName, std::string const & snippetFile, std::map<std::string, std::string> const & replacements )
{
std::string const completeFileName = std::string( BASE_PATH ) + "/vulkan/" + fileName;
messager.message( "VulkanHppGenerator: Generating " + completeFileName + " ...\n" );
writeToFile( replaceWithMap( readSnippet( snippetFile ), replacements ), completeFileName );
}
inline std::string generateStandardArrayWrapper( std::string const & type, std::vector<std::string> const & sizes )
{
std::string arrayString = "VULKAN_HPP_NAMESPACE::ArrayWrapper" + std::to_string( sizes.size() ) + "D<" + type;
std::string arrayString = "ArrayWrapper" + std::to_string( sizes.size() ) + "D<" + type;
for ( auto const & size : sizes )
{
arrayString += ", " + size;
@ -290,15 +326,15 @@ inline bool isNumber( std::string const & name ) noexcept
return name.find_first_not_of( "0123456789" ) == std::string::npos;
}
inline std::string readComment( tinyxml2::XMLElement const * element )
inline std::string readComment( std::string const & intro, tinyxml2::XMLElement const * element )
{
const int line = element->GetLineNum();
checkAttributes( line, getAttributes( element ), {}, {} );
checkElements( line, getChildElements( element ), {} );
checkAttributes( intro, line, getAttributes( element ), {}, {} );
checkElements( intro, line, getChildElements( element ), {} );
return element->GetText();
}
inline std::pair<std::vector<std::string>, std::string> readModifiers( tinyxml2::XMLNode const * node )
inline std::pair<std::vector<std::string>, std::string> readModifiers( std::string const & intro, tinyxml2::XMLNode const * node )
{
std::vector<std::string> arraySizes;
std::string bitCount;
@ -313,10 +349,10 @@ inline std::pair<std::vector<std::string>, std::string> readModifiers( tinyxml2:
while ( endPos + 1 != value.length() )
{
const std::string::size_type startPos = value.find( '[', endPos );
checkForError( startPos != std::string::npos, node->GetLineNum(), "could not find '[' in <" + value + ">" );
checkForError( intro, startPos != std::string::npos, node->GetLineNum(), "could not find '[' in <" + value + ">" );
endPos = value.find( ']', startPos );
checkForError( endPos != std::string::npos, node->GetLineNum(), "could not find ']' in <" + value + ">" );
checkForError( startPos + 2 <= endPos, node->GetLineNum(), "missing content between '[' and ']' in <" + value + ">" );
checkForError( intro, endPos != std::string::npos, node->GetLineNum(), "could not find ']' in <" + value + ">" );
checkForError( intro, startPos + 2 <= endPos, node->GetLineNum(), "missing content between '[' and ']' in <" + value + ">" );
arraySizes.push_back( value.substr( startPos + 1, endPos - startPos - 1 ) );
}
}
@ -326,10 +362,19 @@ inline std::pair<std::vector<std::string>, std::string> readModifiers( tinyxml2:
}
else
{
checkForError( ( value[0] == ';' ) || ( value[0] == ')' ), node->GetLineNum(), "unknown modifier <" + value + ">" );
checkForError( intro, ( value[0] == ';' ) || ( value[0] == ')' ), node->GetLineNum(), "unknown modifier <" + value + ">" );
}
}
return std::make_pair( arraySizes, bitCount );
return { arraySizes, bitCount };
}
inline std::string readSnippet( std::string const & snippetFile )
{
std::ifstream ifs( std::string( BASE_PATH ) + "/snippets/" + snippetFile );
assert( !ifs.fail() );
std::ostringstream oss;
oss << ifs.rdbuf();
return oss.str();
}
inline TypeInfo readTypeInfo( tinyxml2::XMLElement const * element )
@ -349,7 +394,7 @@ inline TypeInfo readTypeInfo( tinyxml2::XMLElement const * element )
return typeInfo;
}
inline std::string replaceWithMap( std::string const & input, std::map<std::string, std::string> replacements )
inline std::string replaceWithMap( std::string const & input, std::map<std::string, std::string> const & replacements )
{
// This will match ${someVariable} and contain someVariable in match group 1
std::regex re( R"(\$\{([^\}]+)\})" );
@ -422,7 +467,7 @@ inline std::string stripPrefix( std::string const & value, std::string const & p
inline std::string toCamelCase( std::string const & value, bool keepSeparatedNumbersSeparated )
{
assert( !value.empty() && ( isupper( value[0] ) || isdigit( value[0] ) ) );
assert( value.empty() || isupper( value[0] ) || isdigit( value[0] ) );
std::string result;
result.reserve( value.size() );
for ( size_t i = 0; i < value.size(); ++i )
@ -439,30 +484,6 @@ inline std::string toCamelCase( std::string const & value, bool keepSeparatedNum
result.push_back( ( ( 0 == i ) || ( value[i - 1] == '_' ) || isdigit( value[i - 1] ) ) ? value[i] : static_cast<char>( tolower( value[i] ) ) );
}
}
#if 0
bool keepUpper = true;
for ( auto c : value )
{
if ( c == '_' )
{
keepUpper = true;
}
else if ( isdigit( c ) )
{
keepUpper = true;
result.push_back( c );
}
else if ( keepUpper )
{
result.push_back( c );
keepUpper = false;
}
else
{
result.push_back( static_cast<char>( tolower( c ) ) );
}
}
#endif
return result;
}
@ -489,25 +510,25 @@ inline std::string toString( tinyxml2::XMLError error )
{
switch ( error )
{
case tinyxml2::XML_SUCCESS: return "XML_SUCCESS";
case tinyxml2::XML_NO_ATTRIBUTE: return "XML_NO_ATTRIBUTE";
case tinyxml2::XML_WRONG_ATTRIBUTE_TYPE: return "XML_WRONG_ATTRIBUTE_TYPE";
case tinyxml2::XML_ERROR_FILE_NOT_FOUND: return "XML_ERROR_FILE_NOT_FOUND";
case tinyxml2::XML_SUCCESS : return "XML_SUCCESS";
case tinyxml2::XML_NO_ATTRIBUTE : return "XML_NO_ATTRIBUTE";
case tinyxml2::XML_WRONG_ATTRIBUTE_TYPE : return "XML_WRONG_ATTRIBUTE_TYPE";
case tinyxml2::XML_ERROR_FILE_NOT_FOUND : return "XML_ERROR_FILE_NOT_FOUND";
case tinyxml2::XML_ERROR_FILE_COULD_NOT_BE_OPENED: return "XML_ERROR_FILE_COULD_NOT_BE_OPENED";
case tinyxml2::XML_ERROR_FILE_READ_ERROR: return "XML_ERROR_FILE_READ_ERROR";
case tinyxml2::XML_ERROR_PARSING_ELEMENT: return "XML_ERROR_PARSING_ELEMENT";
case tinyxml2::XML_ERROR_PARSING_ATTRIBUTE: return "XML_ERROR_PARSING_ATTRIBUTE";
case tinyxml2::XML_ERROR_PARSING_TEXT: return "XML_ERROR_PARSING_TEXT";
case tinyxml2::XML_ERROR_PARSING_CDATA: return "XML_ERROR_PARSING_CDATA";
case tinyxml2::XML_ERROR_PARSING_COMMENT: return "XML_ERROR_PARSING_COMMENT";
case tinyxml2::XML_ERROR_PARSING_DECLARATION: return "XML_ERROR_PARSING_DECLARATION";
case tinyxml2::XML_ERROR_PARSING_UNKNOWN: return "XML_ERROR_PARSING_UNKNOWN";
case tinyxml2::XML_ERROR_EMPTY_DOCUMENT: return "XML_ERROR_EMPTY_DOCUMENT";
case tinyxml2::XML_ERROR_MISMATCHED_ELEMENT: return "XML_ERROR_MISMATCHED_ELEMENT";
case tinyxml2::XML_ERROR_PARSING: return "XML_ERROR_PARSING";
case tinyxml2::XML_CAN_NOT_CONVERT_TEXT: return "XML_CAN_NOT_CONVERT_TEXT";
case tinyxml2::XML_NO_TEXT_NODE: return "XML_NO_TEXT_NODE";
default: return "unknown error code <" + std::to_string( error ) + ">";
case tinyxml2::XML_ERROR_FILE_READ_ERROR : return "XML_ERROR_FILE_READ_ERROR";
case tinyxml2::XML_ERROR_PARSING_ELEMENT : return "XML_ERROR_PARSING_ELEMENT";
case tinyxml2::XML_ERROR_PARSING_ATTRIBUTE : return "XML_ERROR_PARSING_ATTRIBUTE";
case tinyxml2::XML_ERROR_PARSING_TEXT : return "XML_ERROR_PARSING_TEXT";
case tinyxml2::XML_ERROR_PARSING_CDATA : return "XML_ERROR_PARSING_CDATA";
case tinyxml2::XML_ERROR_PARSING_COMMENT : return "XML_ERROR_PARSING_COMMENT";
case tinyxml2::XML_ERROR_PARSING_DECLARATION : return "XML_ERROR_PARSING_DECLARATION";
case tinyxml2::XML_ERROR_PARSING_UNKNOWN : return "XML_ERROR_PARSING_UNKNOWN";
case tinyxml2::XML_ERROR_EMPTY_DOCUMENT : return "XML_ERROR_EMPTY_DOCUMENT";
case tinyxml2::XML_ERROR_MISMATCHED_ELEMENT : return "XML_ERROR_MISMATCHED_ELEMENT";
case tinyxml2::XML_ERROR_PARSING : return "XML_ERROR_PARSING";
case tinyxml2::XML_CAN_NOT_CONVERT_TEXT : return "XML_CAN_NOT_CONVERT_TEXT";
case tinyxml2::XML_NO_TEXT_NODE : return "XML_NO_TEXT_NODE";
default : return "unknown error code <" + std::to_string( error ) + ">";
}
}
@ -532,7 +553,7 @@ std::string toUpperCase( std::string const & name )
inline std::string trim( std::string const & input )
{
std::string result = input;
result.erase( result.begin(), std::find_if( result.begin(), result.end(), []( char c ) noexcept { return !std::isspace( c ); } ) );
result.erase( result.begin(), std::ranges::find_if( result, []( char c ) noexcept { return !std::isspace( c ); } ) );
result.erase( std::find_if( result.rbegin(), result.rend(), []( char c ) noexcept { return !std::isspace( c ); } ).base(), result.end() );
return result;
}
@ -572,12 +593,15 @@ void writeToFile( std::string const & str, std::string const & fileName )
ofs.close();
#if defined( CLANG_FORMAT_EXECUTABLE )
std::cout << "VulkanHppGenerator: Formatting " << fileName << " ..." << std::endl;
// explicitly flush std::cout, as std::system spawns a sub-process
std::cout.flush();
messager.message( "VulkanHppGenerator: Formatting " + fileName + " ...\n" );
const std::string commandString = "\"" CLANG_FORMAT_EXECUTABLE "\" -i --style=file " + fileName;
const int ret = std::system( commandString.c_str() );
if ( ret != 0 )
{
std::cout << "VulkanHppGenerator: failed to format file " << fileName << " with error <" << ret << ">\n";
throw std::runtime_error( "VulkanHppGenerator: failed to format file " + fileName + " with error <" + std::to_string( ret ) + ">" );
}
#endif
}

@ -1 +1 @@
Subproject commit f1cb8608b390a7f51b4ae0d62cd415ba47a59b86
Subproject commit fc9889c889561c5882e83819dcaffef5ed45529b

View File

@ -12,4 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
vulkan_hpp__setup_sample_static( NAME 01_InitInstance )
find_package( Vulkan QUIET )
if ( Vulkan_FOUND )
vulkan_hpp__setup_sample_static( NAME 01_InitInstance )
endif()

View File

@ -17,7 +17,8 @@
#if defined( _MSC_VER )
// no need to ignore any warnings with MSVC
#elif defined( __clang__ )
#endif
#if defined( __clang__ )
# pragma clang diagnostic ignored "-Wunused-variable"
#elif defined( __GNUC__ )
# pragma GCC diagnostic ignored "-Wunused-but-set-variable"

View File

@ -44,7 +44,7 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::SurfaceKHR surface;
{
VkSurfaceKHR _surface;
glfwCreateWindowSurface( static_cast<VkInstance>( instance ), window.handle, nullptr, &_surface );
glfwCreateWindowSurface( instance, window.handle, nullptr, &_surface );
surface = vk::SurfaceKHR( _surface );
}
@ -96,7 +96,7 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::SurfaceCapabilitiesKHR surfaceCapabilities = physicalDevice.getSurfaceCapabilitiesKHR( surface );
vk::Extent2D swapchainExtent;
if ( surfaceCapabilities.currentExtent.width == std::numeric_limits<uint32_t>::max() )
if ( surfaceCapabilities.currentExtent.width == (std::numeric_limits<uint32_t>::max)() )
{
// If the surface size is undefined, the size is set to the size of the images requested.
swapchainExtent.width = vk::su::clamp( width, surfaceCapabilities.minImageExtent.width, surfaceCapabilities.maxImageExtent.width );
@ -123,7 +123,7 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::SwapchainCreateInfoKHR swapChainCreateInfo( vk::SwapchainCreateFlagsKHR(),
surface,
vk::su::clamp( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
vk::su::clampSurfaceImageCount( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
format,
vk::ColorSpaceKHR::eSrgbNonlinear,
swapchainExtent,

View File

@ -17,7 +17,7 @@
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>

View File

@ -29,7 +29,7 @@
#include "../utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>

View File

@ -19,7 +19,7 @@
#include "../utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>
#include <thread>

View File

@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
add_subdirectory( utils )
add_subdirectory( 01_InitInstance )
add_subdirectory( 02_EnumerateDevices )
add_subdirectory( 03_InitDevice )

View File

@ -13,7 +13,7 @@
// limitations under the License.
//
// VulkanHpp Samples : CopyBlitImage
// Draw a cube
// Perform an image blit operation
#include "../utils/utils.hpp"

View File

@ -12,4 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
vulkan_hpp__setup_sample_static( NAME CreateDebugUtilsMessenger )
find_package( Vulkan QUIET )
if ( Vulkan_FOUND )
vulkan_hpp__setup_sample_static( NAME CreateDebugUtilsMessenger )
endif()

View File

@ -13,7 +13,7 @@
// limitations under the License.
//
// VulkanHpp Samples : CreateDebugReportMessenger
// Draw a cube
// Set up a debug messenger
#include <iostream>
#include <sstream>
@ -39,15 +39,14 @@ VKAPI_ATTR void VKAPI_CALL vkDestroyDebugUtilsMessengerEXT( VkInstance instance,
return pfnVkDestroyDebugUtilsMessengerEXT( instance, messenger, pAllocator );
}
VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
VkDebugUtilsMessageTypeFlagsEXT messageTypes,
VkDebugUtilsMessengerCallbackDataEXT const * pCallbackData,
void * /*pUserData*/ )
VKAPI_ATTR vk::Bool32 VKAPI_CALL debugMessageFunc( vk::DebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
vk::DebugUtilsMessageTypeFlagsEXT messageTypes,
vk::DebugUtilsMessengerCallbackDataEXT const * pCallbackData,
void * /*pUserData*/ )
{
std::ostringstream message;
message << vk::to_string( static_cast<vk::DebugUtilsMessageSeverityFlagBitsEXT>( messageSeverity ) ) << ": "
<< vk::to_string( static_cast<vk::DebugUtilsMessageTypeFlagsEXT>( messageTypes ) ) << ":\n";
message << vk::to_string( messageSeverity ) << ": " << vk::to_string( messageTypes ) << ":\n";
message << std::string( "\t" ) << "messageIDName = <" << pCallbackData->pMessageIdName << ">\n";
message << std::string( "\t" ) << "messageIdNumber = " << pCallbackData->messageIdNumber << "\n";
message << std::string( "\t" ) << "message = <" << pCallbackData->pMessage << ">\n";
@ -73,7 +72,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( VkDebugUtilsMessageSeverityFlag
for ( uint32_t i = 0; i < pCallbackData->objectCount; i++ )
{
message << std::string( "\t\t" ) << "Object " << i << "\n";
message << std::string( "\t\t\t" ) << "objectType = " << vk::to_string( static_cast<vk::ObjectType>( pCallbackData->pObjects[i].objectType ) ) << "\n";
message << std::string( "\t\t\t" ) << "objectType = " << vk::to_string( pCallbackData->pObjects[i].objectType ) << "\n";
message << std::string( "\t\t\t" ) << "objectHandle = " << pCallbackData->pObjects[i].objectHandle << "\n";
if ( pCallbackData->pObjects[i].pObjectName )
{

View File

@ -55,8 +55,7 @@ int main( int /*argc*/, char ** /*argv*/ )
/* VULKAN_KEY_START */
vk::DebugUtilsObjectNameInfoEXT debugUtilsObjectNameInfo( vk::ObjectType::eImage, NON_DISPATCHABLE_HANDLE_TO_UINT64_CAST( VkImage, image ), "Image name" );
device.setDebugUtilsObjectNameEXT( debugUtilsObjectNameInfo );
device.setDebugUtilsObjectNameEXT( image, "Image name" );
/* VULKAN_KEY_END */

View File

@ -19,7 +19,7 @@
#include "../utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>
#include <thread>

View File

@ -25,7 +25,7 @@
# pragma warning( disable : 4100 ) // unreferenced formal parameter (glslang)
#endif // endif (_MSC_VER )
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#if defined( _MSC_VER )
# pragma warning( pop )

View File

@ -17,7 +17,8 @@
#if defined( _MSC_VER )
// no need to ignore any warnings with MSVC
#elif defined( __clang__ )
#endif
#if defined( __clang__ )
# pragma clang diagnostic ignored "-Wunused-variable"
#elif defined( __GNUC__ )
# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
@ -51,15 +52,14 @@ VKAPI_ATTR void VKAPI_CALL vkDestroyDebugUtilsMessengerEXT( VkInstance instance,
return pfnVkDestroyDebugUtilsMessengerEXT( instance, messenger, pAllocator );
}
VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
VkDebugUtilsMessageTypeFlagsEXT messageTypes,
VkDebugUtilsMessengerCallbackDataEXT const * pCallbackData,
VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( vk::DebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
vk::DebugUtilsMessageTypeFlagsEXT messageTypes,
vk::DebugUtilsMessengerCallbackDataEXT const * pCallbackData,
void * /*pUserData*/ )
{
std::string message;
message += vk::to_string( static_cast<vk::DebugUtilsMessageSeverityFlagBitsEXT>( messageSeverity ) ) + ": " +
vk::to_string( static_cast<vk::DebugUtilsMessageTypeFlagsEXT>( messageTypes ) ) + ":\n";
message += vk::to_string( messageSeverity ) + ": " + vk::to_string( messageTypes ) + ":\n";
message += std::string( "\t" ) + "messageIDName = <" + pCallbackData->pMessageIdName + ">\n";
message += std::string( "\t" ) + "messageIdNumber = " + std::to_string( pCallbackData->messageIdNumber ) + "\n";
message += std::string( "\t" ) + "message = <" + pCallbackData->pMessage + ">\n";
@ -84,7 +84,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( VkDebugUtilsMessageSeverityFlag
for ( uint32_t i = 0; i < pCallbackData->objectCount; i++ )
{
message += std::string( "\t" ) + "Object " + std::to_string( i ) + "\n";
message += std::string( "\t\t" ) + "objectType = " + vk::to_string( static_cast<vk::ObjectType>( pCallbackData->pObjects[i].objectType ) ) + "\n";
message += std::string( "\t\t" ) + "objectType = " + vk::to_string( pCallbackData->pObjects[i].objectType ) + "\n";
message += std::string( "\t\t" ) + "objectHandle = " + std::to_string( pCallbackData->pObjects[i].objectHandle ) + "\n";
if ( pCallbackData->pObjects[i].pObjectName )
{

View File

@ -28,7 +28,7 @@
#include "../utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>
#include <thread>

View File

@ -17,7 +17,8 @@
#if defined( _MSC_VER )
// no need to ignore any warnings with MSVC
#elif defined( __clang__ )
#endif
#if defined( __clang__ )
# pragma clang diagnostic ignored "-Wunused-variable"
#elif defined( __GNUC__ )
# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
@ -29,7 +30,7 @@
#include "../utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>

View File

@ -29,7 +29,7 @@
#include "../utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>
#include <thread>

View File

@ -12,4 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
vulkan_hpp__setup_sample_static( NAME InstanceExtensionProperties )
find_package( Vulkan QUIET )
if ( Vulkan_FOUND )
vulkan_hpp__setup_sample_static( NAME InstanceExtensionProperties )
endif()

View File

@ -12,4 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
vulkan_hpp__setup_sample_static( NAME InstanceLayerExtensionProperties )
find_package( Vulkan QUIET )
if ( Vulkan_FOUND )
vulkan_hpp__setup_sample_static( NAME InstanceLayerExtensionProperties )
endif()

View File

@ -12,4 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
vulkan_hpp__setup_sample_static( NAME InstanceLayerProperties )
find_package( Vulkan QUIET )
if ( Vulkan_FOUND )
vulkan_hpp__setup_sample_static( NAME InstanceLayerProperties )
endif()

View File

@ -12,4 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
vulkan_hpp__setup_sample_static( NAME InstanceVersion )
find_package( Vulkan QUIET )
if ( Vulkan_FOUND )
vulkan_hpp__setup_sample_static( NAME InstanceVersion )
endif()

View File

@ -28,7 +28,7 @@
#include "../utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>
#include <thread>

View File

@ -19,7 +19,7 @@
#include "../utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>
#include <thread>

File diff suppressed because it is too large Load Diff

View File

@ -47,9 +47,8 @@ int main( int /*argc*/, char ** /*argv*/ )
std::cout << "PhysicalDevice " << i << "\n";
// need to explicitly specify all the template arguments for getQueueFamilyProperties2 to make the compiler happy
using Chain = vk::StructureChain<vk::QueueFamilyProperties2, vk::QueueFamilyCheckpointPropertiesNV>;
auto queueFamilyProperties2 = physicalDevices[i].getQueueFamilyProperties2<Chain, std::allocator<Chain>, vk::DispatchLoaderDynamic>();
auto queueFamilyProperties2 = physicalDevices[i].getQueueFamilyProperties2<Chain>();
for ( size_t j = 0; j < queueFamilyProperties2.size(); j++ )
{
std::cout << std::string( "\t" ) << "QueueFamily " << j << "\n";

View File

@ -28,14 +28,14 @@
#include "../utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <fstream>
#include <iomanip>
#include <thread>
// For timestamp code (getMilliseconds)
#ifdef WIN32
#ifdef _WIN32
# include <Windows.h>
#else
# include <sys/time.h>
@ -44,7 +44,7 @@
typedef unsigned long long timestamp_t;
timestamp_t getMilliseconds()
{
#ifdef WIN32
#ifdef _WIN32
LARGE_INTEGER frequency;
BOOL useQPC = QueryPerformanceFrequency( &frequency );
if ( useQPC )
@ -140,8 +140,7 @@ int main( int /*argc*/, char ** /*argv*/ )
/* VULKAN_KEY_START */
// Check disk for existing cache data
size_t startCacheSize = 0;
char * startCacheData = nullptr;
std::vector<char> startCacheData;
std::string cacheFileName = "pipeline_cache_data.bin";
std::ifstream readCacheStream( cacheFileName, std::ios_base::in | std::ios_base::binary );
@ -149,14 +148,14 @@ int main( int /*argc*/, char ** /*argv*/ )
{
// Determine cache size
readCacheStream.seekg( 0, readCacheStream.end );
startCacheSize = static_cast<size_t>( readCacheStream.tellg() );
size_t startCacheSize = static_cast<size_t>( readCacheStream.tellg() );
readCacheStream.seekg( 0, readCacheStream.beg );
// Allocate memory to hold the initial cache data
startCacheData = (char *)std::malloc( startCacheSize );
startCacheData.resize( startCacheSize );
// Read the data into our buffer
readCacheStream.read( startCacheData, startCacheSize );
readCacheStream.read( startCacheData.data(), startCacheData.size() );
// Clean up and print results
readCacheStream.close();
@ -169,7 +168,7 @@ int main( int /*argc*/, char ** /*argv*/ )
std::cout << " Pipeline cache miss!\n";
}
if ( startCacheData != nullptr )
if ( !startCacheData.empty() )
{
// Check for cache validity
//
@ -205,11 +204,12 @@ int main( int /*argc*/, char ** /*argv*/ )
uint32_t deviceID = 0;
uint8_t pipelineCacheUUID[VK_UUID_SIZE] = {};
memcpy( &headerLength, (uint8_t *)startCacheData + 0, 4 );
memcpy( &cacheHeaderVersion, (uint8_t *)startCacheData + 4, 4 );
memcpy( &vendorID, (uint8_t *)startCacheData + 8, 4 );
memcpy( &deviceID, (uint8_t *)startCacheData + 12, 4 );
memcpy( pipelineCacheUUID, (uint8_t *)startCacheData + 16, VK_UUID_SIZE );
uint8_t * startCacheDataPtr = reinterpret_cast<uint8_t *>( startCacheData.data() );
memcpy( &headerLength, startCacheDataPtr + 0, 4 );
memcpy( &cacheHeaderVersion, startCacheDataPtr + 4, 4 );
memcpy( &vendorID, startCacheDataPtr + 8, 4 );
memcpy( &deviceID, startCacheDataPtr + 12, 4 );
memcpy( pipelineCacheUUID, startCacheDataPtr + 16, VK_UUID_SIZE );
// Check each field and report bad values before freeing existing cache
bool badCache = false;
@ -255,9 +255,7 @@ int main( int /*argc*/, char ** /*argv*/ )
if ( badCache )
{
// Don't submit initial cache data if any version info is incorrect
free( startCacheData );
startCacheSize = 0;
startCacheData = nullptr;
startCacheData.clear();
// And clear out the old cache file for use in next run
std::cout << " Deleting cache entry " << cacheFileName << " to repopulate.\n";
@ -271,11 +269,10 @@ int main( int /*argc*/, char ** /*argv*/ )
// Feed the initial cache data into cache creation
vk::PipelineCache pipelineCache =
device.createPipelineCache( vk::PipelineCacheCreateInfo( vk::PipelineCacheCreateFlags(), startCacheSize, startCacheData ) );
device.createPipelineCache( vk::PipelineCacheCreateInfo( vk::PipelineCacheCreateFlags(), startCacheData.size(), startCacheData.data() ) );
// Free our initialData now that pipeline cache has been created
free( startCacheData );
startCacheData = NULL;
startCacheData.clear();
// Time (roughly) taken to create the graphics pipeline
timestamp_t start = getMilliseconds();

View File

@ -28,7 +28,7 @@
#include "../utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <thread>

View File

@ -28,7 +28,7 @@
#include "../utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>
#include <thread>

View File

@ -19,7 +19,7 @@
#include "../utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>
#include <thread>

View File

@ -14,11 +14,6 @@
vulkan_hpp__setup_sample_dynamic(
NAME RayTracing
INCLUDE_DIRS
${CMAKE_SOURCE_DIR}/samples/RayTracing/common
${CMAKE_SOURCE_DIR}/samples/RayTracing/vulkannv
${CMAKE_SOURCE_DIR}/stb
${CMAKE_SOURCE_DIR}/tinyobjloader
HEADERS
CameraManipulator.hpp
SOURCES

View File

@ -28,6 +28,7 @@
#include "CameraManipulator.hpp"
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/glm.hpp>
#include <glm/gtx/rotate_vector.hpp>

View File

@ -44,7 +44,7 @@
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "CameraManipulator.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <glm/glm.hpp>
#include <glm/gtc/matrix_inverse.hpp>
@ -594,7 +594,7 @@ static void keyCallback( GLFWwindow * window, int key, int /*scancode*/, int act
switch ( key )
{
case GLFW_KEY_ESCAPE:
case 'Q': glfwSetWindowShouldClose( window, 1 ); break;
case 'Q' : glfwSetWindowShouldClose( window, 1 ); break;
case 'R':
{
AppInfo * appInfo = reinterpret_cast<AppInfo *>( glfwGetWindowUserPointer( window ) );
@ -724,7 +724,7 @@ int main( int /*argc*/, char ** /*argv*/ )
// Create Window Surface (using glfw)
vk::SurfaceKHR surface;
VkResult err = glfwCreateWindowSurface( static_cast<VkInstance>( instance ), window, nullptr, reinterpret_cast<VkSurfaceKHR *>( &surface ) );
VkResult err = glfwCreateWindowSurface( instance, window, nullptr, reinterpret_cast<VkSurfaceKHR *>( &surface ) );
check_vk_result( err );
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surface );
@ -1224,9 +1224,9 @@ int main( int /*argc*/, char ** /*argv*/ )
presentQueue.presentKHR( vk::PresentInfoKHR( perFrameData[frameIndex].renderCompleteSemaphore, swapChainData.swapChain, backBufferIndex ) );
switch ( result )
{
case vk::Result::eSuccess: break;
case vk::Result::eSuccess : break;
case vk::Result::eSuboptimalKHR: std::cout << "vk::Queue::presentKHR returned vk::Result::eSuboptimalKHR !\n"; break;
default: assert( false ); // an unexpected result is returned !
default : assert( false ); // an unexpected result is returned !
}
frameIndex = ( frameIndex + 1 ) % IMGUI_VK_QUEUED_FRAMES;

View File

@ -29,7 +29,7 @@
#include "../utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>
#include <thread>

View File

@ -28,7 +28,7 @@
#include "../utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>
#include <thread>

View File

@ -21,7 +21,7 @@
#include "../utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>
#include <thread>
@ -83,10 +83,10 @@ public:
void createDeviceAndSwapChain( const vk::su::WindowData & window )
{
VkSurfaceKHR surface;
VkResult err = glfwCreateWindowSurface( static_cast<VkInstance>( instance.get() ), window.handle, nullptr, &surface );
VkResult err = glfwCreateWindowSurface( instance.get(), window.handle, nullptr, &surface );
if ( err != VK_SUCCESS )
throw std::runtime_error( "Failed to create window!" );
vk::SharedSurfaceKHR sharedSurface{ surface, instance };
vk::SharedSurfaceKHR sharedSurface{ static_cast<vk::SurfaceKHR>( surface ), instance };
auto graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, sharedSurface.get() );
device = vk::SharedDevice{ vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() ) };
@ -109,16 +109,12 @@ public:
std::transform( swapChainData.images.begin(),
swapChainData.images.end(),
std::back_inserter( images ),
[this]( vk::Image image ) {
return vk::SharedImage{ image, device, vk::SwapchainOwns::yes };
} );
[this]( vk::Image image ) { return vk::SharedImage{ image, device, vk::SwapchainOwns::yes }; } );
std::transform( swapChainData.imageViews.begin(),
swapChainData.imageViews.end(),
std::back_inserter( imageViews ),
[this]( vk::ImageView imageView ) {
return vk::SharedImageView{ imageView, device };
} );
[this]( vk::ImageView imageView ) { return vk::SharedImageView{ imageView, device }; } );
commandPool =
vk::SharedCommandPool{ device->createCommandPool( { vk::CommandPoolCreateFlagBits::eResetCommandBuffer, graphicsAndPresentQueueFamilyIndex.first } ),
device };
@ -230,9 +226,9 @@ public:
vk::Result result = presentQueue->presentKHR( vk::PresentInfoKHR( {}, swap, currentBuffer ) );
switch ( result )
{
case vk::Result::eSuccess: break;
case vk::Result::eSuccess : break;
case vk::Result::eSuboptimalKHR: std::cout << "vk::Queue::presentKHR returned vk::Result::eSuboptimalKHR !\n"; break;
default: assert( false ); // an unexpected result is returned !
default : assert( false ); // an unexpected result is returned !
}
std::this_thread::sleep_for( std::chrono::milliseconds( 1000 ) );

View File

@ -19,7 +19,7 @@
#include "../utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>
#include <thread>

View File

@ -19,7 +19,7 @@
#include "../utils/math.hpp"
#include "../utils/shaders.hpp"
#include "../utils/utils.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#include <iostream>
#include <thread>

View File

@ -22,11 +22,11 @@ if( VULKAN_HPP_RUN_GENERATOR )
add_dependencies( utils build_vulkan_hpp )
endif()
target_link_libraries( utils PUBLIC glm )
target_link_libraries( utils PUBLIC glm::glm )
target_link_libraries( utils PUBLIC glfw )
target_link_libraries( utils PUBLIC glslang )
target_link_libraries( utils PUBLIC glslang-default-resource-limits )
target_link_libraries( utils PUBLIC SPIRV )
target_link_libraries( utils PUBLIC glslang::glslang )
target_link_libraries( utils PUBLIC glslang::glslang-default-resource-limits )
target_link_libraries( utils PUBLIC glslang::SPIRV )
target_compile_definitions( utils PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1 )
target_precompile_headers( utils PRIVATE <vulkan/vulkan.hpp> )

View File

@ -15,8 +15,9 @@
#include "shaders.hpp"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/SPIRV/GlslangToSpv.h"
#include "glslang/Public/ResourceLimits.h"
#include "glslang/Public/ShaderLang.h"
#include <vulkan/vulkan.hpp>

View File

@ -301,7 +301,7 @@ namespace vk
);
vk::Instance instance =
vk::createInstance( makeInstanceCreateInfoChain( applicationInfo, enabledLayers, enabledExtensions ).get<vk::InstanceCreateInfo>() );
vk::createInstance( makeInstanceCreateInfoChain( {}, applicationInfo, enabledLayers, enabledExtensions ).get<vk::InstanceCreateInfo>() );
#if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 )
// initialize function pointers for instance
@ -348,27 +348,28 @@ namespace vk
return device.createRenderPass( vk::RenderPassCreateInfo( vk::RenderPassCreateFlags(), attachmentDescriptions, subpassDescription ) );
}
VKAPI_ATTR VkBool32 VKAPI_CALL debugUtilsMessengerCallback( VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
VkDebugUtilsMessageTypeFlagsEXT messageTypes,
VkDebugUtilsMessengerCallbackDataEXT const * pCallbackData,
void * /*pUserData*/ )
VKAPI_ATTR vk::Bool32 VKAPI_CALL debugUtilsMessengerCallback( vk::DebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
vk::DebugUtilsMessageTypeFlagsEXT messageTypes,
const vk::DebugUtilsMessengerCallbackDataEXT * pCallbackData,
void * /*pUserData*/ )
{
#if !defined( NDEBUG )
if ( static_cast<uint32_t>( pCallbackData->messageIdNumber ) == 0x822806fa )
switch ( static_cast<uint32_t>( pCallbackData->messageIdNumber ) )
{
// Validation Warning: vkCreateInstance(): to enable extension VK_EXT_debug_utils, but this extension is intended to support use by applications when
// debugging and it is strongly recommended that it be otherwise avoided.
return vk::False;
}
else if ( static_cast<uint32_t>( pCallbackData->messageIdNumber ) == 0xe8d1a9fe )
{
// Validation Performance Warning: Using debug builds of the validation layers *will* adversely affect performance.
return vk::False;
case 0:
// Validation Warning: Override layer has override paths set to C:/VulkanSDK/<version>/Bin
return vk::False;
case 0x822806fa:
// Validation Warning: vkCreateInstance(): to enable extension VK_EXT_debug_utils, but this extension is intended to support use by applications when
// debugging and it is strongly recommended that it be otherwise avoided.
return vk::False;
case 0xe8d1a9fe:
// Validation Performance Warning: Using debug builds of the validation layers *will* adversely affect performance.
return vk::False;
}
#endif
std::cerr << vk::to_string( static_cast<vk::DebugUtilsMessageSeverityFlagBitsEXT>( messageSeverity ) ) << ": "
<< vk::to_string( static_cast<vk::DebugUtilsMessageTypeFlagsEXT>( messageTypes ) ) << ":\n";
std::cerr << vk::to_string( messageSeverity ) << ": " << vk::to_string( messageTypes ) << ":\n";
std::cerr << std::string( "\t" ) << "messageIDName = <" << pCallbackData->pMessageIdName << ">\n";
std::cerr << std::string( "\t" ) << "messageIdNumber = " << pCallbackData->messageIdNumber << "\n";
std::cerr << std::string( "\t" ) << "message = <" << pCallbackData->pMessage << ">\n";
@ -394,8 +395,7 @@ namespace vk
for ( uint32_t i = 0; i < pCallbackData->objectCount; i++ )
{
std::cerr << std::string( "\t\t" ) << "Object " << i << "\n";
std::cerr << std::string( "\t\t\t" ) << "objectType = " << vk::to_string( static_cast<vk::ObjectType>( pCallbackData->pObjects[i].objectType ) )
<< "\n";
std::cerr << std::string( "\t\t\t" ) << "objectType = " << vk::to_string( pCallbackData->pObjects[i].objectType ) << "\n";
std::cerr << std::string( "\t\t\t" ) << "objectHandle = " << pCallbackData->pObjects[i].objectHandle << "\n";
if ( pCallbackData->pObjects[i].pObjectName )
{
@ -420,37 +420,52 @@ namespace vk
std::pair<uint32_t, uint32_t> findGraphicsAndPresentQueueFamilyIndex( vk::PhysicalDevice physicalDevice, vk::SurfaceKHR const & surface )
{
std::vector<vk::QueueFamilyProperties> queueFamilyProperties = physicalDevice.getQueueFamilyProperties();
assert( queueFamilyProperties.size() < std::numeric_limits<uint32_t>::max() );
assert( queueFamilyProperties.size() < ( std::numeric_limits<uint32_t>::max )() );
uint32_t graphicsQueueFamilyIndex = findGraphicsQueueFamilyIndex( queueFamilyProperties );
if ( physicalDevice.getSurfaceSupportKHR( graphicsQueueFamilyIndex, surface ) )
// look for a queueFamilyIndex that supports graphics and present
auto combinedIt = std::find_if( queueFamilyProperties.begin(),
queueFamilyProperties.end(),
[&physicalDevice, &surface]( vk::QueueFamilyProperties const & qfp )
{
static uint32_t index = 0;
return ( qfp.queueFlags & vk::QueueFlagBits::eGraphics ) && physicalDevice.getSurfaceSupportKHR( index++, surface );
} );
if ( combinedIt != queueFamilyProperties.end() )
{
return std::make_pair( graphicsQueueFamilyIndex,
graphicsQueueFamilyIndex ); // the first graphicsQueueFamilyIndex does also support presents
uint32_t index = static_cast<uint32_t>( std::distance( queueFamilyProperties.begin(), combinedIt ) );
return { index, index }; // the first index that supports graphics and present
}
// the graphicsQueueFamilyIndex doesn't support present -> look for an other family index that supports both
// graphics and present
for ( size_t i = 0; i < queueFamilyProperties.size(); i++ )
else
{
if ( ( queueFamilyProperties[i].queueFlags & vk::QueueFlagBits::eGraphics ) &&
physicalDevice.getSurfaceSupportKHR( static_cast<uint32_t>( i ), surface ) )
// there's no single index that supports both graphics and present -> look for separate ones
auto graphicsIt = std::find_if( queueFamilyProperties.begin(),
queueFamilyProperties.end(),
[]( vk::QueueFamilyProperties const & qfp ) { return qfp.queueFlags & vk::QueueFlagBits::eGraphics; } );
if ( graphicsIt != queueFamilyProperties.end() )
{
return std::make_pair( static_cast<uint32_t>( i ), static_cast<uint32_t>( i ) );
uint32_t graphicsIndex = static_cast<uint32_t>( std::distance( queueFamilyProperties.begin(), graphicsIt ) );
auto presentIt = std::find_if( queueFamilyProperties.begin(),
queueFamilyProperties.end(),
[&physicalDevice, &surface]( vk::QueueFamilyProperties const & )
{
static uint32_t index = 0;
return physicalDevice.getSurfaceSupportKHR( index++, surface );
} );
if ( presentIt != queueFamilyProperties.end() )
{
uint32_t presentIndex = static_cast<uint32_t>( std::distance( queueFamilyProperties.begin(), presentIt ) );
return { graphicsIndex, presentIndex };
}
else
{
throw std::runtime_error( "Could not find a queue family index that supports present -> terminating" );
}
}
else
{
throw std::runtime_error( "Could not find a queue family index that supports graphics -> terminating" );
}
}
// there's nothing like a single family index that supports both graphics and present -> look for an other family
// index that supports present
for ( size_t i = 0; i < queueFamilyProperties.size(); i++ )
{
if ( physicalDevice.getSurfaceSupportKHR( static_cast<uint32_t>( i ), surface ) )
{
return std::make_pair( graphicsQueueFamilyIndex, static_cast<uint32_t>( i ) );
}
}
throw std::runtime_error( "Could not find queues for both graphics or present -> terminating" );
}
uint32_t findMemoryType( vk::PhysicalDeviceMemoryProperties const & memoryProperties, uint32_t typeBits, vk::MemoryPropertyFlags requirementsMask )
@ -480,12 +495,8 @@ namespace vk
extensions.push_back( VK_KHR_SURFACE_EXTENSION_NAME );
#if defined( VK_USE_PLATFORM_ANDROID_KHR )
extensions.push_back( VK_KHR_ANDROID_SURFACE_EXTENSION_NAME );
#elif defined( VK_USE_PLATFORM_IOS_MVK )
extensions.push_back( VK_MVK_IOS_SURFACE_EXTENSION_NAME );
#elif defined( VK_USE_PLATFORM_MACOS_MVK )
extensions.push_back( VK_MVK_MACOS_SURFACE_EXTENSION_NAME );
#elif defined( VK_USE_PLATFORM_MIR_KHR )
extensions.push_back( VK_KHR_MIR_SURFACE_EXTENSION_NAME );
#elif defined( VK_USE_PLATFORM_METAL_EXT )
extensions.push_back( VK_EXT_METAL_SURFACE_EXTENSION_NAME );
#elif defined( VK_USE_PLATFORM_VI_NN )
extensions.push_back( VK_NN_VI_SURFACE_EXTENSION_NAME );
#elif defined( VK_USE_PLATFORM_WAYLAND_KHR )
@ -578,20 +589,20 @@ namespace vk
switch ( oldImageLayout )
{
case vk::ImageLayout::eTransferDstOptimal: sourceAccessMask = vk::AccessFlagBits::eTransferWrite; break;
case vk::ImageLayout::ePreinitialized: sourceAccessMask = vk::AccessFlagBits::eHostWrite; break;
case vk::ImageLayout::eGeneral: // sourceAccessMask is empty
case vk::ImageLayout::eUndefined: break;
default: assert( false ); break;
case vk::ImageLayout::ePreinitialized : sourceAccessMask = vk::AccessFlagBits::eHostWrite; break;
case vk::ImageLayout::eGeneral : // sourceAccessMask is empty
case vk::ImageLayout::eUndefined : break;
default : assert( false ); break;
}
vk::PipelineStageFlags sourceStage;
switch ( oldImageLayout )
{
case vk::ImageLayout::eGeneral:
case vk::ImageLayout::ePreinitialized: sourceStage = vk::PipelineStageFlagBits::eHost; break;
case vk::ImageLayout::ePreinitialized : sourceStage = vk::PipelineStageFlagBits::eHost; break;
case vk::ImageLayout::eTransferDstOptimal: sourceStage = vk::PipelineStageFlagBits::eTransfer; break;
case vk::ImageLayout::eUndefined: sourceStage = vk::PipelineStageFlagBits::eTopOfPipe; break;
default: assert( false ); break;
case vk::ImageLayout::eUndefined : sourceStage = vk::PipelineStageFlagBits::eTopOfPipe; break;
default : assert( false ); break;
}
vk::AccessFlags destinationAccessMask;
@ -602,24 +613,24 @@ namespace vk
destinationAccessMask = vk::AccessFlagBits::eDepthStencilAttachmentRead | vk::AccessFlagBits::eDepthStencilAttachmentWrite;
break;
case vk::ImageLayout::eGeneral: // empty destinationAccessMask
case vk::ImageLayout::ePresentSrcKHR: break;
case vk::ImageLayout::ePresentSrcKHR : break;
case vk::ImageLayout::eShaderReadOnlyOptimal: destinationAccessMask = vk::AccessFlagBits::eShaderRead; break;
case vk::ImageLayout::eTransferSrcOptimal: destinationAccessMask = vk::AccessFlagBits::eTransferRead; break;
case vk::ImageLayout::eTransferDstOptimal: destinationAccessMask = vk::AccessFlagBits::eTransferWrite; break;
default: assert( false ); break;
case vk::ImageLayout::eTransferSrcOptimal : destinationAccessMask = vk::AccessFlagBits::eTransferRead; break;
case vk::ImageLayout::eTransferDstOptimal : destinationAccessMask = vk::AccessFlagBits::eTransferWrite; break;
default : assert( false ); break;
}
vk::PipelineStageFlags destinationStage;
switch ( newImageLayout )
{
case vk::ImageLayout::eColorAttachmentOptimal: destinationStage = vk::PipelineStageFlagBits::eColorAttachmentOutput; break;
case vk::ImageLayout::eColorAttachmentOptimal : destinationStage = vk::PipelineStageFlagBits::eColorAttachmentOutput; break;
case vk::ImageLayout::eDepthStencilAttachmentOptimal: destinationStage = vk::PipelineStageFlagBits::eEarlyFragmentTests; break;
case vk::ImageLayout::eGeneral: destinationStage = vk::PipelineStageFlagBits::eHost; break;
case vk::ImageLayout::ePresentSrcKHR: destinationStage = vk::PipelineStageFlagBits::eBottomOfPipe; break;
case vk::ImageLayout::eShaderReadOnlyOptimal: destinationStage = vk::PipelineStageFlagBits::eFragmentShader; break;
case vk::ImageLayout::eTransferDstOptimal:
case vk::ImageLayout::eTransferSrcOptimal: destinationStage = vk::PipelineStageFlagBits::eTransfer; break;
default: assert( false ); break;
case vk::ImageLayout::eGeneral : destinationStage = vk::PipelineStageFlagBits::eHost; break;
case vk::ImageLayout::ePresentSrcKHR : destinationStage = vk::PipelineStageFlagBits::eBottomOfPipe; break;
case vk::ImageLayout::eShaderReadOnlyOptimal : destinationStage = vk::PipelineStageFlagBits::eFragmentShader; break;
case vk::ImageLayout::eTransferDstOptimal :
case vk::ImageLayout::eTransferSrcOptimal : destinationStage = vk::PipelineStageFlagBits::eTransfer; break;
default : assert( false ); break;
}
vk::ImageAspectFlags aspectMask;
@ -784,7 +795,7 @@ namespace vk
: extent( extent_ ), window( vk::su::createWindow( windowName, extent ) )
{
VkSurfaceKHR _surface;
VkResult err = glfwCreateWindowSurface( static_cast<VkInstance>( instance ), window.handle, nullptr, &_surface );
VkResult err = glfwCreateWindowSurface( instance, window.handle, nullptr, &_surface );
if ( err != VK_SUCCESS )
throw std::runtime_error( "Failed to create window!" );
surface = vk::SurfaceKHR( _surface );
@ -804,7 +815,7 @@ namespace vk
vk::SurfaceCapabilitiesKHR surfaceCapabilities = physicalDevice.getSurfaceCapabilitiesKHR( surface );
vk::Extent2D swapchainExtent;
if ( surfaceCapabilities.currentExtent.width == std::numeric_limits<uint32_t>::max() )
if ( surfaceCapabilities.currentExtent.width == ( std::numeric_limits<uint32_t>::max )() )
{
// If the surface size is undefined, the size is set to the size of the images requested.
swapchainExtent.width = clamp( extent.width, surfaceCapabilities.minImageExtent.width, surfaceCapabilities.maxImageExtent.width );
@ -824,21 +835,22 @@ namespace vk
: ( surfaceCapabilities.supportedCompositeAlpha & vk::CompositeAlphaFlagBitsKHR::eInherit ) ? vk::CompositeAlphaFlagBitsKHR::eInherit
: vk::CompositeAlphaFlagBitsKHR::eOpaque;
vk::PresentModeKHR presentMode = vk::su::pickPresentMode( physicalDevice.getSurfacePresentModesKHR( surface ) );
vk::SwapchainCreateInfoKHR swapChainCreateInfo( {},
surface,
vk::su::clamp( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
colorFormat,
surfaceFormat.colorSpace,
swapchainExtent,
1,
usage,
vk::SharingMode::eExclusive,
{},
preTransform,
compositeAlpha,
presentMode,
true,
oldSwapChain );
vk::SwapchainCreateInfoKHR swapChainCreateInfo(
{},
surface,
vk::su::clampSurfaceImageCount( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
colorFormat,
surfaceFormat.colorSpace,
swapchainExtent,
1,
usage,
vk::SharingMode::eExclusive,
{},
preTransform,
compositeAlpha,
presentMode,
true,
oldSwapChain );
if ( graphicsQueueFamilyIndex != presentQueueFamilyIndex )
{
uint32_t queueFamilyIndices[2] = { graphicsQueueFamilyIndex, presentQueueFamilyIndex };
@ -981,7 +993,7 @@ namespace vk
WindowData::WindowData( GLFWwindow * wnd, std::string const & name, vk::Extent2D const & extent ) : handle{ wnd }, name{ name }, extent{ extent } {}
WindowData::WindowData( WindowData && other ) : handle{}, name{}, extent{}
WindowData::WindowData( WindowData && other ) noexcept : handle{}, name{}, extent{}
{
std::swap( handle, other.handle );
std::swap( name, other.name );
@ -1000,12 +1012,7 @@ namespace vk
glfwContext()
{
glfwInit();
glfwSetErrorCallback(
[]( int error, const char * msg )
{
std::cerr << "glfw: "
<< "(" << error << ") " << msg << std::endl;
} );
glfwSetErrorCallback( []( int error, const char * msg ) { std::cerr << "glfw: " << "(" << error << ") " << msg << std::endl; } );
}
~glfwContext()
@ -1036,13 +1043,14 @@ namespace vk
#else
vk::StructureChain<vk::InstanceCreateInfo, vk::DebugUtilsMessengerCreateInfoEXT>
#endif
makeInstanceCreateInfoChain( vk::ApplicationInfo const & applicationInfo,
makeInstanceCreateInfoChain( vk::InstanceCreateFlagBits instanceCreateFlagBits,
vk::ApplicationInfo const & applicationInfo,
std::vector<char const *> const & layers,
std::vector<char const *> const & extensions )
{
#if defined( NDEBUG )
// in non-debug mode just use the InstanceCreateInfo for instance creation
vk::StructureChain<vk::InstanceCreateInfo> instanceCreateInfo( { {}, &applicationInfo, layers, extensions } );
vk::StructureChain<vk::InstanceCreateInfo> instanceCreateInfo( { instanceCreateFlagBits, &applicationInfo, layers, extensions } );
#else
// in debug mode, addionally use the debugUtilsMessengerCallback in instance creation!
vk::DebugUtilsMessageSeverityFlagsEXT severityFlags( vk::DebugUtilsMessageSeverityFlagBitsEXT::eWarning |
@ -1050,7 +1058,7 @@ namespace vk
vk::DebugUtilsMessageTypeFlagsEXT messageTypeFlags( vk::DebugUtilsMessageTypeFlagBitsEXT::eGeneral | vk::DebugUtilsMessageTypeFlagBitsEXT::ePerformance |
vk::DebugUtilsMessageTypeFlagBitsEXT::eValidation );
vk::StructureChain<vk::InstanceCreateInfo, vk::DebugUtilsMessengerCreateInfoEXT> instanceCreateInfo(
{ {}, &applicationInfo, layers, extensions }, { {}, severityFlags, messageTypeFlags, &vk::su::debugUtilsMessengerCallback } );
{ instanceCreateFlagBits, &applicationInfo, layers, extensions }, { {}, severityFlags, messageTypeFlags, &vk::su::debugUtilsMessengerCallback } );
#endif
return instanceCreateInfo;
}

Some files were not shown because too many files have changed in this diff Show More