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>
This commit is contained in:
Sharadh Rajaraman 2023-06-28 20:10:51 +08:00 committed by GitHub
parent 5d8c550b0d
commit 6c1996f068
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 4208 additions and 153 deletions

View File

@ -24,14 +24,26 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cmake_minimum_required(VERSION 3.12)
if( VULKAN_HPP_ENABLE_EXPERIMENTAL_CPP20_MODULES )
cmake_minimum_required( VERSION 3.25 )
if ( ${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.26 )
# CMake 3.26; need to handle future versions here
set( CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API 2182bf5c-ef0d-489a-91da-49dbc3090d2a )
else()
# CMake 3.25
set( CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API 3c375311-a3c9-4396-a187-3227ef642046 )
endif()
set( CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1 )
else()
cmake_minimum_required( VERSION 3.12 )
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 NOMINMAX VK_USE_PLATFORM_WIN32_KHR )
elseif( APPLE )
@ -65,7 +77,7 @@ function( vulkan_hpp__setup_warning_level )
set( oneValueArgs NAME )
set( multiValueArgs )
cmake_parse_arguments( TARGET "{options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
if( MSVC )
target_compile_options(${TARGET_NAME} PRIVATE /W4 /WX )
if( MSVC_VER GREATER_EQUAL 1910 )
@ -90,9 +102,9 @@ function( vulkan_hpp__setup_library )
set( oneValueArgs FOLDER NAME )
set( multiValueArgs HEADERS SOURCES )
cmake_parse_arguments( TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
vulkan_hpp__setup_project( NAME ${TARGET_NAME} )
if( "${TARGET_SOURCES}" STREQUAL "" )
add_library( ${TARGET_NAME} INTERFACE ${TARGET_HEADERS} )
else()
@ -123,7 +135,7 @@ function( vulkan_hpp__setup_sample )
vulkan_hpp__setup_project( NAME ${TARGET_NAME} )
add_executable( ${TARGET_NAME} ${TARGET_HEADERS} ${TARGET_SOURCES} )
vulkan_hpp__setup_platform( NAME ${TARGET_NAME} )
vulkan_hpp__setup_vulkan_include( NAME ${TARGET_NAME} )
vulkan_hpp__setup_warning_level( NAME ${TARGET_NAME} )
@ -133,15 +145,15 @@ function( vulkan_hpp__setup_sample )
if( TARGET_FOLDER )
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()
if( VULKAN_HPP_PRECOMPILE )
if( TARGET_PCH_REUSE )
target_precompile_headers( ${TARGET_NAME} REUSE_FROM "${TARGET_PCH_REUSE}" )
@ -241,7 +253,7 @@ function( vulkan_hpp__setup_test )
vulkan_hpp__setup_project( NAME ${TARGET_NAME} )
add_executable( ${TARGET_NAME} ${TARGET_NAME}.cpp )
vulkan_hpp__setup_platform( NAME ${TARGET_NAME} )
vulkan_hpp__setup_vulkan_include( NAME ${TARGET_NAME} )
vulkan_hpp__setup_warning_level( NAME ${TARGET_NAME} )
@ -300,6 +312,7 @@ 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_EXPERIMENTAL_CPP20_MODULES "Build Vulkan-Hpp as C++20 module" OFF )
# look for the file vk.xml, the ultimate source of truth for vulkan, to generate the headers from
if( NOT DEFINED VulkanRegistry_DIR )
@ -387,6 +400,23 @@ if( ${VULKAN_HPP_INSTALL} )
${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.cppm
)
install( FILES ${VK_GENERATED_VULKAN_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/vulkan )
endif()
# Build Vulkan-Hpp as a module
if( VULKAN_HPP_ENABLE_EXPERIMENTAL_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 )
target_compile_features( VulkanHppModule PUBLIC cxx_std_20 )
target_sources( VulkanHppModule
PUBLIC
FILE_SET vulkan_module_file BASE_DIRS ${CMAKE_SOURCE_DIR} TYPE CXX_MODULES FILES vulkan/vulkan.cppm )
target_include_directories( VulkanHppModule PUBLIC ${CMAKE_SOURCE_DIR} )
target_include_directories( VulkanHppModule PUBLIC "${CMAKE_SOURCE_DIR}/Vulkan-Headers/include" )
endif()

117
README.md
View File

@ -169,7 +169,7 @@ vk::ApplicationInfo applicationInfo{ .pApplicationName = AppName,
.pEngineName = EngineName,
.engineVersion = 1,
.apiVersion = VK_API_VERSION_1_1 };
// initialize the vk::InstanceCreateInfo
vk::InstanceCreateInfo instanceCreateInfo{ .pApplicationInfo = & applicationInfo };
```
@ -177,7 +177,7 @@ instead of
```c++
// initialize the vk::ApplicationInfo structure
vk::ApplicationInfo applicationInfo( AppName, 1, EngineName, 1, VK_API_VERSION_1_1 );
// initialize the vk::InstanceCreateInfo
vk::InstanceCreateInfo instanceCreateInfo( {}, &applicationInfo );
```
@ -600,6 +600,117 @@ Some functions might provide information that depends on the vulkan version. As
- `VULKAN_HPP_CONSTEXPR_20 bool isPromotedExtension( std::string const & extension );`
Returns `true` if the given extension is promoted to some other extension or vulkan version.
### C++20 standard module
#### Overview
<!-- todo: add a link to the file -->
Vulkan-Hpp now provides a [C++ standard module](https://en.cppreference.com/w/cpp/language/modules) in [`vulkan.cppm`](vulkan/vulkan.cppm).
C++ modules are intended to supersede headers so that declarations and definitions may be easily shared across translation units without repeatedly parsing headers; therefore, they can potentially drastically improve compile times for large projects.
In particular, Vulkan-Hpp has some extremely long headers (e.g. [`vulkan_structs.hpp`](vulkan/vulkan_structs.hpp)), and it is hoped that the C++ module will shorten compile times for projects currently using it.
#### Compiler support
This feature requires a recent compiler with complete C++20 support:
* Visual Studio 2019 16.10 or later (providing `cl.exe` 19.28 or later)
* Clang 15.0.0 or later
If you intend to use CMake's [experimental C++ module support](https://www.kitware.com/import-cmake-c20-modules/) (and possibly Ninja), then more recent tools are required:
* Visual Studio 17.4 or later (providing `cl.exe` 19.34 or later)
* Clang 16.0.0 or later
* CMake 3.25 or later
* Ninja 1.10.2 or later
Either way, GCC does not completely support C++ modules, is therefore not recommended for use.
##### Usage with CMake
CMake is recommended for use with the Vulkan C++ module, as it provides a convenient platform-agnostic way to configure your project.
As mentioned above, note that CMake's module support is experimental, and usage may change in the future.
Consult the blog post at the link above for more information.
CMake provides the [FindVulkan module](https://cmake.org/cmake/help/latest/module/FindVulkan.html), which may be used to source the Vulkan SDK and Vulkan headers on your system.
**Note that this module does not yet provide an IMPORTED target for the Vulkan C++ module, so you must set it up manually.**
To use CMake with C++ modules, you must first enable its experimental support, set up `vulkan.cppm` as the source for a library target with `FILE_SET` configured `TYPE = CXX_MODULES`, and then link it into your project.
```cmake
# enable C++ module support
cmake_minimum_required( VERSION 3.25 )
# test if CMake version is ≥ 3.26
if ( ${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.26 )
# CMake 3.26; need to handle future versions here
set( CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API 2182bf5c-ef0d-489a-91da-49dbc3090d2a )
else()
# CMake 3.25
set( CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API 3c375311-a3c9-4396-a187-3227ef642046 )
endif()
set( CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1 )
...
# find Vulkan SDK
find_package( Vulkan REQUIRED )
# set up Vulkan C++ module
add_library(VulkanCppModule)
target_sources(VulkanCppModule PRIVATE
FILE_SET CXX_MODULES
FILES ${Vulkan_INCLUDE_DIR}/vulkan.cppm
)
# link Vulkan C++ module into your project
add_executable(YourProject main.cpp)
target_link_libraries(YourProject VulkanCppModule)
```
Once this is done, in `main.cpp`, simply import the Vulkan module. An example is provided in [`tests/Cpp20Modules/Cpp20Modules.cpp`](tests/Cpp20Modules/Cpp20Modules.cpp). Note that the module is imported as `vulkan`, not `vulkan.hpp`.
```cpp
import vulkan;
auto main(int argc, char* const argv[]) -> int
{
auto appInfo = vk::ApplicationInfo( "My App", 1, "My Engine", 1, vk::makeApiVersion( 1, 0, 0, 0 ) );
// ...
}
```
Finally, you can configure and build your project as usual.
Note that CMake currently only supports the Ninja and Visual Studio generators for C++ modules.
Furthermore, the C++ module also pre-defines `VULKAN_HPP_DEFAULT_DISPATCHER_DYNAMIC_STORAGE` by default.
Therefore, if you wish to use dynamic dispatch with the Vulkan-Hpp C++ module, all that is necessary is to define the macro ` VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1` in your project.
##### Command-line usage
If you want to use the Vulkan-Hpp C++ module without CMake, you must first pre-compile it, and then import it into your project.
You will also need to define any macros that control various features of Vulkan-Hpp, such as `VULKAN_HPP_NO_EXCEPTIONS` and `VULKAN_HPP_NO_SMART_HANDLE`.
Different compilers have different command-lines for module pre-compilation; however, for initial use, some examples are provided below, assuming the same `main.cpp` consumer as above.
For MSVC, source `vcvars64.bat` or use a Developer Command Prompt/PowerShell instance, and run the following:
```cmd
cl.exe /std:c++20 /interface /TP <path-to-vulkan-hpp>\vulkan.cppm
cl.exe /std:c++20 /reference vulkan=vulkan.ifc main.cpp vulkan.obj
.\main.exe
```
For Clang, run the following:
```shell
clang++ -std=c++20 <path-to-vulkan-hpp>/vulkan.cppm -precompile -o vulkan.pcm
clang++ -std=c++20 -fprebuilt-module-path=. main.cpp vulkan.pcm -o main
./main
```
More information about module compilation may be found at the respective compiler's documentation:
* [MSVC](https://learn.microsoft.com/en-us/cpp/cpp/modules-cpp?view=msvc-170)
* [Clang](https://clang.llvm.org/docs/StandardCPlusPlusModules.html)
### Samples and Tests
When you configure your project using CMake, you can enable SAMPLES_BUILD to add some sample projects to your solution. Most of them are ports from the LunarG samples, but there are some more, like CreateDebugUtilsMessenger, InstanceVersion, PhysicalDeviceDisplayProperties, PhysicalDeviceExtensions, PhysicalDeviceFeatures, PhysicalDeviceGroups, PhysicalDeviceMemoryProperties, PhysicalDeviceProperties, PhysicalDeviceQueueFamilyProperties, and RayTracing. All those samples should just compile and run.
@ -721,7 +832,7 @@ With this define you can include a reflection mechanism on the vk-structures. It
Feel free to submit a PR to add to this list.
- [Examples](https://github.com/jherico/vulkan) A port of Sascha Willems [examples](https://github.com/SaschaWillems/Vulkan) to Vulkan-Hpp
- [Examples](https://github.com/jherico/vulkan) A port of Sascha Willems [examples](https://github.com/SaschaWillems/Vulkan) to Vulkan-Hpp
- [Vookoo](https://github.com/andy-thomason/Vookoo/) Stateful helper classes for Vulkan-Hpp, [Introduction Article](https://accu.org/journals/overload/25/139/overload139.pdf#page=14).
## License

View File

@ -15,11 +15,20 @@
#include "VulkanHppGenerator.hpp"
#include <algorithm>
#include <array>
#include <cassert>
#include <fstream>
#include <regex>
#include <sstream>
struct MacroData
{
std::string deprecatedComment = {};
std::string calleeMacro = {};
std::vector<std::string> params = {};
std::string definition = {};
};
void checkAttributes( int line,
std::map<std::string, std::string> const & attributes,
std::map<std::string, std::set<std::string>> const & required,
@ -55,6 +64,7 @@ std::string toString( tinyxml2::XMLError er
std::string trim( std::string const & input );
std::string trimEnd( std::string const & input );
std::string trimStars( std::string const & input );
MacroData parseMacro( std::vector<std::string> const & completeMacro );
void writeToFile( std::string const & str, std::string const & fileName );
const std::set<std::string> specialPointerTypes = { "Display", "IDirectFB", "wl_display", "xcb_connection_t", "_screen_window" };
@ -90,6 +100,8 @@ VulkanHppGenerator::VulkanHppGenerator( tinyxml2::XMLDocument const & document,
addCommandsToHandle( extension.requireData );
addMissingFlagBits( extension.requireData, extension.name );
}
m_definesPartition = partitionDefines( m_defines );
}
void VulkanHppGenerator::generateEnumsHppFile() const
@ -492,6 +504,7 @@ ${throwResultException}
${ResultValue}
${resultChecks}
${constexprDefines}
} // namespace VULKAN_HPP_NAMESPACE
// clang-format off
@ -519,6 +532,7 @@ ${DispatchLoaderDynamic}
{ "ArrayWrapper1D", readSnippet( "ArrayWrapper1D.hpp" ) },
{ "ArrayWrapper2D", readSnippet( "ArrayWrapper2D.hpp" ) },
{ "baseTypes", generateBaseTypes() },
{ "constexprDefines", generateConstexprDefines() },
{ "defines", readSnippet( "defines.hpp" ) },
{ "DispatchLoaderBase", readSnippet( "DispatchLoaderBase.hpp" ) },
{ "DispatchLoaderDefault", readSnippet( "DispatchLoaderDefault.hpp" ) },
@ -682,6 +696,43 @@ ${enumsToString}
writeToFile( str, vulkan_to_string_hpp );
}
void VulkanHppGenerator::generateCppModuleFile() const
{
std::string const vulkan_cppm = std::string( BASE_PATH ) + "/vulkan/" + m_api + ".cppm";
std::cout << "VulkanHppGenerator: Generating " << vulkan_cppm << "..." << std::endl;
std::string const vulkanCppmTemplate = R"(${licenseHeader}
module;
#include <vulkan/vulkan.hpp>
#include <vulkan/vulkan_extension_inspection.hpp>
#include <vulkan/vulkan_format_traits.hpp>
#include <vulkan/vulkan_hash.hpp>
#include <vulkan/vulkan_raii.hpp>
export module ${api};
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE
export namespace VULKAN_HPP_NAMESPACE
{
${usings}
export namespace VULKAN_HPP_RAII_NAMESPACE {
${raiiUsings}
} // namespace VULKAN_HPP_RAII_NAMESPACE
} // namespace VULKAN_HPP_NAMESPACE
)";
auto const str = replaceWithMap( vulkanCppmTemplate,
{ { "licenseHeader", m_vulkanLicenseHeader },
{ "api", m_api },
{ "usings", generateCppModuleUsings() },
{ "raiiUsings", generateCppModuleRaiiUsings() } } );
writeToFile( str, vulkan_cppm );
}
void VulkanHppGenerator::prepareRAIIHandles()
{
// filter out functions that are not usefull on this level of abstraction (like vkGetInstanceProcAddr)
@ -4676,6 +4727,651 @@ std::string VulkanHppGenerator::generateConstexprString( std::string const & str
return isConstExpression ? ( std::string( "VULKAN_HPP_CONSTEXPR" ) + ( ( containsUnion( structName ) || containsArray( structName ) ) ? "_14 " : " " ) ) : "";
}
std::string VulkanHppGenerator::generateConstexprDefines() const
{
auto const constexprFunctionTemplate = std::string{ R"( template <typename T, typename = typename std::enable_if<std::is_integral<T>::value>::type>
${deprecated}VULKAN_HPP_CONSTEXPR uint32_t ${constName}( ${arguments} )
{
return ${implementation};
}
)" };
auto const constexprCallTemplate = std::string{ R"( ${deprecated}VULKAN_HPP_CONSTEXPR auto ${constName} = ${callee}( ${arguments} );
)" };
auto const constexprValueTemplate = std::string{ R"( ${deprecated}VULKAN_HPP_CONSTEXPR ${type} ${constName} = ${value};
)" };
auto const deprecatedAttribute = std::string{ R"(VULKAN_HPP_DEPRECATED("${reason}") )" };
auto constexprDefines = std::string{ R"(
//=========================================
//=== CONSTEXPR CONSTANTs AND FUNCTIONs ===
//=========================================
)" };
// handle the value and callee macros first so they are visible for use in functions below.
// hardcoded constants.
for ( auto const & [macro, data] : m_constants )
{
// make `macro` PascalCase, and strip the `Vk` prefix
auto const constName = stripPrefix( toCamelCase( macro ), "Vk" );
constexprDefines +=
replaceWithMap( constexprValueTemplate, { { "type", data.type }, { "constName", constName }, { "deprecated", "" }, { "value", macro } } );
}
// values
for ( auto const & [macro, data] : m_definesPartition.values )
{
auto const deprecated = data.deprecated ? replaceWithMap( deprecatedAttribute, { { "reason", data.deprecationReason } } ) : "";
// make `macro` PascalCase and strip the `Vk` prefix
auto const constName = stripPrefix( toCamelCase( macro ), "Vk" );
auto const valueString =
replaceWithMap( constexprValueTemplate, { { "type", "uint32_t" }, { "constName", constName }, { "deprecated", deprecated }, { "value", macro } } );
constexprDefines += valueString;
}
// functions
for ( auto const & [macro, data] : m_definesPartition.callees )
{
auto const deprecated = data.deprecated ? replaceWithMap( deprecatedAttribute, { { "reason", data.deprecationReason } } ) : "";
// make `macro` camelCase and strip the `Vk` prefix
auto const constName = startLowerCase( stripPrefix( toCamelCase( macro ), "Vk" ) );
// for every parameter, need to use auto const and append a comma if needed (i.e. has more than one parameter, and not for the last one)
auto parametersString = std::string{};
for ( auto const & paramString : data.params )
{
parametersString += "T const " + paramString + ", ";
}
// trim the last two characters (i.e. the last comma and the space)
parametersString.resize( parametersString.size() - 2 );
auto const functionString = replaceWithMap(
constexprFunctionTemplate,
{ { "arguments", parametersString }, { "constName", constName }, { "deprecated", deprecated }, { "implementation", data.possibleDefinition } } );
constexprDefines += functionString;
}
// callers
for ( auto const & [macro, data] : m_definesPartition.callers )
{
auto const deprecated = data.deprecated ? replaceWithMap( deprecatedAttribute, { { "reason", data.deprecationReason } } ) : "";
// make `macro` PascalCase and strip the `Vk` prefix
auto const constName = stripPrefix( toCamelCase( macro ), "Vk" );
auto argumentsString = std::string{};
// for every argument, append a comma if needed (i.e. has more than one parameter, and not for the last one)
for ( auto const & argString : data.params )
{
argumentsString += argString + ", ";
}
// trim the last two characters (i.e. the last comma and the space)
argumentsString.resize( argumentsString.size() - 2 );
auto const callerString = replaceWithMap(
constexprCallTemplate,
{ { "arguments", argumentsString }, { "callee", startLowerCase( data.possibleCallee ) }, { "constName", constName }, { "deprecated", deprecated } } );
constexprDefines += callerString;
}
return constexprDefines;
}
std::string VulkanHppGenerator::generateConstexprUsings() const
{
auto constexprUsings = std::string{ R"(
//=========================================
//=== CONSTEXPR CONSTANTs AND FUNCTIONs ===
//=========================================
)" };
auto const constexprUsingTemplate = std::string{ R"( using VULKAN_HPP_NAMESPACE::${constName};
)" };
auto const pascalCasePrefixStrip = []( std::string const & macro ) { return stripPrefix( toCamelCase( macro ), "Vk" ); };
auto const camelCasePrefixStrip = []( std::string const & macro ) { return startLowerCase( stripPrefix( toCamelCase( macro ), "Vk" ) ); };
// constants
for ( auto const & macro : m_constants )
{
// make `macro` PascalCase and strip the `Vk` prefix
auto const constName = pascalCasePrefixStrip( macro.first );
constexprUsings += replaceWithMap( constexprUsingTemplate, { { "constName", constName } } );
}
// values
for ( auto const & macro : m_definesPartition.values )
{
// make `macro` PascalCase and strip the `Vk` prefix
auto const constName = pascalCasePrefixStrip( macro.first );
constexprUsings += replaceWithMap( constexprUsingTemplate, { { "constName", constName } } );
}
// callees
for ( auto const & macro : m_definesPartition.callees )
{
// make `macro` camelCase and strip the `Vk` prefix
auto const constName = camelCasePrefixStrip( macro.first );
constexprUsings += replaceWithMap( constexprUsingTemplate, { { "constName", constName } } );
}
// callers
for ( auto const & macro : m_definesPartition.callers )
{
// make `macro` PascalCase and strip the `Vk` prefix
auto const constName = pascalCasePrefixStrip( macro.first );
constexprUsings += replaceWithMap( constexprUsingTemplate, { { "constName", constName } } );
}
return constexprUsings;
}
std::string VulkanHppGenerator::generateCppModuleHandleUsings() const
{
auto const usingTemplate = std::string{ R"( using VULKAN_HPP_NAMESPACE::${className};
)" };
auto handleUsings = std::string{ R"(
//===============
//=== HANDLEs ===
//===============
using VULKAN_HPP_NAMESPACE::isVulkanHandleType;
)" };
auto const generateUsingsAndProtection = [&usingTemplate, this]( std::vector<RequireData> const & requireData, std::string const & title )
{
auto usings = std::string{};
for ( auto const & require : requireData )
{
for ( auto const & type : require.types )
{
if ( auto const & handleIt = m_handles.find( type ); handleIt != m_handles.end() )
{
usings += replaceWithMap( usingTemplate, { { "className", stripPrefix( handleIt->first, "Vk" ) } } );
}
}
}
return addTitleAndProtection( title, usings );
};
for ( auto const & feature : m_features )
{
handleUsings += generateUsingsAndProtection( feature.requireData, feature.name );
}
for ( auto const & extension : m_extensions )
{
handleUsings += generateUsingsAndProtection( extension.requireData, extension.name );
}
return handleUsings;
}
std::string VulkanHppGenerator::generateCppModuleStructUsings() const
{
auto const usingTemplate = std::string{ R"( using VULKAN_HPP_NAMESPACE::${structName};
)" };
auto structUsings = std::string{ R"(
//===============
//=== STRUCTs ===
//===============
)" };
auto listedStructs = std::set<std::string>{};
auto const generateUsingsAndProtection = [&listedStructs, &usingTemplate, this]( std::vector<RequireData> const & requireData, std::string const & title )
{
auto localUsings = std::string{};
for ( auto const & require : requireData )
{
for ( auto const & type : require.types )
{
if ( auto const & structIt = m_structs.find( type ); structIt != m_structs.end() && listedStructs.insert( type ).second )
{
auto const structureType = stripPrefix( structIt->first, "Vk" );
localUsings += replaceWithMap( usingTemplate, { { "structName", structureType } } );
// replace the findAlias call with the contents, because it includes an assert that breaks in Debug mode, which shouldn't break. There are multiple
// aliases for a given struct, and that's ok. Maybe we should refactor
for ( auto const & [alias, aliasData] : m_structAliases )
{
if ( aliasData.name == structIt->first )
{
auto const aliasName = stripPrefix( alias, "Vk" );
localUsings += replaceWithMap( usingTemplate, { { "structName", aliasName } } );
}
}
}
}
}
return addTitleAndProtection( title, localUsings );
};
for ( auto const & feature : m_features )
{
structUsings += generateUsingsAndProtection( feature.requireData, feature.name );
}
for ( auto const & extension : m_extensions )
{
structUsings += generateUsingsAndProtection( extension.requireData, extension.name );
}
return structUsings;
}
std::string VulkanHppGenerator::generateCppModuleUniqueHandleUsings() const
{
auto const usingTemplate = std::string{ R"( using VULKAN_HPP_NAMESPACE::Unique${handleName};
)" };
auto uniqueHandleUsings = std::string{ R"(
//======================
//=== UNIQUE HANDLEs ===
//======================
)" };
auto const [smartHandleEnter, smartHandleLeave] = generateProtection( "VULKAN_HPP_NO_SMART_HANDLE", false );
uniqueHandleUsings += "\n" + smartHandleEnter;
auto const generateUsingsAndProtection = [&usingTemplate, this]( std::vector<RequireData> const & requireData, std::string const & title )
{
auto usings = std::string{};
for ( auto const & require : requireData )
{
for ( auto const & type : require.types )
{
if ( auto const & handleIt = m_handles.find( type ); handleIt != m_handles.end() && !handleIt->second.deleteCommand.empty() )
{
usings += replaceWithMap( usingTemplate, { { "handleName", stripPrefix( handleIt->first, "Vk" ) } } );
}
}
}
return addTitleAndProtection( title, usings );
};
for ( auto const & feature : m_features )
{
uniqueHandleUsings += generateUsingsAndProtection( feature.requireData, feature.name );
}
for ( auto const & extension : m_extensions )
{
uniqueHandleUsings += generateUsingsAndProtection( extension.requireData, extension.name );
}
uniqueHandleUsings += R"( using VULKAN_HPP_NAMESPACE::UniqueHandleTraits;
)";
uniqueHandleUsings += smartHandleLeave + "\n";
return uniqueHandleUsings;
}
std::string VulkanHppGenerator::generateCppModuleFuncsUsings() const
{
auto const usingTemplate = std::string{ R"( using VULKAN_HPP_NAMESPACE::${funcName};
)" };
auto funcUsings = std::string{ R"(
//===========================
//=== COMMAND Definitions ===
//===========================
)" };
for ( auto const & func : m_handles.at( "" ).commands )
{
funcUsings += replaceWithMap( usingTemplate, { { "funcName", startLowerCase( stripPrefix( func, "vk" ) ) } } );
}
auto const [enter, leave] = generateProtection( "VULKAN_HPP_NO_SMART_HANDLE", false );
funcUsings += "\n" + enter + replaceWithMap( usingTemplate, { { "funcName", "createInstanceUnique" } } ) + leave + "\n";
return funcUsings;
}
std::string VulkanHppGenerator::generateCppModuleEnumUsings() const
{
auto const usingTemplate = std::string{ R"( using VULKAN_HPP_NAMESPACE::${enumName};
)" };
auto enumUsings = std::string{ R"(
//=============
//=== ENUMs ===
//=============
)" };
auto listedEnums = std::set<std::string>{};
// insert CppType first
enumUsings += replaceWithMap( usingTemplate, { { "enumName", "CppType" } } );
auto const generateUsingsAndProtection = [&listedEnums, &usingTemplate, this]( std::vector<RequireData> const & requireData, std::string const & title )
{
auto localUsings = std::string{};
for ( auto const & require : requireData )
{
for ( auto const & type : require.types )
{
if ( auto const & enumIt = m_enums.find( type ); enumIt != m_enums.end() && listedEnums.insert( type ).second )
{
auto const enumName = stripPrefix( enumIt->first, "Vk" );
localUsings += replaceWithMap( usingTemplate, { { "enumName", enumName } } );
if ( auto const aliasIt = findAlias( enumIt->first, m_enumAliases ); aliasIt != m_enumAliases.end() )
{
localUsings += replaceWithMap( usingTemplate, { { "enumName", stripPrefix( aliasIt->first, "Vk" ) } } );
}
if ( auto const bitmaskIt =
std::find_if( m_bitmasks.begin(),
m_bitmasks.end(),
[&enumIt]( std::pair<std::string, BitmaskData> const & bitmask ) { return bitmask.second.require == enumIt->first; } );
bitmaskIt != m_bitmasks.end() )
{
localUsings += replaceWithMap( usingTemplate, { { "enumName", stripPrefix( bitmaskIt->first, "Vk" ) } } );
}
}
}
}
return addTitleAndProtection( title, localUsings );
};
for ( auto const & feature : m_features )
{
enumUsings += generateUsingsAndProtection( feature.requireData, feature.name );
}
for ( auto const & extension : m_extensions )
{
enumUsings += generateUsingsAndProtection( extension.requireData, extension.name );
}
// finally insert IndexTypeValue
auto const indexTypeComment = R"(
//=========================
//=== Index Type Traits ===
//=========================
)";
enumUsings += indexTypeComment + replaceWithMap( usingTemplate, { { "enumName", "IndexTypeValue" } } );
return enumUsings;
}
std::string VulkanHppGenerator::generateCppModuleFormatTraitsUsings() const
{
// everything is hardcoded, so things are very easy...
auto formatTraitsUsings = std::string{ R"(
//=====================
//=== Format Traits ===
//=====================
)" };
auto const usingTemplate = std::string{ R"( using VULKAN_HPP_NAMESPACE::${function};
)" };
auto const formatTraitFunctions = std::array{ "blockExtent",
"blockSize",
"compatibilityClass",
"componentBits",
"componentCount",
"componentName",
"componentNumericFormat",
"componentPlaneIndex",
"componentsAreCompressed",
"compressionScheme",
"isCompressed",
"packed",
"planeCompatibleFormat",
"planeCount",
"planeHeightDivisor",
"planeWidthDivisor",
"texelsPerBlock" };
for ( auto const & func : formatTraitFunctions )
{
formatTraitsUsings += replaceWithMap( usingTemplate, { { "function", func } } );
}
return formatTraitsUsings;
}
std::string VulkanHppGenerator::generateCppModuleExtensionInspectionUsings() const
{
auto const usingTemplate = std::string{ R"( using VULKAN_HPP_NAMESPACE::${function};
)" };
auto extensionInspectionsUsings = std::string{ R"(
//======================================
//=== Extension inspection functions ===
//======================================
)" };
auto const extensionInspectionFunctions =
std::array{ "getDeviceExtensions", "getInstanceExtensions", "getDeprecatedExtensions", "getExtensionDepends", "getExtensionDepends",
"getObsoletedExtensions", "getPromotedExtensions", "getExtensionDeprecatedBy", "getExtensionObsoletedBy", "getExtensionPromotedTo",
"isDeprecatedExtension", "isDeviceExtension", "isInstanceExtension", "isObsoletedExtension", "isPromotedExtension" };
for ( auto const & func : extensionInspectionFunctions )
{
extensionInspectionsUsings += replaceWithMap( usingTemplate, { { "function", func } } );
}
return extensionInspectionsUsings;
}
std::string VulkanHppGenerator::generateCppModuleUsings() const
{
auto const usingTemplate = std::string{ R"( using VULKAN_HPP_NAMESPACE::${className};
)" };
auto const hardCodedTypes = std::array{ "ArrayWrapper1D", "ArrayWrapper2D", "FlagTraits", "Flags", "DispatchLoaderBase" };
auto const hardCodedEnhancedModeTypes =
std::array{ "ArrayProxy", "ArrayProxyNoTemporaries", "StridedArrayProxy", "Optional", "StructureChain", "UniqueHandle" };
auto const hardCodedSmartHandleTypes = std::array{ "ObjectDestroy", "ObjectFree", "ObjectRelease", "PoolFree" };
auto usings = std::string{ R"( //=====================================
//=== HARDCODED TYPEs AND FUNCTIONs ===
//=====================================
)" };
for ( auto const & className : hardCodedTypes )
{
usings += replaceWithMap( usingTemplate, { { "className", className } } );
}
auto const & [noPrototypesEnter, noPrototypesLeave] = generateProtection( "VK_NO_PROTOTYPES", false );
usings += "\n" + noPrototypesEnter + replaceWithMap( usingTemplate, { { "className", "DispatchLoaderStatic" } } ) + noPrototypesLeave + "\n";
// insert the Flags bitwise operators
auto const flagsBitWiseOperatorsUsings = std::array{ "operator&", "operator|", "operator^", "operator~" };
for ( auto const & operatorName : flagsBitWiseOperatorsUsings )
{
usings += replaceWithMap( usingTemplate, { { "className", operatorName } } );
}
// delete the namespace declaration for the default dispatcher macro using statement
usings += R"(using VULKAN_HPP_DEFAULT_DISPATCHER_TYPE;
)";
auto enhancedModeUsings = std::string{};
for ( auto const & className : hardCodedEnhancedModeTypes )
{
enhancedModeUsings += replaceWithMap( usingTemplate, { { "className", std::string{ className } } } );
}
// protect the enhanced-mode usings with a macro
auto [enterEnhancedMode, leaveEnhancedMode] = generateProtection( "VULKAN_HPP_DISABLE_ENHANCED_MODE", false );
usings += "\n" + enterEnhancedMode + enhancedModeUsings + leaveEnhancedMode + "\n";
auto noSmartHandleUsings = std::string{};
for ( auto const & className : hardCodedSmartHandleTypes )
{
noSmartHandleUsings += replaceWithMap( usingTemplate, { { "className", std::string{ className } } } );
}
// likewise for the smart-handle usings
auto [enterNoSmartHandle, leaveNoSmartHandle] = generateProtection( "VULKAN_HPP_NO_SMART_HANDLE", false );
usings += "\n" + enterNoSmartHandle + noSmartHandleUsings + leaveNoSmartHandle + "\n";
// now generate baseTypes
auto baseTypes = std::string{ R"(
//==================
//=== BASE TYPEs ===
//==================
)" };
for ( auto const & baseType : m_baseTypes )
{
if ( baseType.first != "VkFlags" && baseType.first != "VkFlags64" && !baseType.second.typeInfo.type.empty() )
{
baseTypes += replaceWithMap( usingTemplate, { { "className", stripPrefix( baseType.first, "Vk" ) } } );
}
}
usings += baseTypes;
// generate Enums
usings += generateCppModuleEnumUsings();
// to_string, toHexString
auto const toString = std::array{ "to_string", "toHexString" };
auto const [toStringEnter, toStringLeave] = generateProtection( "VULKAN_HPP_NO_TO_STRING", false );
usings += R"(
//======================
//=== ENUM to_string ===
//======================
)" + toStringEnter;
for ( auto const & name : toString )
{
usings += replaceWithMap( usingTemplate, { { "className", name } } );
}
usings += toStringLeave + "\n";
// hardcoded exceptions and functions
auto const hardCodedExceptionTypesAndFunctions =
std::array{ "ErrorCategoryImpl", "Error", "LogicError", "SystemError", "errorCategory", "make_error_code", "make_error_condition" };
auto [exceptionsEnter, exceptionsLeave] = generateProtection( "VULKAN_HPP_NO_EXCEPTIONS", false );
auto exceptionsUsings = std::string{ R"(
//=============================
//=== EXCEPTIONs AND ERRORs ===
//=============================
)" } + exceptionsEnter;
for ( auto const & name : hardCodedExceptionTypesAndFunctions )
{
exceptionsUsings += replaceWithMap( usingTemplate, { { "className", name } } );
}
usings += exceptionsUsings;
// result Exceptions
auto resultExceptionsUsings = std::string{};
auto const & [name, data] = *m_enums.find( "VkResult" );
for ( auto const & [alias, bitpos, enumName, protect, value, xmlLine] : data.values )
{
if ( alias.empty() && enumName.starts_with( "VK_ERROR" ) )
{
auto [enter, leave] = generateProtection( protect );
enter = enter.empty() ? enter : "\n" + enter;
leave = leave.empty() ? leave : leave + "\n";
auto const valueName = generateEnumValueName( name, enumName, false );
auto const className = stripPrefix( valueName, "eError" ) + "Error";
resultExceptionsUsings += enter + replaceWithMap( usingTemplate, { { "className", className } } ) + leave;
}
}
usings += resultExceptionsUsings;
usings += exceptionsLeave + "\n";
// ResultValue
auto const hardCodedResultValueTypes = std::array{ "ignore", "ResultValue", "ResultValueType", "createResultValueType" };
for ( auto const & className : hardCodedResultValueTypes )
{
usings += replaceWithMap( usingTemplate, { { "className", className } } );
}
// resultCheck
usings += replaceWithMap( usingTemplate, { { "className", "resultCheck" } } ) + "\n";
usings += generateConstexprUsings() + "\n";
// structs, handles, UniqueHandles, etc
usings += generateCppModuleStructUsings();
usings += generateCppModuleHandleUsings();
usings += generateCppModuleUniqueHandleUsings();
usings += generateCppModuleFuncsUsings();
auto const [enterDisableEnhanced, leaveDisableEnhanced] = generateProtection( "VULKAN_HPP_DISABLE_ENHANCED_MODE", false );
usings += "\n" + enterDisableEnhanced + replaceWithMap( usingTemplate, { { "className", "StructExtends" } } ) + leaveDisableEnhanced + "\n";
auto const [enterDynamicLoader, leaveDynamicLoader] = generateProtection( "VULKAN_HPP_DYNAMIC_LOADER_TOOL" );
usings += "\n" + enterDynamicLoader + replaceWithMap( usingTemplate, { { "className", "DynamicLoader" } } ) + leaveDynamicLoader + "\n";
usings += replaceWithMap( usingTemplate, { { "className", "DispatchLoaderDynamic" } } ) + "\n";
usings += generateCppModuleFormatTraitsUsings();
usings += generateCppModuleExtensionInspectionUsings();
return usings;
}
std::string VulkanHppGenerator::generateCppModuleRaiiUsings() const
{
auto const raiiUsingTemplate = std::string{ R"( using VULKAN_HPP_RAII_NAMESPACE::${className};
)" };
auto usings = std::string{ R"( //======================
//=== RAII HARDCODED ===
//======================
using VULKAN_HPP_RAII_NAMESPACE::exchange;
using VULKAN_HPP_RAII_NAMESPACE::Context;
using VULKAN_HPP_RAII_NAMESPACE::ContextDispatcher;
using VULKAN_HPP_RAII_NAMESPACE::InstanceDispatcher;
using VULKAN_HPP_RAII_NAMESPACE::DeviceDispatcher;
//====================
//=== RAII HANDLEs ===
//====================
)" };
auto const generateUsingsAndProtection = [&raiiUsingTemplate, this]( std::vector<RequireData> const & requireData, std::string const & title )
{
auto usings = std::string{};
for ( auto const & require : requireData )
{
for ( auto const & type : require.types )
{
if ( auto const & handleIt = m_handles.find( type ); handleIt != m_handles.end() )
{
usings += replaceWithMap( raiiUsingTemplate, { { "className", stripPrefix( handleIt->first, "Vk" ) } } );
// if there is an array constructor, generate the plural type also
if ( !generateRAIIHandleConstructors( *handleIt ).second.empty() )
{
usings += replaceWithMap( raiiUsingTemplate, { { "className", stripPrefix( type, "Vk" ) + "s" } } );
}
}
}
}
return addTitleAndProtection( title, usings );
};
// now, insert features and extensions with protection, and strip Vk prefix
for ( auto const & feature : m_features )
{
usings += generateUsingsAndProtection( feature.requireData, feature.name );
}
for ( auto const & extension : m_extensions )
{
usings += generateUsingsAndProtection( extension.requireData, extension.name );
}
return usings;
}
std::string VulkanHppGenerator::generateDataDeclarations( CommandData const & commandData,
std::vector<size_t> const & returnParams,
std::map<size_t, VectorParamData> const & vectorParams,
@ -5954,7 +6650,8 @@ std::string VulkanHppGenerator::generateExtensionTypeTest( std::string const & t
if ( extension.type == type )
{
auto [enter, leave] = generateProtection( getProtectFromTitle( extension.name ) );
typeTest += ( ( previousEnter != enter ) ? ( "\n" + previousLeave + enter ) : "\n" ) + ( first ? "" : " || ") + "( extension == \"" + extension.name + "\" )";
typeTest +=
( ( previousEnter != enter ) ? ( "\n" + previousLeave + enter ) : "\n" ) + ( first ? "" : " || " ) + "( extension == \"" + extension.name + "\" )";
previousEnter = enter;
previousLeave = leave;
first = false;
@ -6925,9 +7622,10 @@ std::string VulkanHppGenerator::generateObjectDeleter( std::string const & comma
return objectDeleter + "<" + parentName + ", Dispatch>( " + ( ( parentName == "NoParent" ) ? "" : "*this, " ) + allocator + "d )";
}
std::pair<std::string, std::string> VulkanHppGenerator::generateProtection( std::string const & protect ) const
std::pair<std::string, std::string> VulkanHppGenerator::generateProtection( std::string const & protect, bool defined ) const
{
return protect.empty() ? std::make_pair( "", "" ) : std::make_pair( "#if defined( " + protect + " )\n", "#endif /*" + protect + "*/\n" );
auto const openProtect = defined ? "#if defined( " : "#if !defined( ";
return protect.empty() ? std::make_pair( "", "" ) : std::make_pair( openProtect + protect + " )\n", "#endif /*" + protect + "*/\n" );
}
std::string VulkanHppGenerator::generateRAIICommandDefinitions() const
@ -7858,7 +8556,7 @@ ${enter} ${handleType}s( ${constructorArguments} )
}
else
{
throwResultException( result, "${constructorCall}" );
detail::throwResultException( result, "${constructorCall}" );
}
}
${leave})";
@ -8147,7 +8845,7 @@ ${enter} ${handleType}( ${constructorArguments} )
VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>( ${getDispatcher}->${constructorCall}( ${callArguments} ) );
if ( ${failureCheck} )
{
throwResultException( result, "${constructorCall}" );
detail::throwResultException( result, "${constructorCall}" );
}${dispatcherInit}
}
${leave})";
@ -8279,7 +8977,7 @@ ${enter} ${handleType}s( ${constructorArguments} )
}
else
{
throwResultException( result, "${constructorCall}" );
detail::throwResultException( result, "${constructorCall}" );
}
}
${leave})";
@ -8333,7 +9031,7 @@ ${enter} ${handleType}( ${constructorArguments} )
${resultVariable} = static_cast<VULKAN_HPP_NAMESPACE::Result>( getDispatcher()->${constructorCall}( ${callArguments} ) );
if ( ${failureCheck} )
{
throwResultException( ${result}, "${constructorCall}" );
detail::throwResultException( ${result}, "${constructorCall}" );
}
}
${leave})";
@ -10523,9 +11221,9 @@ std::string VulkanHppGenerator::generateThrowResultException() const
cases.pop_back(); // remove last newline
const std::string throwTemplate = R"(
namespace
namespace detail
{
[[noreturn]] void throwResultException( Result result, char const * message )
[[noreturn]] VULKAN_HPP_INLINE void throwResultException( Result result, char const * message )
{
switch ( result )
{
@ -13493,6 +14191,46 @@ void VulkanHppGenerator::readTypeBitmask( tinyxml2::XMLElement const * element,
}
}
VulkanHppGenerator::DefinesPartition VulkanHppGenerator::partitionDefines( std::map<std::string, DefineData> const & defines )
{
DefinesPartition partition{};
for ( auto const & define : defines )
{
// VK_DEFINE_HANDLE is macro magic that cannot be constexpr-ed
// Also filter out the VKSC_ macros, as although they are in the spec, they are not defined in any header.
if ( define.first.starts_with( "VK_" ) && ( define.first != "VK_DEFINE_HANDLE" ) )
{
if ( define.second.possibleCallee.empty() )
{
if ( define.second.possibleDefinition.empty() )
{
#if !defined( NDEBUG )
const std::set<std::string> ignoredDefines{ "VK_DEFINE_NON_DISPATCHABLE_HANDLE", "VK_NULL_HANDLE", "VK_USE_64_BIT_PTR_DEFINES" };
#endif
assert( ignoredDefines.find( define.first ) != ignoredDefines.end() );
}
else
{
if ( define.second.params.empty() )
{
partition.values.insert( define );
}
else
{
partition.callees.insert( define );
}
}
}
else
{
assert( !define.second.params.empty() && define.second.possibleDefinition.empty() );
partition.callers.insert( define );
}
}
}
return partition;
}
void VulkanHppGenerator::readTypeDefine( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes )
{
int line = element->GetLineNum();
@ -13583,9 +14321,13 @@ void VulkanHppGenerator::readTypeDefine( tinyxml2::XMLElement const * element, s
if ( api.empty() || ( api == m_api ) )
{
MacroVisitor definesVisitor{};
element->Accept( &definesVisitor );
auto const & [deprecatedReason, possibleCallee, params, possibleDefinition] = parseMacro( definesVisitor.macro );
checkForError( m_types.insert( { name, TypeData{ TypeCategory::Define, {}, line } } ).second, line, "define <" + name + "> already specified" );
assert( m_defines.find( name ) == m_defines.end() );
m_defines[name] = { deprecated, require, line };
m_defines[name] = { deprecated, require, line, deprecatedReason, possibleCallee, params, possibleDefinition };
}
}
@ -14616,6 +15358,60 @@ std::string trimStars( std::string const & input )
return result;
}
// function to take three or four-vector of strings containing a macro definition, and return
// a tuple with possibly the deprecation reason, possibly the called macro, the macro parameters, and possibly the definition
MacroData parseMacro( std::vector<std::string> const & completeMacro )
{
// #define macro definition
// #define macro( params ) definition
// #define macro1 macro2( params )
auto const paramsRegex = std::regex{ R"((\(.*?\)))" };
auto const commentRegex = std::regex{ R"(\s*//.*)" };
auto rawComment = completeMacro[0];
std::erase( rawComment, '/' );
auto const strippedComment = trim( stripPostfix( stripPrefix( rawComment, " DEPRECATED:" ), "#define " ) );
// macro with parameters and implementation
if ( completeMacro.size() == 3 )
{
auto const & paramsAndDefinitionAndTrailingComment = completeMacro[2];
if ( paramsAndDefinitionAndTrailingComment.find( '(' ) == std::string::npos )
{
// no opening parenthesis found => no parameters
return { strippedComment, {}, {}, std::regex_replace( paramsAndDefinitionAndTrailingComment, commentRegex, "" ) };
}
// match the first set of parentheses only
auto paramsMatch = std::smatch{};
std::regex_search( paramsAndDefinitionAndTrailingComment, paramsMatch, paramsRegex );
// remove the leading and trailing parentheses and tokenise the remaining string
auto params = tokenize( stripPrefix( stripPostfix( paramsMatch[1].str(), ")" ), "(" ), "," );
// replace the parameters with empty string, leaving behind the implementation and (possibly) a trailing comment
auto implementation = std::regex_replace( paramsAndDefinitionAndTrailingComment, paramsRegex, "", std::regex_constants::format_first_only );
implementation = implementation.substr( 0, implementation.find( "//" ) );
std::erase( implementation, '\\' );
implementation = trim( implementation );
return { strippedComment, {}, params, implementation };
}
if ( completeMacro.size() == 4 )
{
auto const & calledMacro = toCamelCase( stripPrefix( completeMacro[2], "VK_" ) );
auto const & argsAndTrailingComment = completeMacro[3];
auto argsMatch = std::smatch{};
std::regex_search( argsAndTrailingComment, argsMatch, paramsRegex );
auto args = tokenize( stripPrefix( stripPostfix( argsMatch[1].str(), ")" ), "(" ), "," );
return { strippedComment, calledMacro, args, {} };
}
return {};
}
void writeToFile( std::string const & str, std::string const & fileName )
{
std::ofstream ofs( fileName );
@ -14733,6 +15529,7 @@ int main( int argc, char ** argv )
generator.generateStaticAssertionsHppFile();
generator.generateStructsHppFile();
generator.generateToStringHppFile();
generator.generateCppModuleFile();
#if !defined( CLANG_FORMAT_EXECUTABLE )
std::cout << "VulkanHppGenerator: could not find clang-format. The generated files will not be formatted accordingly.\n";

View File

@ -89,6 +89,7 @@ public:
void generateStaticAssertionsHppFile() const;
void generateStructsHppFile() const;
void generateToStringHppFile() const;
void generateCppModuleFile() const;
void prepareRAIIHandles();
void prepareVulkanFuncs();
@ -189,9 +190,20 @@ private:
struct DefineData
{
bool deprecated = false;
std::string require = {};
int xmlLine = {};
bool deprecated = false;
std::string require = {};
int xmlLine = {};
std::string deprecationReason = {};
std::string possibleCallee = {};
std::vector<std::string> params = {};
std::string possibleDefinition = {};
};
struct DefinesPartition
{
std::map<std::string, DefineData> callees = {};
std::map<std::string, DefineData> callers = {};
std::map<std::string, DefineData> values = {};
};
struct EnumValueData
@ -401,6 +413,22 @@ private:
size_t strideParam = INVALID_INDEX;
};
struct MacroVisitor final : tinyxml2::XMLVisitor
{
// comments, then name, then parameters and definition together, because that's how they appear in the xml!
// guaranteed to be 3 elements long
std::vector<std::string> macro;
bool Visit( tinyxml2::XMLText const & text ) override
{
if ( auto const nodeText = text.Value(); nodeText != nullptr )
{
macro.emplace_back( nodeText );
}
return true;
}
};
private:
void addCommand( std::string const & name, CommandData & commandData );
void addCommandsToHandle( std::vector<RequireData> const & requireData );
@ -635,6 +663,17 @@ private:
std::vector<size_t> const & returnParamIndices,
bool raii ) const;
std::string generateConstexprString( std::string const & structName ) const;
std::string generateConstexprDefines() const;
std::string generateConstexprUsings() const;
std::string generateCppModuleHandleUsings() const;
std::string generateCppModuleStructUsings() const;
std::string generateCppModuleUniqueHandleUsings() const;
std::string generateCppModuleFuncsUsings() const;
std::string generateCppModuleEnumUsings() const;
std::string generateCppModuleFormatTraitsUsings() const;
std::string generateCppModuleExtensionInspectionUsings() const;
std::string generateCppModuleUsings() const;
std::string generateCppModuleRaiiUsings() const;
std::string generateDataDeclarations( CommandData const & commandData,
std::vector<size_t> const & returnParams,
std::map<size_t, VectorParamData> const & vectorParams,
@ -733,7 +772,7 @@ private:
bool vectorSizeCheck,
bool raii ) const;
std::string generateObjectDeleter( std::string const & commandName, CommandData const & commandData, size_t initialSkipCount, size_t returnParam ) const;
std::pair<std::string, std::string> generateProtection( std::string const & protect ) const;
std::pair<std::string, std::string> generateProtection( std::string const & protect, bool defined = true ) const;
std::string generateRAIICommandDefinitions() const;
std::string
generateRAIICommandDefinitions( std::vector<RequireData> const & requireData, std::set<std::string> & listedCommands, std::string const & title ) const;
@ -968,47 +1007,48 @@ private:
void readPlatforms( tinyxml2::XMLElement const * element );
void readRegistry( tinyxml2::XMLElement const * element );
std::string readRequireCommand( tinyxml2::XMLElement const * element, std::string const & requiredBy );
void readRequireEnum( tinyxml2::XMLElement const * element, std::string const & requiredBy, std::string const & platform, bool supported );
std::string readRequireType( tinyxml2::XMLElement const * element, std::string const & requiredBy );
void readSPIRVCapability( tinyxml2::XMLElement const * element );
void readSPIRVCapabilityEnable( tinyxml2::XMLElement const * element );
void readSPIRVCapabilities( tinyxml2::XMLElement const * element );
void readSPIRVExtension( tinyxml2::XMLElement const * element );
void readSPIRVExtensionEnable( tinyxml2::XMLElement const * element );
void readSPIRVExtensions( tinyxml2::XMLElement const * element );
void readStructMember( tinyxml2::XMLElement const * element, std::vector<MemberData> & members, bool isUnion );
void readSync( tinyxml2::XMLElement const * element );
void readSyncAccess( tinyxml2::XMLElement const * element,
std::map<std::string, EnumData>::const_iterator accessFlagBitsIt,
std::map<std::string, EnumData>::const_iterator accessFlagBits2It,
std::map<std::string, EnumData>::const_iterator stageFlagBits2It );
void readSyncAccessEquivalent( tinyxml2::XMLElement const * element, std::map<std::string, EnumData>::const_iterator accessFlagBits2It );
void readSyncAccessSupport( tinyxml2::XMLElement const * element, std::map<std::string, EnumData>::const_iterator stageFlagBits2It );
void readSyncPipeline( tinyxml2::XMLElement const * element );
void readSyncStage( tinyxml2::XMLElement const * element,
std::map<std::string, EnumData>::const_iterator stageFlagBitsIt,
std::map<std::string, EnumData>::const_iterator stageFlagBits2It );
void readSyncStageEquivalent( tinyxml2::XMLElement const * element, std::map<std::string, EnumData>::const_iterator stageFlagBits2It );
void readSyncStageSupport( tinyxml2::XMLElement const * element );
void readTag( tinyxml2::XMLElement const * element );
void readTags( tinyxml2::XMLElement const * element );
void readTypeBasetype( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
void readTypeBitmask( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
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 readTypeFuncpointer( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
void readTypeHandle( 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 readTypeStruct( tinyxml2::XMLElement const * element, bool isUnion, std::map<std::string, std::string> const & attributes );
void readTypes( tinyxml2::XMLElement const * element );
void readTypesType( tinyxml2::XMLElement const * element );
TypeInfo readTypeInfo( tinyxml2::XMLElement const * element ) const;
void registerDeleter( std::string const & commandName, CommandData const & commandData );
void rescheduleRAIIHandle( std::string & str,
std::pair<std::string, HandleData> const & handle,
std::set<std::string> & listedHandles,
std::set<std::string> const & specialFunctions ) const;
void readRequireEnum( tinyxml2::XMLElement const * element, std::string const & requiredBy, std::string const & platform, bool supported );
std::string readRequireType( tinyxml2::XMLElement const * element, std::string const & requiredBy );
void readSPIRVCapability( tinyxml2::XMLElement const * element );
void readSPIRVCapabilityEnable( tinyxml2::XMLElement const * element );
void readSPIRVCapabilities( tinyxml2::XMLElement const * element );
void readSPIRVExtension( tinyxml2::XMLElement const * element );
void readSPIRVExtensionEnable( tinyxml2::XMLElement const * element );
void readSPIRVExtensions( tinyxml2::XMLElement const * element );
void readStructMember( tinyxml2::XMLElement const * element, std::vector<MemberData> & members, bool isUnion );
void readSync( tinyxml2::XMLElement const * element );
void readSyncAccess( tinyxml2::XMLElement const * element,
std::map<std::string, EnumData>::const_iterator accessFlagBitsIt,
std::map<std::string, EnumData>::const_iterator accessFlagBits2It,
std::map<std::string, EnumData>::const_iterator stageFlagBits2It );
void readSyncAccessEquivalent( tinyxml2::XMLElement const * element, std::map<std::string, EnumData>::const_iterator accessFlagBits2It );
void readSyncAccessSupport( tinyxml2::XMLElement const * element, std::map<std::string, EnumData>::const_iterator stageFlagBits2It );
void readSyncPipeline( tinyxml2::XMLElement const * element );
void readSyncStage( tinyxml2::XMLElement const * element,
std::map<std::string, EnumData>::const_iterator stageFlagBitsIt,
std::map<std::string, EnumData>::const_iterator stageFlagBits2It );
void readSyncStageEquivalent( tinyxml2::XMLElement const * element, std::map<std::string, EnumData>::const_iterator stageFlagBits2It );
void readSyncStageSupport( tinyxml2::XMLElement const * element );
void readTag( tinyxml2::XMLElement const * element );
void readTags( tinyxml2::XMLElement const * element );
void readTypeBasetype( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
void readTypeBitmask( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
DefinesPartition partitionDefines( std::map<std::string, DefineData> const & defines );
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 readTypeFuncpointer( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
void readTypeHandle( 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 readTypeStruct( tinyxml2::XMLElement const * element, bool isUnion, std::map<std::string, std::string> const & attributes );
void readTypes( tinyxml2::XMLElement const * element );
void readTypesType( tinyxml2::XMLElement const * element );
TypeInfo readTypeInfo( tinyxml2::XMLElement const * element ) const;
void registerDeleter( std::string const & commandName, CommandData const & commandData );
void rescheduleRAIIHandle( std::string & str,
std::pair<std::string, HandleData> const & handle,
std::set<std::string> & listedHandles,
std::set<std::string> const & specialFunctions ) const;
std::vector<std::string> selectCommandsByHandle( std::vector<RequireData> const & requireData,
std::set<std::string> const & handleCommands,
std::set<std::string> & listedCommands ) const;
@ -1027,6 +1067,7 @@ private:
std::map<std::string, AliasData> m_constantAliases;
std::map<std::string, ConstantData> m_constants;
std::map<std::string, DefineData> m_defines;
DefinesPartition m_definesPartition; // partition defined macros into mutually-exclusive sets of callees, callers, and values
std::map<std::string, AliasData> m_enumAliases;
std::map<std::string, EnumData> m_enums;
std::set<std::string> m_extendedStructs; // structs which are referenced by the structextends tag

View File

@ -40,7 +40,7 @@
}
extern VULKAN_HPP_STORAGE_API DispatchLoaderDynamic defaultDispatchLoaderDynamic;
# else
static inline ::VULKAN_HPP_NAMESPACE::DispatchLoaderStatic & getDispatchLoaderStatic()
inline ::VULKAN_HPP_NAMESPACE::DispatchLoaderStatic & getDispatchLoaderStatic()
{
static ::VULKAN_HPP_NAMESPACE::DispatchLoaderStatic dls;
return dls;

View File

@ -7,7 +7,7 @@
#else
if ( result != Result::eSuccess )
{
throwResultException( result, message );
detail::throwResultException( result, message );
}
#endif
}
@ -22,7 +22,7 @@
#else
if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() )
{
throwResultException( result, message );
detail::throwResultException( result, message );
}
#endif
}

View File

@ -31,3 +31,6 @@ add_subdirectory( StridedArrayProxy )
add_subdirectory( StructureChain )
add_subdirectory( UniqueHandle )
add_subdirectory( UniqueHandleDefaultArguments )
if( VULKAN_HPP_ENABLE_EXPERIMENTAL_CPP20_MODULES )
add_subdirectory( Cpp20Modules )
endif()

View File

@ -0,0 +1,7 @@
cmake_minimum_required( VERSION 3.25 )
vulkan_hpp__setup_test( NAME Cpp20Modules CXX_STANDARD 20 LIBRARIES VulkanHppModule )
if( NOT ( VULKAN_HPP_SAMPLES_BUILD_ONLY_DYNAMIC AND VULKAN_HPP_SAMPLES_BUILD_WITH_LOCAL_VULKAN_HPP ) )
target_link_libraries( Cpp20Modules PRIVATE Vulkan::Vulkan )
endif()

View File

@ -0,0 +1,44 @@
import vulkan;
#include <iostream>
static std::string AppName = "01_InitInstance";
static std::string EngineName = "Vulkan.hpp";
int main( int /*argc*/, char ** /*argv*/ )
{
/* VULKAN_HPP_KEY_START */
try
{
// initialize the vk::ApplicationInfo structure
vk::ApplicationInfo applicationInfo( AppName.c_str(), 1, EngineName.c_str(), 1, vk::makeApiVersion( 1, 0, 0, 0 ) );
// initialize the vk::InstanceCreateInfo
vk::InstanceCreateInfo instanceCreateInfo( {}, &applicationInfo );
// create an Instance
vk::Instance instance = vk::createInstance( instanceCreateInfo );
// destroy it again
instance.destroy();
}
catch ( vk::SystemError & err )
{
std::cout << "vk::SystemError: " << err.what() << std::endl;
exit( -1 );
}
catch ( std::exception & err )
{
std::cout << "std::exception: " << err.what() << std::endl;
exit( -1 );
}
catch ( ... )
{
std::cout << "unknown error\n";
exit( -1 );
}
/* VULKAN_HPP_KEY_END */
return 0;
}

2926
vulkan/vulkan.cppm Normal file

File diff suppressed because it is too large Load Diff

View File

@ -6027,7 +6027,7 @@ namespace VULKAN_HPP_NAMESPACE
}
extern VULKAN_HPP_STORAGE_API DispatchLoaderDynamic defaultDispatchLoaderDynamic;
# else
static inline ::VULKAN_HPP_NAMESPACE::DispatchLoaderStatic & getDispatchLoaderStatic()
inline ::VULKAN_HPP_NAMESPACE::DispatchLoaderStatic & getDispatchLoaderStatic()
{
static ::VULKAN_HPP_NAMESPACE::DispatchLoaderStatic dls;
return dls;
@ -6688,9 +6688,9 @@ namespace VULKAN_HPP_NAMESPACE
IncompatibleShaderBinaryEXTError( char const * message ) : SystemError( make_error_code( Result::eErrorIncompatibleShaderBinaryEXT ), message ) {}
};
namespace
namespace detail
{
[[noreturn]] void throwResultException( Result result, char const * message )
[[noreturn]] VULKAN_HPP_INLINE void throwResultException( Result result, char const * message )
{
switch ( result )
{
@ -6736,7 +6736,7 @@ namespace VULKAN_HPP_NAMESPACE
default: throw SystemError( make_error_code( result ), message );
}
}
} // namespace
} // namespace detail
#endif
template <typename T>
@ -6896,7 +6896,7 @@ namespace VULKAN_HPP_NAMESPACE
#else
if ( result != Result::eSuccess )
{
throwResultException( result, message );
detail::throwResultException( result, message );
}
#endif
}
@ -6911,10 +6911,106 @@ namespace VULKAN_HPP_NAMESPACE
#else
if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() )
{
throwResultException( result, message );
detail::throwResultException( result, message );
}
#endif
}
//=========================================
//=== CONSTEXPR CONSTANTs AND FUNCTIONs ===
//=========================================
VULKAN_HPP_CONSTEXPR uint32_t AttachmentUnused = VK_ATTACHMENT_UNUSED;
VULKAN_HPP_CONSTEXPR uint32_t False = VK_FALSE;
VULKAN_HPP_CONSTEXPR float LodClampNone = VK_LOD_CLAMP_NONE;
VULKAN_HPP_CONSTEXPR uint32_t LuidSize = VK_LUID_SIZE;
VULKAN_HPP_CONSTEXPR uint32_t MaxDescriptionSize = VK_MAX_DESCRIPTION_SIZE;
VULKAN_HPP_CONSTEXPR uint32_t MaxDeviceGroupSize = VK_MAX_DEVICE_GROUP_SIZE;
VULKAN_HPP_CONSTEXPR uint32_t MaxDriverInfoSize = VK_MAX_DRIVER_INFO_SIZE;
VULKAN_HPP_CONSTEXPR uint32_t MaxDriverNameSize = VK_MAX_DRIVER_NAME_SIZE;
VULKAN_HPP_CONSTEXPR uint32_t MaxExtensionNameSize = VK_MAX_EXTENSION_NAME_SIZE;
VULKAN_HPP_CONSTEXPR uint32_t MaxGlobalPrioritySizeKhr = VK_MAX_GLOBAL_PRIORITY_SIZE_KHR;
VULKAN_HPP_CONSTEXPR uint32_t MaxMemoryHeaps = VK_MAX_MEMORY_HEAPS;
VULKAN_HPP_CONSTEXPR uint32_t MaxMemoryTypes = VK_MAX_MEMORY_TYPES;
VULKAN_HPP_CONSTEXPR uint32_t MaxPhysicalDeviceNameSize = VK_MAX_PHYSICAL_DEVICE_NAME_SIZE;
VULKAN_HPP_CONSTEXPR uint32_t MaxShaderModuleIdentifierSizeExt = VK_MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT;
VULKAN_HPP_CONSTEXPR uint32_t QueueFamilyExternal = VK_QUEUE_FAMILY_EXTERNAL;
VULKAN_HPP_CONSTEXPR uint32_t QueueFamilyForeignExt = VK_QUEUE_FAMILY_FOREIGN_EXT;
VULKAN_HPP_CONSTEXPR uint32_t QueueFamilyIgnored = VK_QUEUE_FAMILY_IGNORED;
VULKAN_HPP_CONSTEXPR uint32_t Remaining3DSlicesExt = VK_REMAINING_3D_SLICES_EXT;
VULKAN_HPP_CONSTEXPR uint32_t RemainingArrayLayers = VK_REMAINING_ARRAY_LAYERS;
VULKAN_HPP_CONSTEXPR uint32_t RemainingMipLevels = VK_REMAINING_MIP_LEVELS;
VULKAN_HPP_CONSTEXPR uint32_t ShaderUnusedKhr = VK_SHADER_UNUSED_KHR;
VULKAN_HPP_CONSTEXPR uint32_t SubpassExternal = VK_SUBPASS_EXTERNAL;
VULKAN_HPP_CONSTEXPR uint32_t True = VK_TRUE;
VULKAN_HPP_CONSTEXPR uint32_t UuidSize = VK_UUID_SIZE;
VULKAN_HPP_CONSTEXPR uint64_t WholeSize = VK_WHOLE_SIZE;
VULKAN_HPP_CONSTEXPR uint32_t HeaderVersion = VK_HEADER_VERSION;
template <typename T, typename = typename std::enable_if<std::is_integral<T>::value>::type>
VULKAN_HPP_CONSTEXPR uint32_t apiVersionMajor( T const version )
{
return ( ( (uint32_t)( version ) >> 22U ) & 0x7FU );
}
template <typename T, typename = typename std::enable_if<std::is_integral<T>::value>::type>
VULKAN_HPP_CONSTEXPR uint32_t apiVersionMinor( T const version )
{
return ( ( (uint32_t)( version ) >> 12U ) & 0x3FFU );
}
template <typename T, typename = typename std::enable_if<std::is_integral<T>::value>::type>
VULKAN_HPP_CONSTEXPR uint32_t apiVersionPatch( T const version )
{
return ( (uint32_t)(version)&0xFFFU );
}
template <typename T, typename = typename std::enable_if<std::is_integral<T>::value>::type>
VULKAN_HPP_CONSTEXPR uint32_t apiVersionVariant( T const version )
{
return ( (uint32_t)( version ) >> 29U );
}
template <typename T, typename = typename std::enable_if<std::is_integral<T>::value>::type>
VULKAN_HPP_CONSTEXPR uint32_t makeApiVersion( T const variant, T const major, T const minor, T const patch )
{
return ( ( ( (uint32_t)( variant ) ) << 29U ) | ( ( (uint32_t)( major ) ) << 22U ) | ( ( (uint32_t)( minor ) ) << 12U ) | ( (uint32_t)( patch ) ) );
}
template <typename T, typename = typename std::enable_if<std::is_integral<T>::value>::type>
VULKAN_HPP_DEPRECATED( "This define is deprecated. VK_MAKE_API_VERSION should be used instead." )
VULKAN_HPP_CONSTEXPR uint32_t makeVersion( T const major, T const minor, T const patch )
{
return ( ( ( (uint32_t)( major ) ) << 22U ) | ( ( (uint32_t)( minor ) ) << 12U ) | ( (uint32_t)( patch ) ) );
}
template <typename T, typename = typename std::enable_if<std::is_integral<T>::value>::type>
VULKAN_HPP_DEPRECATED( "This define is deprecated. VK_API_VERSION_MAJOR should be used instead." )
VULKAN_HPP_CONSTEXPR uint32_t versionMajor( T const version )
{
return ( (uint32_t)( version ) >> 22U );
}
template <typename T, typename = typename std::enable_if<std::is_integral<T>::value>::type>
VULKAN_HPP_DEPRECATED( "This define is deprecated. VK_API_VERSION_MINOR should be used instead." )
VULKAN_HPP_CONSTEXPR uint32_t versionMinor( T const version )
{
return ( ( (uint32_t)( version ) >> 12U ) & 0x3FFU );
}
template <typename T, typename = typename std::enable_if<std::is_integral<T>::value>::type>
VULKAN_HPP_DEPRECATED( "This define is deprecated. VK_API_VERSION_PATCH should be used instead." )
VULKAN_HPP_CONSTEXPR uint32_t versionPatch( T const version )
{
return ( (uint32_t)(version)&0xFFFU );
}
VULKAN_HPP_CONSTEXPR auto ApiVersion = makeApiVersion( 0, 1, 0, 0 );
VULKAN_HPP_CONSTEXPR auto ApiVersion10 = makeApiVersion( 0, 1, 0, 0 );
VULKAN_HPP_CONSTEXPR auto ApiVersion11 = makeApiVersion( 0, 1, 1, 0 );
VULKAN_HPP_CONSTEXPR auto ApiVersion12 = makeApiVersion( 0, 1, 2, 0 );
VULKAN_HPP_CONSTEXPR auto ApiVersion13 = makeApiVersion( 0, 1, 3, 0 );
VULKAN_HPP_CONSTEXPR auto HeaderVersionComplete = makeApiVersion( 0, 1, 3, VK_HEADER_VERSION );
} // namespace VULKAN_HPP_NAMESPACE
// clang-format off

View File

@ -2645,7 +2645,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkInstance *>( &m_instance ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateInstance" );
detail::throwResultException( result, "vkCreateInstance" );
}
m_dispatcher.reset( new VULKAN_HPP_NAMESPACE::VULKAN_HPP_RAII_NAMESPACE::InstanceDispatcher( context.getDispatcher()->vkGetInstanceProcAddr,
static_cast<VkInstance>( m_instance ) ) );
@ -3336,7 +3336,7 @@ namespace VULKAN_HPP_NAMESPACE
}
else
{
throwResultException( result, "vkEnumeratePhysicalDevices" );
detail::throwResultException( result, "vkEnumeratePhysicalDevices" );
}
}
@ -3371,7 +3371,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkDevice *>( &m_device ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateDevice" );
detail::throwResultException( result, "vkCreateDevice" );
}
m_dispatcher.reset( new VULKAN_HPP_NAMESPACE::VULKAN_HPP_RAII_NAMESPACE::DeviceDispatcher( physicalDevice.getDispatcher()->vkGetDeviceProcAddr,
static_cast<VkDevice>( m_device ) ) );
@ -4287,7 +4287,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkAccelerationStructureKHR *>( &m_accelerationStructure ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateAccelerationStructureKHR" );
detail::throwResultException( result, "vkCreateAccelerationStructureKHR" );
}
}
@ -4411,7 +4411,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkAccelerationStructureNV *>( &m_accelerationStructure ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateAccelerationStructureNV" );
detail::throwResultException( result, "vkCreateAccelerationStructureNV" );
}
}
@ -4543,7 +4543,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkBuffer *>( &m_buffer ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateBuffer" );
detail::throwResultException( result, "vkCreateBuffer" );
}
}
@ -4673,7 +4673,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkBufferCollectionFUCHSIA *>( &m_collection ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateBufferCollectionFUCHSIA" );
detail::throwResultException( result, "vkCreateBufferCollectionFUCHSIA" );
}
}
@ -4806,7 +4806,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkBufferView *>( &m_bufferView ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateBufferView" );
detail::throwResultException( result, "vkCreateBufferView" );
}
}
@ -4929,7 +4929,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkCommandPool *>( &m_commandPool ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateCommandPool" );
detail::throwResultException( result, "vkCreateCommandPool" );
}
}
@ -6041,7 +6041,7 @@ namespace VULKAN_HPP_NAMESPACE
}
else
{
throwResultException( result, "vkAllocateCommandBuffers" );
detail::throwResultException( result, "vkAllocateCommandBuffers" );
}
}
@ -6078,7 +6078,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkCuFunctionNVX *>( &m_function ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateCuFunctionNVX" );
detail::throwResultException( result, "vkCreateCuFunctionNVX" );
}
}
@ -6201,7 +6201,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkCuModuleNVX *>( &m_module ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateCuModuleNVX" );
detail::throwResultException( result, "vkCreateCuModuleNVX" );
}
}
@ -6324,7 +6324,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkDebugReportCallbackEXT *>( &m_callback ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateDebugReportCallbackEXT" );
detail::throwResultException( result, "vkCreateDebugReportCallbackEXT" );
}
}
@ -6448,7 +6448,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkDebugUtilsMessengerEXT *>( &m_messenger ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateDebugUtilsMessengerEXT" );
detail::throwResultException( result, "vkCreateDebugUtilsMessengerEXT" );
}
}
@ -6570,7 +6570,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkDeferredOperationKHR *>( &m_operation ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateDeferredOperationKHR" );
detail::throwResultException( result, "vkCreateDeferredOperationKHR" );
}
}
@ -6702,7 +6702,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkDescriptorPool *>( &m_descriptorPool ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateDescriptorPool" );
detail::throwResultException( result, "vkCreateDescriptorPool" );
}
}
@ -6942,7 +6942,7 @@ namespace VULKAN_HPP_NAMESPACE
}
else
{
throwResultException( result, "vkAllocateDescriptorSets" );
detail::throwResultException( result, "vkAllocateDescriptorSets" );
}
}
@ -6979,7 +6979,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkDescriptorSetLayout *>( &m_descriptorSetLayout ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateDescriptorSetLayout" );
detail::throwResultException( result, "vkCreateDescriptorSetLayout" );
}
}
@ -7109,7 +7109,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkDescriptorUpdateTemplate *>( &m_descriptorUpdateTemplate ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateDescriptorUpdateTemplate" );
detail::throwResultException( result, "vkCreateDescriptorUpdateTemplate" );
}
}
@ -7233,7 +7233,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkDeviceMemory *>( &m_memory ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkAllocateMemory" );
detail::throwResultException( result, "vkAllocateMemory" );
}
}
@ -7369,7 +7369,7 @@ namespace VULKAN_HPP_NAMESPACE
static_cast<VkPhysicalDevice>( *physicalDevice ), drmFd, connectorId, reinterpret_cast<VkDisplayKHR *>( &m_display ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkGetDrmDisplayEXT" );
detail::throwResultException( result, "vkGetDrmDisplayEXT" );
}
}
@ -7381,7 +7381,7 @@ namespace VULKAN_HPP_NAMESPACE
static_cast<VkPhysicalDevice>( *physicalDevice ), &dpy, rrOutput, reinterpret_cast<VkDisplayKHR *>( &m_display ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkGetRandROutputDisplayEXT" );
detail::throwResultException( result, "vkGetRandROutputDisplayEXT" );
}
}
# endif /*VK_USE_PLATFORM_XLIB_XRANDR_EXT*/
@ -7394,7 +7394,7 @@ namespace VULKAN_HPP_NAMESPACE
static_cast<VkPhysicalDevice>( *physicalDevice ), deviceRelativeId, reinterpret_cast<VkDisplayKHR *>( &m_display ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkGetWinrtDisplayNV" );
detail::throwResultException( result, "vkGetWinrtDisplayNV" );
}
}
# endif /*VK_USE_PLATFORM_WIN32_KHR*/
@ -7531,7 +7531,7 @@ namespace VULKAN_HPP_NAMESPACE
}
else
{
throwResultException( result, "vkGetDisplayPlaneSupportedDisplaysKHR" );
detail::throwResultException( result, "vkGetDisplayPlaneSupportedDisplaysKHR" );
}
}
@ -7567,7 +7567,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkDisplayModeKHR *>( &m_displayModeKHR ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateDisplayModeKHR" );
detail::throwResultException( result, "vkCreateDisplayModeKHR" );
}
}
@ -7678,7 +7678,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkEvent *>( &m_event ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateEvent" );
detail::throwResultException( result, "vkCreateEvent" );
}
}
@ -7809,7 +7809,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkFence *>( &m_fence ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateFence" );
detail::throwResultException( result, "vkCreateFence" );
}
}
@ -7827,7 +7827,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkFence *>( &m_fence ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkRegisterDeviceEventEXT" );
detail::throwResultException( result, "vkRegisterDeviceEventEXT" );
}
}
@ -7847,7 +7847,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkFence *>( &m_fence ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkRegisterDisplayEventEXT" );
detail::throwResultException( result, "vkRegisterDisplayEventEXT" );
}
}
@ -7974,7 +7974,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkFramebuffer *>( &m_framebuffer ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateFramebuffer" );
detail::throwResultException( result, "vkCreateFramebuffer" );
}
}
@ -8101,7 +8101,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkImage *>( &m_image ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateImage" );
detail::throwResultException( result, "vkCreateImage" );
}
}
@ -8248,7 +8248,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkImageView *>( &m_imageView ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateImageView" );
detail::throwResultException( result, "vkCreateImageView" );
}
}
@ -8375,7 +8375,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkIndirectCommandsLayoutNV *>( &m_indirectCommandsLayout ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateIndirectCommandsLayoutNV" );
detail::throwResultException( result, "vkCreateIndirectCommandsLayoutNV" );
}
}
@ -8499,7 +8499,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkMicromapEXT *>( &m_micromap ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateMicromapEXT" );
detail::throwResultException( result, "vkCreateMicromapEXT" );
}
}
@ -8622,7 +8622,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkOpticalFlowSessionNV *>( &m_session ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateOpticalFlowSessionNV" );
detail::throwResultException( result, "vkCreateOpticalFlowSessionNV" );
}
}
@ -8748,7 +8748,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkPerformanceConfigurationINTEL *>( &m_configuration ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkAcquirePerformanceConfigurationINTEL" );
detail::throwResultException( result, "vkAcquirePerformanceConfigurationINTEL" );
}
}
@ -8860,7 +8860,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkPipelineCache *>( &m_pipelineCache ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreatePipelineCache" );
detail::throwResultException( result, "vkCreatePipelineCache" );
}
}
@ -8994,7 +8994,7 @@ namespace VULKAN_HPP_NAMESPACE
if ( ( m_constructorSuccessCode != VULKAN_HPP_NAMESPACE::Result::eSuccess ) &&
( m_constructorSuccessCode != VULKAN_HPP_NAMESPACE::Result::ePipelineCompileRequiredEXT ) )
{
throwResultException( m_constructorSuccessCode, "vkCreateComputePipelines" );
detail::throwResultException( m_constructorSuccessCode, "vkCreateComputePipelines" );
}
}
@ -9016,7 +9016,7 @@ namespace VULKAN_HPP_NAMESPACE
if ( ( m_constructorSuccessCode != VULKAN_HPP_NAMESPACE::Result::eSuccess ) &&
( m_constructorSuccessCode != VULKAN_HPP_NAMESPACE::Result::ePipelineCompileRequiredEXT ) )
{
throwResultException( m_constructorSuccessCode, "vkCreateGraphicsPipelines" );
detail::throwResultException( m_constructorSuccessCode, "vkCreateGraphicsPipelines" );
}
}
@ -9042,7 +9042,7 @@ namespace VULKAN_HPP_NAMESPACE
( m_constructorSuccessCode != VULKAN_HPP_NAMESPACE::Result::eOperationNotDeferredKHR ) &&
( m_constructorSuccessCode != VULKAN_HPP_NAMESPACE::Result::ePipelineCompileRequiredEXT ) )
{
throwResultException( m_constructorSuccessCode, "vkCreateRayTracingPipelinesKHR" );
detail::throwResultException( m_constructorSuccessCode, "vkCreateRayTracingPipelinesKHR" );
}
}
@ -9064,7 +9064,7 @@ namespace VULKAN_HPP_NAMESPACE
if ( ( m_constructorSuccessCode != VULKAN_HPP_NAMESPACE::Result::eSuccess ) &&
( m_constructorSuccessCode != VULKAN_HPP_NAMESPACE::Result::ePipelineCompileRequiredEXT ) )
{
throwResultException( m_constructorSuccessCode, "vkCreateRayTracingPipelinesNV" );
detail::throwResultException( m_constructorSuccessCode, "vkCreateRayTracingPipelinesNV" );
}
}
@ -9236,7 +9236,7 @@ namespace VULKAN_HPP_NAMESPACE
}
else
{
throwResultException( result, "vkCreateComputePipelines" );
detail::throwResultException( result, "vkCreateComputePipelines" );
}
}
@ -9264,7 +9264,7 @@ namespace VULKAN_HPP_NAMESPACE
}
else
{
throwResultException( result, "vkCreateGraphicsPipelines" );
detail::throwResultException( result, "vkCreateGraphicsPipelines" );
}
}
@ -9295,7 +9295,7 @@ namespace VULKAN_HPP_NAMESPACE
}
else
{
throwResultException( result, "vkCreateRayTracingPipelinesKHR" );
detail::throwResultException( result, "vkCreateRayTracingPipelinesKHR" );
}
}
@ -9323,7 +9323,7 @@ namespace VULKAN_HPP_NAMESPACE
}
else
{
throwResultException( result, "vkCreateRayTracingPipelinesNV" );
detail::throwResultException( result, "vkCreateRayTracingPipelinesNV" );
}
}
@ -9360,7 +9360,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkPipelineLayout *>( &m_pipelineLayout ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreatePipelineLayout" );
detail::throwResultException( result, "vkCreatePipelineLayout" );
}
}
@ -9484,7 +9484,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkPrivateDataSlot *>( &m_privateDataSlot ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreatePrivateDataSlot" );
detail::throwResultException( result, "vkCreatePrivateDataSlot" );
}
}
@ -9608,7 +9608,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkQueryPool *>( &m_queryPool ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateQueryPool" );
detail::throwResultException( result, "vkCreateQueryPool" );
}
}
@ -9893,7 +9893,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkRenderPass *>( &m_renderPass ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateRenderPass" );
detail::throwResultException( result, "vkCreateRenderPass" );
}
}
@ -9911,7 +9911,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkRenderPass *>( &m_renderPass ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateRenderPass2" );
detail::throwResultException( result, "vkCreateRenderPass2" );
}
}
@ -10042,7 +10042,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkSampler *>( &m_sampler ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateSampler" );
detail::throwResultException( result, "vkCreateSampler" );
}
}
@ -10165,7 +10165,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkSamplerYcbcrConversion *>( &m_ycbcrConversion ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateSamplerYcbcrConversion" );
detail::throwResultException( result, "vkCreateSamplerYcbcrConversion" );
}
}
@ -10289,7 +10289,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkSemaphore *>( &m_semaphore ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateSemaphore" );
detail::throwResultException( result, "vkCreateSemaphore" );
}
}
@ -10421,7 +10421,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkShaderEXT *>( &m_shader ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateShadersEXT" );
detail::throwResultException( result, "vkCreateShadersEXT" );
}
}
@ -10549,7 +10549,7 @@ namespace VULKAN_HPP_NAMESPACE
}
else
{
throwResultException( result, "vkCreateShadersEXT" );
detail::throwResultException( result, "vkCreateShadersEXT" );
}
}
@ -10586,7 +10586,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkShaderModule *>( &m_shaderModule ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateShaderModule" );
detail::throwResultException( result, "vkCreateShaderModule" );
}
}
@ -10714,7 +10714,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkSurfaceKHR *>( &m_surface ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateAndroidSurfaceKHR" );
detail::throwResultException( result, "vkCreateAndroidSurfaceKHR" );
}
}
# endif /*VK_USE_PLATFORM_ANDROID_KHR*/
@ -10734,7 +10734,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkSurfaceKHR *>( &m_surface ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateDirectFBSurfaceEXT" );
detail::throwResultException( result, "vkCreateDirectFBSurfaceEXT" );
}
}
# endif /*VK_USE_PLATFORM_DIRECTFB_EXT*/
@ -10753,7 +10753,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkSurfaceKHR *>( &m_surface ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateDisplayPlaneSurfaceKHR" );
detail::throwResultException( result, "vkCreateDisplayPlaneSurfaceKHR" );
}
}
@ -10771,7 +10771,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkSurfaceKHR *>( &m_surface ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateHeadlessSurfaceEXT" );
detail::throwResultException( result, "vkCreateHeadlessSurfaceEXT" );
}
}
@ -10790,7 +10790,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkSurfaceKHR *>( &m_surface ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateIOSSurfaceMVK" );
detail::throwResultException( result, "vkCreateIOSSurfaceMVK" );
}
}
# endif /*VK_USE_PLATFORM_IOS_MVK*/
@ -10810,7 +10810,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkSurfaceKHR *>( &m_surface ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateImagePipeSurfaceFUCHSIA" );
detail::throwResultException( result, "vkCreateImagePipeSurfaceFUCHSIA" );
}
}
# endif /*VK_USE_PLATFORM_FUCHSIA*/
@ -10830,7 +10830,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkSurfaceKHR *>( &m_surface ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateMacOSSurfaceMVK" );
detail::throwResultException( result, "vkCreateMacOSSurfaceMVK" );
}
}
# endif /*VK_USE_PLATFORM_MACOS_MVK*/
@ -10850,7 +10850,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkSurfaceKHR *>( &m_surface ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateMetalSurfaceEXT" );
detail::throwResultException( result, "vkCreateMetalSurfaceEXT" );
}
}
# endif /*VK_USE_PLATFORM_METAL_EXT*/
@ -10870,7 +10870,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkSurfaceKHR *>( &m_surface ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateScreenSurfaceQNX" );
detail::throwResultException( result, "vkCreateScreenSurfaceQNX" );
}
}
# endif /*VK_USE_PLATFORM_SCREEN_QNX*/
@ -10890,7 +10890,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkSurfaceKHR *>( &m_surface ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateStreamDescriptorSurfaceGGP" );
detail::throwResultException( result, "vkCreateStreamDescriptorSurfaceGGP" );
}
}
# endif /*VK_USE_PLATFORM_GGP*/
@ -10910,7 +10910,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkSurfaceKHR *>( &m_surface ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateViSurfaceNN" );
detail::throwResultException( result, "vkCreateViSurfaceNN" );
}
}
# endif /*VK_USE_PLATFORM_VI_NN*/
@ -10930,7 +10930,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkSurfaceKHR *>( &m_surface ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateWaylandSurfaceKHR" );
detail::throwResultException( result, "vkCreateWaylandSurfaceKHR" );
}
}
# endif /*VK_USE_PLATFORM_WAYLAND_KHR*/
@ -10950,7 +10950,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkSurfaceKHR *>( &m_surface ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateWin32SurfaceKHR" );
detail::throwResultException( result, "vkCreateWin32SurfaceKHR" );
}
}
# endif /*VK_USE_PLATFORM_WIN32_KHR*/
@ -10970,7 +10970,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkSurfaceKHR *>( &m_surface ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateXcbSurfaceKHR" );
detail::throwResultException( result, "vkCreateXcbSurfaceKHR" );
}
}
# endif /*VK_USE_PLATFORM_XCB_KHR*/
@ -10990,7 +10990,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkSurfaceKHR *>( &m_surface ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateXlibSurfaceKHR" );
detail::throwResultException( result, "vkCreateXlibSurfaceKHR" );
}
}
# endif /*VK_USE_PLATFORM_XLIB_KHR*/
@ -11114,7 +11114,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkSwapchainKHR *>( &m_swapchain ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateSwapchainKHR" );
detail::throwResultException( result, "vkCreateSwapchainKHR" );
}
}
@ -11277,7 +11277,7 @@ namespace VULKAN_HPP_NAMESPACE
}
else
{
throwResultException( result, "vkCreateSharedSwapchainsKHR" );
detail::throwResultException( result, "vkCreateSharedSwapchainsKHR" );
}
}
@ -11314,7 +11314,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkValidationCacheEXT *>( &m_validationCache ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateValidationCacheEXT" );
detail::throwResultException( result, "vkCreateValidationCacheEXT" );
}
}
@ -11444,7 +11444,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkVideoSessionKHR *>( &m_videoSession ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateVideoSessionKHR" );
detail::throwResultException( result, "vkCreateVideoSessionKHR" );
}
}
@ -11574,7 +11574,7 @@ namespace VULKAN_HPP_NAMESPACE
reinterpret_cast<VkVideoSessionParametersKHR *>( &m_videoSessionParameters ) ) );
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
throwResultException( result, "vkCreateVideoSessionParametersKHR" );
detail::throwResultException( result, "vkCreateVideoSessionParametersKHR" );
}
}