Commit Graph

71 Commits

Author SHA1 Message Date
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
525429d181
Add building of vulkan_video.hpp to default build process. (#1793) 2024-02-06 15:11:31 +01:00
Andreas Süßenbach
f67cfcc229
Use the actual CMAKE_CXX_STANDARD provided by the workflow. (#1750) 2023-12-13 21:56:00 +01:00
Andreas Süßenbach
c77427babb
Adjust module support handling with CMake version 3.28 and above (#1699) 2023-10-18 08:07:18 +02:00
Anton Shangareev
f9bed11716
Use add_subdirectory-friendly CMAKE variables (#1679) 2023-10-09 16:05:13 +02:00
Andreas Süßenbach
d4704cce01
Make C++20 modules work with the defaultDispatchLoaderDynamic. (#1651)
* Make C++20 modules work with the defaultDispatchLoaderDynamic.

* Add vulkan_hpp_macros.hpp to list of installed files.

* Adjust the text on module in the readme.

* Rename module from vulkan to vulkan_hpp

* Adjust some comments.

* Add a little disclaimer to vulkan.cppm.
2023-09-07 15:20:10 +02:00
Stephan Seitz
cf70eb8efb
fix: add support for C++20 modules for CMake 3.27.0/3.27.1 (#1632)
When using VULKAN_HPP_ENABLE_EXPERIMENTAL_CPP20_MODULES=ON with CMake 3.27.0 or 3.27.1,
you will get a very confusing error message:
```
CMake Error at CMakeLists.txt:346 (target_sources):
  target_sources File set TYPE may only be "HEADERS"
```

This is because the value of `CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API`
is not update to the correct value, disabling all experimental CMake
features.

This PR adds the value for 3.27.X and triggers an error for higher CMake
versions where this feature needs to be revised and
CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API if the feature is still
experimental.

The error message will look similar to this one (simulated for CMake
3.27.1)
```
CMake Error at CMakeLists.txt:30 (message):
  VULKAN_HPP_ENABLE_EXPERIMENTAL_CPP20_MODULES is currently not supported for
  CMake version 3.27.1! To add support inform yourself about the state of the
  feature at
  https://github.com/Kitware/CMake/blob/master/Help/dev/experimental.rst and
  add the corresponding value of CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API to
  Vulkan-Hpp's CMakeLists.txt
```
2023-08-07 08:56:36 +02:00
Andreas Süßenbach
069c3b875e
Introduce VideoHppGenerator. (#1618) 2023-07-11 15:39:17 +02:00
Sharadh Rajaraman
f4abba455e
Bug fixes for vulkan.cppm (#1616)
* Bug fixes for C++20 module

- Removed nested `export` keyword for `vk::raii` namespace in C++ module file
- Fixed macro in `vulkan.cppm` for `vk::DynamicLoader`: changed from `VULKAN_HPP_DYNAMIC_LOADER_TOOL` to `VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL`  
- Moved VulkanHppModule declaration before generator
- Fixed `CMakeLists.txt` for `Cpp20Modules` executable target

* Use `VULKAN_HPP_CONSTEXPR_INLINE` for constants in `vulkan.hpp`

- Added VULKAN_HPP_CONSTEXPR_INLINE macro definition
- Allow external linkage for these constants in C++17 and later
2023-07-10 08:46:50 +02:00
Sharadh Rajaraman
6c1996f068
Add C++20 module interface file and tests (#1582)
* feat: exported vk::raii types in vulkan.ixx, with a small test

* feat: *almost* complete vulkan.ixx; missing functions in vulkan_funcs.hpp and constexpr auto defines

* Exported free functions in `vulkan_funcs.hpp` in `vulkan.ixx`

* Completed vulkan.ixx

Exported all types, structs, functions; need to handle anonymous namespace and getDispatchLoaderStatic()

* Moved `vk::anon-namespace::throwResultException` to `vk::detail::throwResultException` to solve linking errors

* Made `vk::getDispatchLoaderStatic` not `static`

`static`in namespace/global scope has to do with internal/external linkage, and not lifetime

* Fixed debug assert fail in `generateCppModuleStructUsings`

* Removed references to `.cppm`

* Formatting and versioning changes

- CMake version handling simplified
- vulkan.ixx includes new structs from new versions
- vulkan.hpp and vulkan_raii.hpp reformatted with clang-format 14

* Removed extraneous includes

- std::optional -> std::string::empty
- std::filesystem was unused

* Fixed constexpr function and value generation
- 'c' prefix removed
- Constants casing fixed
- Types for constants fixed
- Constants assigned to macros
- Ordering of constants and consteval functions fixed

* Moved constexprs to `vulkan.hpp`

- Added corresponding `using` statements to `vulkan.ixx`
- Changed `consteval auto(auto)` functions into templated SFINAE `constexpr` functions

* Formatting, signposting, misc fixes

- Added newlines around macro guards
- Added signposting comments for relevant groups of `using`-statements in `vulkan.ixx`
- Guarded createInstanceUnique with macro guard
- Use m_handles.at("").commands for Funcs

* Changed module file extension to `.cppm`

- It follows the rest of the project convention; `ixx` looks really weird next to `.hpp` and `.cpp`
- CMake transparently handles any extension anyway

* Added `VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE` to `vulkan.cppm`

* Added format traits and extension inspections

- Straightforward, since everything is hard-coded

* Added documentation about Vulkan-Hpp C++ module

- Compiler requirements
- CMake compilation
- Command-line examples

* Added vulkan_hash.hpp

- No need for `using`, since all declarations are template specialisations of existing `std` objects

* Documentation and comment fixes

- Removed extraneous CMake version comments
- Documentation about default dynamic dispatcher with the module
- Comment updates in the source code

* Moved constexpr defines and using statements 

- Moved to after resultUsings in both vulkan.hpp and vulkan.cppm
- Also split up constexprDefinesAndUsings
- Used const_cast for constexprDefines()

* Used std::string instead of std::stringstream

- Some changes also in previous commit
- Also removed overly-clever ranges algorithms

* Simplified protection generation

- Removed `generateNotProtection`
- Added optional `bool` parameter to `generateProtection` for `#if !defined( ... )`

* Simplified Cpp20Modules CMakeLists

- Made C++ standard and libraries into parameters
- Removed FindVulkan call; already done

* `constexpr` generation fixed

- Made all generating functions `const`
- Removed typos and extra comments
- Extracted out filtering functionality into separate functions

* Simplified defines partition generation

- Added `DefinesPartition` struct as a member variable
- Added non-const function to write to the above in `readTypeDefines`
- Removed previous implementation that made many copies

* Added `generateUsingsAndProtection` lambda to RAII name generation

* Moved around `partitionDefines` to make more sense

- called once at the end of the constructor
- edited comments

* Updated headers to 1.3.255

* Removed std::ranges and ranges view adaptors

- CI isn't passing with them

* Fixed constexpr functions for C++11 and C++14

- Removed `enable_if_t` and `is_integral_v` 
- Changed `auto` return type into `uint32_t`

---------

Co-authored-by: Sharadh Rajaraman <r.sharadh@yahoo.com.sg>
2023-06-28 14:10:51 +02:00
Andreas Süßenbach
397ffad84a
Fix defines in workflow files to enable compilation of tests and samples in CI. (#1595) 2023-06-20 14:43:35 +02:00
Andreas Süßenbach
40e76b7c24
Cleanup in CMakeLists.txt (#1572) 2023-05-08 11:54:57 +02:00
Andreas Süßenbach
f25639bd17
Cleanup in CMakeLists.txt (#1566) 2023-04-27 16:16:10 +02:00
Andreas Süßenbach
e1d6ec8abf
Cleanup up on CMakeLists.txt (#1564) 2023-04-20 16:50:26 +02:00
Andreas Süßenbach
bf8bee64e1
Mark all projects as C++-only. (#1554) 2023-04-05 09:50:26 +02:00
Andreas Süßenbach
4befd8e643
extend workflow run to generate vulkansc*.hpp (#1525) 2023-03-07 14:07:16 +01:00
Andreas Süßenbach
68512e6702
Add options for clang-format 15. (#1480) 2023-01-16 17:38:34 +01:00
Andreas Süßenbach
40f7474120
Change the required CMake version to 3.12. (#1470) 2022-12-20 10:09:01 +01:00
Andreas Süßenbach
23a13e4707
Add support of clang_format version 13 and 14. (#1468) 2022-12-12 17:30:35 +01:00
asuessenbach
02c8049f42 Switch to C++20 for the Generator + some minor cleanup. 2022-09-06 18:22:04 +02:00
asuessenbach
d27e336ced Make the samples' precompiled headers reuse that from the utils project. 2022-09-01 08:53:55 +02:00
Stephan Seitz
4f35f16475 fix: install target 2022-08-22 10:16:25 +02:00
Stephan Seitz
1903527dd1 fix: make VULKAN_HPP_RUN_GENERATOR work again
Apparently, the statement setting ${vulkan_hpp} was removed with along
with the other generated header files the other generated header files.
2022-08-22 10:16:25 +02:00
asuessenbach
5480d192f5 Refactor the CMakeLists for all the samples; use vulkan.hpp/vulkan_raii.hpp as precompiled header. 2022-08-10 15:29:28 +02:00
asuessenbach
a8a2c5f910 Refactor top-level file generation function. 2022-08-02 10:00:16 +02:00
asuessenbach
893d6847bb Refactor top-level function to generate vulkan.hpp 2022-08-01 16:40:15 +02:00
asuessenbach
3aae157e5b Move the vk::to_string functions into a separate header vulkan_to_string.hpp. 2022-07-26 11:19:42 +02:00
Jinesi Yelizati
9748e47228
Speed up CI by using ninja and parallel build (#1347)
* chore(CI): speed up CI by using ninja and parallel build

* chore(CI): align compiler for c and cxx

* fix(samples): add dependency to generator

* fix(cmake): get rid of file glob

* chore(CI): use clang on mac

glfw don't support gcc on mac

* fix(sample): add depencency on build_vulkan_hpp

* fix(cmake): make sure every target in tests and samples link to utils
2022-07-07 10:22:21 +02:00
asuessenbach
611365b986 Updated clang_format options 2022-03-09 12:28:52 +01:00
asuessenbach
1c39502170 Extract trait functions on vk::Format into the additional header vulkan_format_traits.hpp. 2022-02-21 10:11:25 +01:00
asuessenbach
cdb64cdefd Generate std::hash specializations into the new file vulkan_hash.hpp, requiring C++14 for std::hash specializations of the vulkan structures. 2021-12-13 17:00:00 +01:00
David Neto
938d9e60e0 Use and recommend clang-format-11, not clang-format-10
Also:
- Fix the numbered list formatting in the README.md
- Describe the -DVULKAN_HPP_RUN_GENERATOR=ON option

Fixes: #1116
2021-10-25 12:45:39 -04:00
asuessenbach
dcb654bc0b Minor cleanup work.
+ changed CXX_STANDARD for VulkanHppGenerator from 14 to 17.
2021-10-11 10:20:26 +02:00
asuessenbach
74cb47eb82 Split vulkan.hpp into multiple sub-headers 2021-06-14 15:35:34 +02:00
asuessenbach
54b363320a Adjustments in AppVeyor build. 2021-05-31 17:46:07 +02:00
asuessenbach
ae49faf6b8 Allow older version of clang-format. 2021-03-30 13:39:15 +02:00
asuessenbach
2cb1c19c7f Introduce raii-compliant handle wrapper classes. 2021-02-22 16:19:12 +01:00
Markus Tavenrath
160dc916f9 Change structure member sType to non-const to allow default assignment operator. Make copy constructor and copy assignment default. The latter is required for C++20 designated initializers. Delegate the constructor from C-type to the copy constructor by casting rhs accordingly. Fix warnings on gcc/clang. 2021-01-18 12:25:50 +01:00
asuessenbach
e407d6eb9a Fix broken registry path usage 2020-10-26 09:16:34 +01:00
asuessenbach
e996ef2b31 Correct usage of VulkanRegistry_DIR 2020-10-21 10:58:34 +02:00
asuessenbach
8d1c84b3f5 Set warnings as errors for the generator, the samples, and the tests. 2020-10-14 17:44:16 +02:00
dan sinclair
35507a5648 Fixup usage of CMake variables.
This CL fixes the VULKAN_HPP_VULKAN_HEADERS_SRC_DIR and VULKAN_HPP_PATH
usages to use the values of the variables instead of the text strings.
2020-08-24 09:58:53 -04:00
Markus Tavenrath
df2bd3329c Don't fail setting up a CMake build environment generation if clang-format is not available 2020-08-12 15:27:05 +02:00
asuessenbach
95ff3bca61 Add c++14 test run with travis-CI using clang-10. 2020-07-30 10:32:23 +02:00
asuessenbach
e5d08a2aca Use VulkanRegistry_DIR and VulkanHeaders_INCLUDE_DIR as introduced in Vulkan-Tools/cmake/FindVulkanHeaders.cmake 2020-07-27 12:08:03 +02:00
asuessenbach
be6fcc0612 Turn Conformance Mode on for Visual Studio builds
+ reorganize library loading and still keep windows.h out.

Resolves #600
Resolves #629
2020-06-29 10:16:40 +02:00
asuessenbach
db58507063 Introduce VULKAN_HPP_NO_STRUCT_CONSTRUCTORS so support designated initializers.
You have to define VULKAN_HPP_NO_STRUCT_CONSTRUCTORS to remove all the struct constructors from vulkan.hpp, so that you can use designated initializers on them.
Of course, makes only sense with C++20.
2020-06-24 11:28:43 +02:00
asuessenbach
baff050abd Add version check for clang-format. 2020-05-04 16:27:19 +02:00
asuessenbach
f5e59484a6 Introduce usage of clang-format to format vulkan.hpp and the other sources. 2020-04-23 10:55:02 +02:00