Commit Graph

61 Commits

Author SHA1 Message Date
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
mocabe
9f5885ea52 [CMake] Disable tests in external libraries 2020-03-20 05:12:25 +09:00
asuessenbach
947583a1e5 Replace explicit template parameter MaskType for Flags types by std::underlying_type<BitType>::type and specify the underlying type for the FlagBits types
Resolves #507
2020-02-25 13:36:05 +01:00
mocabe
bb40388d34 CMake: Set CMAKE_CXX_STANDARD to 11 2020-02-06 10:12:08 +01:00
mocabe
b6a190f4a2 Building samples for Linux (#491)
* CMake: Fix SAMPLES_BUILD and TESTS_BUILD

* CMake: Enable sample build on linux

* samples: Use glfw for window creation

* samples: Fix include order

* samples: Support new window handling

* samples: Add build target for util

* samples: Update CMake scripts to use util target

* samples: Add WindowData to manage unique window

* samples: Surface handling using WIndowData

* sampels: Remove call for vk::su::destroyWindow()

* CMake: FIx more options

* samples: Build SurfaceCapabilities only on WIN32

* samples: Fixed RayTracing sample to build on Linux

* samples: Fix wrong check on SurfaceProtectedCapabilitiesKHR

This also fixes compilation with MinGW gcc/clang

* CMake: check CMAKE_SYSTEM_NAME for Linux samples

* CMake: Add source group for utils

* samples: Fix potential bugs

* samples: Reduce warnings on gcc/clang

* samples: Fix missmatched new/free() which is UB

* samples: Add missing initialization for dynamic dispatcher

* samples: Remove unnecessary  dispacther construct

Co-authored-by: Andreas Süßenbach <asuessenbach@nvidia.com>
2020-01-28 10:16:10 +01:00
dan sinclair
2bd8e403e8 Add option to install vulkan.hpp header (#429) 2019-11-14 10:07:27 +01:00
dan sinclair
8f3b1d6f01 Add CMakeList target to run generator (#424)
This CL adds the VULKAN_HPP_RUN_GENERATOR option which will run the
vulkan hpp generator from CMake if enabled.
2019-11-06 14:48:21 +01:00
dan sinclair
fe0c9e1c14 Allow setting vulkan paths. (#419)
This CL adds VULKAN_HPP_VULKAN_HEADERS_SRC_DIR and VULKAN_HPP_PATH
variables to the CMakeLists file.
2019-11-05 10:47:42 +01:00
dan sinclair
42d348f969 Allow setting tinyxml2 source directory (#417)
* Allow setting tinyxml2 source directory

This CL adds a build flag to allow the tinyxml2 source directory to
exist outside the Vulkan-HPP source tree.

* Add quotes around path
2019-10-31 10:06:22 +01:00
Andreas Süßenbach
ecfaf9a0df Add sample RayTracing. (#361) 2019-07-25 13:52:09 +02:00
Andreas Süßenbach
a6ad0f1eff Re-introduce vulkan/vulkan.hpp; adjust include order to use that header in samples and tests (#340) 2019-06-11 13:25:36 +02:00