Make C++20 modules work with the defaultDispatchLoaderDynamic. (#1651)

* Make C++20 modules work with the defaultDispatchLoaderDynamic.

* Add vulkan_hpp_macros.hpp to list of installed files.

* Adjust the text on module in the readme.

* Rename module from vulkan to vulkan_hpp

* Adjust some comments.

* Add a little disclaimer to vulkan.cppm.
This commit is contained in:
Andreas Süßenbach 2023-09-07 15:20:10 +02:00 committed by GitHub
parent a2e240c7e7
commit d4704cce01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 1084 additions and 834 deletions

View File

@ -31,7 +31,7 @@ if( VULKAN_HPP_ENABLE_EXPERIMENTAL_CPP20_MODULES )
" To add support inform yourself about the state of the feature at https://github.com/Kitware/CMake/blob/master/Help/dev/experimental.rst"
" and add the corresponding value of CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API to Vulkan-Hpp's CMakeLists.txt")
elseif ( ${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.27 )
# CMake 3.27/3.27.1
# CMake 3.27
set( CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API aa1f7df0-828a-4fcd-9afc-2dc80491aca7 )
elseif ( ${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.26 )
# CMake 3.26
@ -243,7 +243,7 @@ function( vulkan_hpp__setup_sample_raii )
endfunction()
function( vulkan_hpp__setup_test )
set( options )
set( options NO_UTILS )
set( oneValueArgs CXX_STANDARD NAME )
set( multiValueArgs LIBRARIES )
cmake_parse_arguments( TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
@ -270,7 +270,10 @@ function( vulkan_hpp__setup_test )
set_target_properties( ${TARGET_NAME} PROPERTIES CXX_STANDARD ${TARGET_CXX_STANDARD} CXX_STANDARD_REQUIRED ON FOLDER "Tests" )
target_include_directories( ${TARGET_NAME} PUBLIC ${VulkanHeaders_INCLUDE_DIR} )
target_include_directories( ${TARGET_NAME} PUBLIC "${CMAKE_SOURCE_DIR}/glm" )
target_link_libraries( ${TARGET_NAME} PRIVATE utils ${TARGET_LIBRARIES} )
if ( NOT ${TARGET_NO_UTILS} )
target_link_libraries( ${TARGET_NAME} PRIVATE utils )
endif()
target_link_libraries( ${TARGET_NAME} PRIVATE ${TARGET_LIBRARIES} )
endfunction()
set_property( GLOBAL PROPERTY USE_FOLDERS ON )
@ -322,6 +325,7 @@ option( VULKAN_HPP_SAMPLES_BUILD_ONLY_DYNAMIC "Build only dynamic. Required in c
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 )
option( VULKAN_HPP_CPP20_MODULE_DYNAMIC_DISPATCHER "Build C++20 module with dynamic Dispatcher" ON )
# look for the file vk.xml, the ultimate source of truth for vulkan, to generate the headers from
if( NOT DEFINED VulkanRegistry_DIR )
@ -349,6 +353,11 @@ if( VULKAN_HPP_ENABLE_EXPERIMENTAL_CPP20_MODULES )
set_target_properties( VulkanHppModule PROPERTIES
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF )
if ( VULKAN_HPP_CPP20_MODULE_DYNAMIC_DISPATCHER )
target_compile_definitions( VulkanHppModule PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1 )
else()
target_compile_definitions( VulkanHppModule PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=0 )
endif()
target_compile_features( VulkanHppModule PUBLIC cxx_std_20 )
target_sources( VulkanHppModule
PUBLIC
@ -429,6 +438,7 @@ if( ${VULKAN_HPP_INSTALL} )
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_funcs.hpp
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_handles.hpp
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_hash.hpp
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_hpp_macros.hpp
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan.hpp
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_raii.hpp
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_static_assertions.hpp

View File

@ -479,16 +479,24 @@ vk::DispatchLoaderDynamic dldid( instance, getInstanceProcAddr, device );
device.getQueue(graphics_queue_family_index, 0, &graphics_queue, dldid);
```
To use the ```DispatchLoaderDynamic``` as the default dispatcher (means: you don't need to explicitly add it to every function call), you need to ```#define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 1```, and have the macro ```VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE``` exactly once in your source code to provide storage for that default dispatcher. Then you can use it by the macro ```VULKAN_HPP_DEFAULT_DISPATCHER```, as is shown in the code snippets below.
To ease creating such a ```DispatchLoaderDynamic```, there is a little helper class ```DynamicLoader```.
Creating a full featured ```DispatchLoaderDynamic``` is a two- to three-step process:
1. initialize it with a function pointer of type PFN_vkGetInstanceProcAddr, to get the instance independent function pointers:
To use the `vk::DispatchLoaderDynamic` as the default dispatcher (means: you don't need to explicitly add it to every function call), you need to ```#define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 1```, and have the macro ```VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE``` exactly once in your source code to provide storage for that default dispatcher. Then you can use it by the macro `VULKAN_HPP_DEFAULT_DISPATCHER`, as is shown in the code snippets below.
Creating a full featured `vk::DispatchLoaderDynamic` is a two- to three-step process, where you have three choices for the first step:
1. Before any call into a vk-function you need to initialize the dynamic dispatcher by one of three methods
- Let Vulkan-Hpp do all the work by internally using a little helper class `vk::DynamicLoader`:
```c++
vk::DynamicLoader dl;
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = dl.getProcAddress<PFN_vkGetInstanceProcAddr>("vkGetInstanceProcAddr");
VULKAN_HPP_DEFAULT_DISPATCHER.init();
```
- Use your own dynamic loader, which just needs to provide a templated function `getProcAddress` (compare with `vk::DynamicLoader` in vulkan.hpp):
```c++
YourDynamicLoader ydl;
VULKAN_HPP_DEFAULT_DISPATCHER.init(ydl);
```
Note that you need to keep that dynamic loader object alive until after the last call to a vulkan function in your program. For example by making it static, or storing it somewhere globally.
- Use your own initial function pointer of type PFN_vkGetInstanceProcAddr:
```c++
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = your_own_function_pointer_getter();
VULKAN_HPP_DEFAULT_DISPATCHER.init(vkGetInstanceProcAddr);
```
- Note that you need to keep that vk::DynamicLoader alive until after the last call to a vulkan function in your program. For example by making it static, or storing it somewhere globally.
2. initialize it with a vk::Instance to get all the other function pointers:
```c++
vk::Instance instance = vk::createInstance({}, nullptr);
@ -501,7 +509,7 @@ Creating a full featured ```DispatchLoaderDynamic``` is a two- to three-step pro
vk::Device device = physicalDevices[0].createDevice({}, nullptr);
VULKAN_HPP_DEFAULT_DISPATCHER.init(device);
```
After the second step above, the dispatcher is fully functional. Adding the third step can potentially result in more efficient code.
After the second step above, the dispatcher is fully functional. Adding the third step can potentially result in more efficient code. But if you intend to use multiple devices, you could just omit that third step and let the driver do the device-dispatching.
In some cases the storage for the DispatchLoaderDynamic should be embedded in a DLL. For those cases you need to define ```VULKAN_HPP_STORAGE_SHARED``` to tell Vulkan-Hpp that the storage resides in a DLL. When compiling the DLL with the storage it is also required to define ```VULKAN_HPP_STORAGE_SHARED_EXPORT``` to export the required symbols.
@ -640,9 +648,15 @@ To use CMake with C++ modules, you must first enable its experimental support, s
```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
if ( ${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.28 )
message(FATAL_ERROR "VULKAN_HPP_ENABLE_EXPERIMENTAL_CPP20_MODULES is currently not supported for CMake version ${CMAKE_VERSION}!"
" To add support inform yourself about the state of the feature at https://github.com/Kitware/CMake/blob/master/Help/dev/experimental.rst"
" and add the corresponding value of CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API to Vulkan-Hpp's CMakeLists.txt")
elseif ( ${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.27 )
# CMake 3.27
set( CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API aa1f7df0-828a-4fcd-9afc-2dc80491aca7 )
elseif ( ${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.26 )
# CMake 3.26
set( CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API 2182bf5c-ef0d-489a-91da-49dbc3090d2a )
else()
# CMake 3.25
@ -667,22 +681,34 @@ 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`.
It is important here, that you need to have `VULKAN_HPP_DISPATCH_LOADER_DYNAMIC` defined equally for both, the module and your importing project. If you want to use the dynamic dispatcher, set it to `1`, otherwise to `0`.
If you're using the dynamic dispatcher, you need to have the macro `VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE` exactly once in your source code, just as in the non-module case. In order to have that macro available, you need to include `<vulkan/vulkan_hpp_macros.hpp>`, a lightweight header providing all the Vulkan-Hpp related macros and defines. And as explained above, you need to initialize that dispatcher in two or three steps:
```cpp
import vulkan;
import vulkan_hpp;
#include <vulkan/vulkan_hpp_macros.hpp>
#if VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE
#endif
auto main(int argc, char* const argv[]) -> int
{
#if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 )
// initialize minimal set of function pointers
VULKAN_HPP_DEFAULT_DISPATCHER.init();
#endif
auto appInfo = vk::ApplicationInfo( "My App", 1, "My Engine", 1, vk::makeApiVersion( 1, 0, 0, 0 ) );
// ...
}
```
An example is provided in [`tests/Cpp20Modules/Cpp20Modules.cpp`](tests/Cpp20Modules/Cpp20Modules.cpp).
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

View File

@ -448,14 +448,6 @@ ${includes}
static_assert( VK_HEADER_VERSION == ${headerVersion}, "Wrong VK_HEADER_VERSION!" );
// 32-bit vulkan is not typesafe for non-dispatchable handles, so don't allow copy constructors on this platform by default.
// To enable this feature on 32-bit platforms please define VULKAN_HPP_TYPESAFE_CONVERSION
${typesafeCheck}
# if !defined( VULKAN_HPP_TYPESAFE_CONVERSION )
# define VULKAN_HPP_TYPESAFE_CONVERSION
# endif
#endif
${defines}
namespace VULKAN_HPP_NAMESPACE
@ -474,7 +466,6 @@ ${UniqueHandle}
${DispatchLoaderBase}
${DispatchLoaderStatic}
${DispatchLoaderDefault}
#if !defined( VULKAN_HPP_NO_SMART_HANDLE )
${ObjectDestroy}
${ObjectFree}
@ -529,8 +520,8 @@ ${DispatchLoaderDynamic}
#endif
)";
std::string str =
replaceWithMap( vulkanHppTemplate,
std::string str = replaceWithMap(
vulkanHppTemplate,
{ { "api", m_api },
{ "ArrayProxy", readSnippet( "ArrayProxy.hpp" ) },
{ "ArrayProxyNoTemporaries", readSnippet( "ArrayProxyNoTemporaries.hpp" ) },
@ -540,16 +531,13 @@ ${DispatchLoaderDynamic}
{ "constexprDefines", generateConstexprDefines() },
{ "defines", readSnippet( "defines.hpp" ) },
{ "DispatchLoaderBase", readSnippet( "DispatchLoaderBase.hpp" ) },
{ "DispatchLoaderDefault", readSnippet( "DispatchLoaderDefault.hpp" ) },
{ "DispatchLoaderDynamic", generateDispatchLoaderDynamic() },
{ "DispatchLoaderStatic", generateDispatchLoaderStatic() },
{ "DynamicLoader", readSnippet( "DynamicLoader.hpp" ) },
{ "Exceptions", readSnippet( "Exceptions.hpp" ) },
{ "Flags", readSnippet( "Flags.hpp" ) },
{ "headerVersion", m_version },
{ "includes",
replaceWithMap( readSnippet( "includes.hpp" ),
{ { "vulkan_h", ( m_api == "vulkan" ) ? "vulkan.h" : "vulkan_sc_core.h" }, { "vulkan_hpp", m_api + ".hpp" } } ) },
{ "includes", replaceWithMap( readSnippet( "includes.hpp" ), { { "vulkan_h", ( m_api == "vulkan" ) ? "vulkan.h" : "vulkan_sc_core.h" } } ) },
{ "licenseHeader", m_vulkanLicenseHeader },
{ "ObjectDestroy", readSnippet( "ObjectDestroy.hpp" ) },
{ "ObjectFree", readSnippet( "ObjectFree.hpp" ) },
@ -563,12 +551,32 @@ ${DispatchLoaderDynamic}
{ "StridedArrayProxy", readSnippet( "StridedArrayProxy.hpp" ) },
{ "StructureChain", readSnippet( "StructureChain.hpp" ) },
{ "throwResultException", generateThrowResultException() },
{ "typesafeCheck", m_typesafeCheck },
{ "UniqueHandle", readSnippet( "UniqueHandle.hpp" ) } } );
writeToFile( str, vulkan_hpp );
}
void VulkanHppGenerator::generateMacrosFile() const
{
std::string const macros_hpp = std::string( BASE_PATH ) + "/vulkan/" + m_api + "_hpp_macros.hpp";
std::cout << "VulkanHppGenerator: Generating " << macros_hpp << " ..." << std::endl;
std::string const macrosTemplate = R"(${licenseHeader}
#ifndef VULKAN_HPP_MACROS_HPP
#define VULKAN_HPP_MACROS_HPP
${macros}
#endif)";
std::string str = replaceWithMap(
macrosTemplate,
{ { "licenseHeader", m_vulkanLicenseHeader },
{ "macros", replaceWithMap( readSnippet( "macros.hpp" ), { { "vulkan_hpp", m_api + ".hpp" } } ) } } );
writeToFile( str, macros_hpp );
}
void VulkanHppGenerator::generateRAIIHppFile() const
{
std::string const vulkan_raii_hpp = std::string( BASE_PATH ) + "/vulkan/" + m_api + "_raii.hpp";
@ -710,6 +718,10 @@ void VulkanHppGenerator::generateCppModuleFile() const
std::cout << "VulkanHppGenerator: Generating " << vulkan_cppm << "..." << std::endl;
std::string const vulkanCppmTemplate = R"(${licenseHeader}
// Note: This module is still in an experimental state.
// Any feedback is welcome on https://github.com/KhronosGroup/Vulkan-Hpp/issues.
module;
#include <vulkan/${api}.hpp>
@ -718,16 +730,15 @@ module;
#include <vulkan/${api}_hash.hpp>
#include <vulkan/${api}_raii.hpp>
export module ${api};
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE
export module ${api}_hpp;
export namespace VULKAN_HPP_NAMESPACE
{
${usings}
#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE ) && !defined( VULKAN_HPP_NO_EXCEPTIONS )
namespace VULKAN_HPP_RAII_NAMESPACE {
namespace VULKAN_HPP_RAII_NAMESPACE
{
${raiiUsings}
} // namespace VULKAN_HPP_RAII_NAMESPACE
#endif
@ -5253,7 +5264,7 @@ 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 hardCodedTypes = std::array{ "ArrayWrapper1D", "ArrayWrapper2D", "FlagTraits", "Flags", "DispatchLoaderBase", "DispatchLoaderDynamic" };
auto const hardCodedEnhancedModeTypes =
std::array{ "ArrayProxy", "ArrayProxyNoTemporaries", "StridedArrayProxy", "Optional", "StructureChain", "UniqueHandle" };
auto const hardCodedSmartHandleTypes = std::array{ "ObjectDestroy", "ObjectFree", "ObjectRelease", "PoolFree" };
@ -5269,7 +5280,6 @@ std::string VulkanHppGenerator::generateCppModuleUsings() const
}
auto const & [noPrototypesEnter, noPrototypesLeave] = generateProtection( "VK_NO_PROTOTYPES", false );
usings += "\n" + noPrototypesEnter + replaceWithMap( usingTemplate, { { "className", "DispatchLoaderStatic" } } ) + noPrototypesLeave + "\n";
// insert the Flags bitwise operators
@ -5397,8 +5407,6 @@ std::string VulkanHppGenerator::generateCppModuleUsings() const
auto const [enterDynamicLoader, leaveDynamicLoader] = generateProtection( "VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL" );
usings += "\n" + enterDynamicLoader + replaceWithMap( usingTemplate, { { "className", "DynamicLoader" } } ) + leaveDynamicLoader + "\n";
usings += replaceWithMap( usingTemplate, { { "className", "DispatchLoaderDynamic" } } ) + "\n";
usings += generateCppModuleFormatTraitsUsings();
usings += generateCppModuleExtensionInspectionUsings();
@ -5956,15 +5964,6 @@ ${commandMembers}
init(getInstanceProcAddr);
}
void init( PFN_vkGetInstanceProcAddr getInstanceProcAddr ) VULKAN_HPP_NOEXCEPT
{
VULKAN_HPP_ASSERT(getInstanceProcAddr);
vkGetInstanceProcAddr = getInstanceProcAddr;
${initialCommandAssignments}
}
// This interface does not require a linked vulkan library.
DispatchLoaderDynamic( VkInstance instance,
PFN_vkGetInstanceProcAddr getInstanceProcAddr,
@ -5974,6 +5973,33 @@ ${initialCommandAssignments}
init( instance, getInstanceProcAddr, device, getDeviceProcAddr );
}
template <typename DynamicLoader
#if VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL
= VULKAN_HPP_NAMESPACE::DynamicLoader
#endif
>
void init()
{
static DynamicLoader dl;
init( dl );
}
template <typename DynamicLoader>
void init( DynamicLoader const & dl ) VULKAN_HPP_NOEXCEPT
{
PFN_vkGetInstanceProcAddr getInstanceProcAddr = dl.template getProcAddress<PFN_vkGetInstanceProcAddr>( "vkGetInstanceProcAddr" );
init( getInstanceProcAddr );
}
void init( PFN_vkGetInstanceProcAddr getInstanceProcAddr ) VULKAN_HPP_NOEXCEPT
{
VULKAN_HPP_ASSERT(getInstanceProcAddr);
vkGetInstanceProcAddr = getInstanceProcAddr;
${initialCommandAssignments}
}
// This interface does not require a linked vulkan library.
void init( VkInstance instance,
PFN_vkGetInstanceProcAddr getInstanceProcAddr,
@ -5983,7 +6009,8 @@ ${initialCommandAssignments}
VULKAN_HPP_ASSERT(instance && getInstanceProcAddr);
vkGetInstanceProcAddr = getInstanceProcAddr;
init( VULKAN_HPP_NAMESPACE::Instance(instance) );
if (device) {
if (device)
{
init( VULKAN_HPP_NAMESPACE::Device(device) );
}
}
@ -6051,6 +6078,12 @@ std::string VulkanHppGenerator::generateDispatchLoaderStatic() const
public:
${commands}
};
inline ::VULKAN_HPP_NAMESPACE::DispatchLoaderStatic & getDispatchLoaderStatic()
{
static ::VULKAN_HPP_NAMESPACE::DispatchLoaderStatic dls;
return dls;
}
#endif
)";
@ -14364,22 +14397,6 @@ void VulkanHppGenerator::readTypeDefine( tinyxml2::XMLElement const * element, s
checkForError( element->LastChild() && element->LastChild()->ToText() && element->LastChild()->ToText()->Value(),
line,
"unknown formatting of type category=define named <" + name + ">" );
// filter out the check for the different types of VK_DEFINE_NON_DISPATCHABLE_HANDLE
if ( name == "VK_USE_64_BIT_PTR_DEFINES" )
{
m_typesafeCheck = "#if ( VK_USE_64_BIT_PTR_DEFINES == 1 )";
}
else if ( ( name == "VK_DEFINE_NON_DISPATCHABLE_HANDLE" ) && ( m_typesafeCheck.empty() ) )
{
assert( false );
std::string text = element->LastChild()->ToText()->Value();
size_t start = text.find( "#if defined(__LP64__)" );
checkForError( start != std::string::npos, line, "unexpected text in type category=define named <" + name + ">" );
size_t end = text.find_first_of( "\r\n", start + 1 );
checkForError( end != std::string::npos, line, "unexpected text in type category=define named <" + name + ">" );
m_typesafeCheck = text.substr( start, end - start );
}
}
else if ( element->GetText() )
{
@ -15051,7 +15068,7 @@ std::string generateStandardArray( std::string const & type, std::vector<std::st
return arrayString;
}
bool isAllUpper(std::string const& name)
bool isAllUpper( std::string const & name )
{
return std::none_of( name.begin(), name.end(), []( auto const & c ) { return c != toupper( c ); } );
}
@ -15225,6 +15242,7 @@ int main( int argc, char ** argv )
generator.generateHandlesHppFile();
generator.generateHashHppFile();
generator.prepareRAIIHandles();
generator.generateMacrosFile();
generator.generateRAIIHppFile();
generator.generateStaticAssertionsHppFile();
generator.generateStructsHppFile();

View File

@ -87,6 +87,7 @@ public:
void generateHandlesHppFile() const;
void generateHashHppFile() const;
void generateHppFile() const;
void generateMacrosFile() const;
void generateRAIIHppFile() const;
void generateStaticAssertionsHppFile() const;
void generateStructsHppFile() const;
@ -1021,7 +1022,6 @@ private:
std::map<std::string, StructureData> m_structs;
std::map<std::string, TagData> m_tags;
std::map<std::string, TypeData> m_types;
std::string m_typesafeCheck;
std::set<std::string> m_unsupportedExtensions;
std::set<std::string> m_unsupportedFeatures;
std::string m_version;

View File

@ -42,9 +42,7 @@ int main( int /*argc*/, char ** /*argv*/ )
#if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 )
// initialize the DipatchLoaderDynamic to use
vk::DynamicLoader dl;
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = dl.getProcAddress<PFN_vkGetInstanceProcAddr>( "vkGetInstanceProcAddr" );
VULKAN_HPP_DEFAULT_DISPATCHER.init( vkGetInstanceProcAddr );
VULKAN_HPP_DEFAULT_DISPATCHER.init();
#endif
// Determine what API version is available

View File

@ -121,9 +121,7 @@ int main( int /*argc*/, char ** /*argv*/ )
{
#if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 )
// initialize the DipatchLoaderDynamic to use
vk::DynamicLoader dl;
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = dl.getProcAddress<PFN_vkGetInstanceProcAddr>( "vkGetInstanceProcAddr" );
VULKAN_HPP_DEFAULT_DISPATCHER.init( vkGetInstanceProcAddr );
VULKAN_HPP_DEFAULT_DISPATCHER.init();
#endif
std::vector<vk::LayerProperties> instanceLayerProperties = vk::enumerateInstanceLayerProperties();

View File

@ -33,9 +33,7 @@ int main( int /*argc*/, char ** /*argv*/ )
{
#if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 )
// initialize the DipatchLoaderDynamic to use
vk::DynamicLoader dl;
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = dl.getProcAddress<PFN_vkGetInstanceProcAddr>( "vkGetInstanceProcAddr" );
VULKAN_HPP_DEFAULT_DISPATCHER.init( vkGetInstanceProcAddr );
VULKAN_HPP_DEFAULT_DISPATCHER.init();
#endif
/* VULKAN_KEY_START */

View File

@ -50,9 +50,7 @@ int main( int /*argc*/, char ** /*argv*/ )
{
// need to initialize the dynamic dispatcher before the very first vulkan call
#if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 )
vk::DynamicLoader dl;
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = dl.getProcAddress<PFN_vkGetInstanceProcAddr>( "vkGetInstanceProcAddr" );
VULKAN_HPP_DEFAULT_DISPATCHER.init( vkGetInstanceProcAddr );
VULKAN_HPP_DEFAULT_DISPATCHER.init();
#endif
std::vector<vk::ExtensionProperties> instanceExtensionProperties = vk::enumerateInstanceExtensionProperties();

View File

@ -283,9 +283,7 @@ namespace vk
uint32_t apiVersion )
{
#if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 )
static vk::DynamicLoader dl;
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = dl.getProcAddress<PFN_vkGetInstanceProcAddr>( "vkGetInstanceProcAddr" );
VULKAN_HPP_DEFAULT_DISPATCHER.init( vkGetInstanceProcAddr );
VULKAN_HPP_DEFAULT_DISPATCHER.init();
#endif
vk::ApplicationInfo applicationInfo( appName.c_str(), 1, engineName.c_str(), 1, apiVersion );

View File

@ -24,112 +24,3 @@ constexpr int True = 1;
# undef False
constexpr int False = 0;
#endif
#if defined(__GNUC__)
# define GCC_VERSION ( __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ )
#endif
#if !defined( VULKAN_HPP_HAS_UNRESTRICTED_UNIONS )
# if defined( __clang__ )
# if __has_feature( cxx_unrestricted_unions )
# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS
# endif
# elif defined( __GNUC__ )
# if 40600 <= GCC_VERSION
# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS
# endif
# elif defined( _MSC_VER )
# if 1900 <= _MSC_VER
# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS
# endif
# endif
#endif
#if !defined( VULKAN_HPP_INLINE )
# if defined( __clang__ )
# if __has_attribute( always_inline )
# define VULKAN_HPP_INLINE __attribute__( ( always_inline ) ) __inline__
# else
# define VULKAN_HPP_INLINE inline
# endif
# elif defined( __GNUC__ )
# define VULKAN_HPP_INLINE __attribute__( ( always_inline ) ) __inline__
# elif defined( _MSC_VER )
# define VULKAN_HPP_INLINE inline
# else
# define VULKAN_HPP_INLINE inline
# endif
#endif
#if defined( VULKAN_HPP_TYPESAFE_CONVERSION )
# define VULKAN_HPP_TYPESAFE_EXPLICIT
#else
# define VULKAN_HPP_TYPESAFE_EXPLICIT explicit
#endif
#if defined( __cpp_constexpr )
# define VULKAN_HPP_CONSTEXPR constexpr
# if 201304 <= __cpp_constexpr
# define VULKAN_HPP_CONSTEXPR_14 constexpr
# else
# define VULKAN_HPP_CONSTEXPR_14
# endif
# if ( 201907 <= __cpp_constexpr ) && ( !defined(__GNUC__) || ( 110400 < GCC_VERSION ) )
# define VULKAN_HPP_CONSTEXPR_20 constexpr
# else
# define VULKAN_HPP_CONSTEXPR_20
# endif
# define VULKAN_HPP_CONST_OR_CONSTEXPR constexpr
#else
# define VULKAN_HPP_CONSTEXPR
# define VULKAN_HPP_CONSTEXPR_14
# define VULKAN_HPP_CONST_OR_CONSTEXPR const
#endif
#if !defined( VULKAN_HPP_CONSTEXPR_INLINE )
# if 201606L <= __cpp_inline_variables
# define VULKAN_HPP_CONSTEXPR_INLINE VULKAN_HPP_CONSTEXPR inline
# else
# define VULKAN_HPP_CONSTEXPR_INLINE VULKAN_HPP_CONSTEXPR
# endif
#endif
#if !defined( VULKAN_HPP_NOEXCEPT )
# if defined( _MSC_VER ) && ( _MSC_VER <= 1800 )
# define VULKAN_HPP_NOEXCEPT
# else
# define VULKAN_HPP_NOEXCEPT noexcept
# define VULKAN_HPP_HAS_NOEXCEPT 1
# if defined( VULKAN_HPP_NO_EXCEPTIONS )
# define VULKAN_HPP_NOEXCEPT_WHEN_NO_EXCEPTIONS noexcept
# else
# define VULKAN_HPP_NOEXCEPT_WHEN_NO_EXCEPTIONS
# endif
# endif
#endif
#if 14 <= VULKAN_HPP_CPP_VERSION
# define VULKAN_HPP_DEPRECATED( msg ) [[deprecated( msg )]]
#else
# define VULKAN_HPP_DEPRECATED( msg )
#endif
#if ( 17 <= VULKAN_HPP_CPP_VERSION ) && !defined( VULKAN_HPP_NO_NODISCARD_WARNINGS )
# define VULKAN_HPP_NODISCARD [[nodiscard]]
# if defined( VULKAN_HPP_NO_EXCEPTIONS )
# define VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS [[nodiscard]]
# else
# define VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS
# endif
#else
# define VULKAN_HPP_NODISCARD
# define VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS
#endif
#if !defined( VULKAN_HPP_NAMESPACE )
# define VULKAN_HPP_NAMESPACE vk
#endif
#define VULKAN_HPP_STRINGIFY2( text ) #text
#define VULKAN_HPP_STRINGIFY( text ) VULKAN_HPP_STRINGIFY2( text )
#define VULKAN_HPP_NAMESPACE_STRING VULKAN_HPP_STRINGIFY( VULKAN_HPP_NAMESPACE )

View File

@ -1,37 +1,17 @@
#ifndef VULKAN_HPP
#define VULKAN_HPP
#if defined( _MSVC_LANG )
# define VULKAN_HPP_CPLUSPLUS _MSVC_LANG
#else
# define VULKAN_HPP_CPLUSPLUS __cplusplus
#endif
#if 201703L < VULKAN_HPP_CPLUSPLUS
# define VULKAN_HPP_CPP_VERSION 20
#elif 201402L < VULKAN_HPP_CPLUSPLUS
# define VULKAN_HPP_CPP_VERSION 17
#elif 201103L < VULKAN_HPP_CPLUSPLUS
# define VULKAN_HPP_CPP_VERSION 14
#elif 199711L < VULKAN_HPP_CPLUSPLUS
# define VULKAN_HPP_CPP_VERSION 11
#else
# error "${vulkan_hpp} needs at least c++ standard version 11"
#endif
#include <algorithm>
#include <array> // ArrayWrapperND
#include <string> // std::string
#include <vulkan/${vulkan_h}>
#include <vulkan/vulkan_hpp_macros.hpp>
#if 17 <= VULKAN_HPP_CPP_VERSION
# include <string_view> // std::string_view
#endif
#if defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
# if !defined( VULKAN_HPP_NO_SMART_HANDLE )
# define VULKAN_HPP_NO_SMART_HANDLE
# endif
#else
#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
# include <tuple> // std::tie
# include <vector> // std::vector
#endif
@ -40,39 +20,8 @@
# include <system_error> // std::is_error_code_enum
#endif
#if defined( VULKAN_HPP_NO_CONSTRUCTORS )
# if !defined( VULKAN_HPP_NO_STRUCT_CONSTRUCTORS )
# define VULKAN_HPP_NO_STRUCT_CONSTRUCTORS
# endif
# if !defined( VULKAN_HPP_NO_UNION_CONSTRUCTORS )
# define VULKAN_HPP_NO_UNION_CONSTRUCTORS
# endif
#endif
#if defined( VULKAN_HPP_NO_SETTERS )
# if !defined( VULKAN_HPP_NO_STRUCT_SETTERS )
# define VULKAN_HPP_NO_STRUCT_SETTERS
# endif
# if !defined( VULKAN_HPP_NO_UNION_SETTERS )
# define VULKAN_HPP_NO_UNION_SETTERS
# endif
#endif
#if !defined( VULKAN_HPP_ASSERT )
#if ( VULKAN_HPP_ASSERT == assert )
# include <cassert>
# define VULKAN_HPP_ASSERT assert
#endif
#if !defined( VULKAN_HPP_ASSERT_ON_RESULT )
# define VULKAN_HPP_ASSERT_ON_RESULT VULKAN_HPP_ASSERT
#endif
#if !defined( VULKAN_HPP_STATIC_ASSERT )
# define VULKAN_HPP_STATIC_ASSERT static_assert
#endif
#if !defined( VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL )
# define VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL 1
#endif
#if VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL == 1
@ -91,18 +40,10 @@ extern "C" __declspec( dllimport ) FARPROC __stdcall GetProcAddress( HINSTANCE h
# endif
#endif
#if !defined( __has_include )
# define __has_include( x ) false
#endif
#if ( 201907 <= __cpp_lib_three_way_comparison ) && __has_include( <compare> ) && !defined( VULKAN_HPP_NO_SPACESHIP_OPERATOR )
# define VULKAN_HPP_HAS_SPACESHIP_OPERATOR
#endif
#if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR )
# include <compare>
#endif
#if ( 201803 <= __cpp_lib_span )
# define VULKAN_HPP_SUPPORT_SPAN
#if defined( VULKAN_HPP_SUPPORT_SPAN )
# include <span>
#endif

258
snippets/macros.hpp Normal file
View File

@ -0,0 +1,258 @@
#if defined( _MSVC_LANG )
# define VULKAN_HPP_CPLUSPLUS _MSVC_LANG
#else
# define VULKAN_HPP_CPLUSPLUS __cplusplus
#endif
#if 201703L < VULKAN_HPP_CPLUSPLUS
# define VULKAN_HPP_CPP_VERSION 20
#elif 201402L < VULKAN_HPP_CPLUSPLUS
# define VULKAN_HPP_CPP_VERSION 17
#elif 201103L < VULKAN_HPP_CPLUSPLUS
# define VULKAN_HPP_CPP_VERSION 14
#elif 199711L < VULKAN_HPP_CPLUSPLUS
# define VULKAN_HPP_CPP_VERSION 11
#else
# error "${vulkan_hpp} needs at least c++ standard version 11"
#endif
#if defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
# if !defined( VULKAN_HPP_NO_SMART_HANDLE )
# define VULKAN_HPP_NO_SMART_HANDLE
# endif
#endif
#if defined( VULKAN_HPP_NO_CONSTRUCTORS )
# if !defined( VULKAN_HPP_NO_STRUCT_CONSTRUCTORS )
# define VULKAN_HPP_NO_STRUCT_CONSTRUCTORS
# endif
# if !defined( VULKAN_HPP_NO_UNION_CONSTRUCTORS )
# define VULKAN_HPP_NO_UNION_CONSTRUCTORS
# endif
#endif
#if defined( VULKAN_HPP_NO_SETTERS )
# if !defined( VULKAN_HPP_NO_STRUCT_SETTERS )
# define VULKAN_HPP_NO_STRUCT_SETTERS
# endif
# if !defined( VULKAN_HPP_NO_UNION_SETTERS )
# define VULKAN_HPP_NO_UNION_SETTERS
# endif
#endif
#if !defined( VULKAN_HPP_ASSERT )
# define VULKAN_HPP_ASSERT assert
#endif
#if !defined( VULKAN_HPP_ASSERT_ON_RESULT )
# define VULKAN_HPP_ASSERT_ON_RESULT VULKAN_HPP_ASSERT
#endif
#if !defined( VULKAN_HPP_STATIC_ASSERT )
# define VULKAN_HPP_STATIC_ASSERT static_assert
#endif
#if !defined( VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL )
# define VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL 1
#endif
#if !defined( __has_include )
# define __has_include( x ) false
#endif
#if ( 201907 <= __cpp_lib_three_way_comparison ) && __has_include( <compare> ) && !defined( VULKAN_HPP_NO_SPACESHIP_OPERATOR )
# define VULKAN_HPP_HAS_SPACESHIP_OPERATOR
#endif
#if ( 201803 <= __cpp_lib_span )
# define VULKAN_HPP_SUPPORT_SPAN
#endif
// 32-bit vulkan is not typesafe for non-dispatchable handles, so don't allow copy constructors on this platform by default.
// To enable this feature on 32-bit platforms please define VULKAN_HPP_TYPESAFE_CONVERSION
#if ( VK_USE_64_BIT_PTR_DEFINES == 1 )
# if !defined( VULKAN_HPP_TYPESAFE_CONVERSION )
# define VULKAN_HPP_TYPESAFE_CONVERSION
# endif
#endif
#if defined(__GNUC__)
# define GCC_VERSION ( __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ )
#endif
#if !defined( VULKAN_HPP_HAS_UNRESTRICTED_UNIONS )
# if defined( __clang__ )
# if __has_feature( cxx_unrestricted_unions )
# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS
# endif
# elif defined( __GNUC__ )
# if 40600 <= GCC_VERSION
# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS
# endif
# elif defined( _MSC_VER )
# if 1900 <= _MSC_VER
# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS
# endif
# endif
#endif
#if !defined( VULKAN_HPP_INLINE )
# if defined( __clang__ )
# if __has_attribute( always_inline )
# define VULKAN_HPP_INLINE __attribute__( ( always_inline ) ) __inline__
# else
# define VULKAN_HPP_INLINE inline
# endif
# elif defined( __GNUC__ )
# define VULKAN_HPP_INLINE __attribute__( ( always_inline ) ) __inline__
# elif defined( _MSC_VER )
# define VULKAN_HPP_INLINE inline
# else
# define VULKAN_HPP_INLINE inline
# endif
#endif
#if defined( VULKAN_HPP_TYPESAFE_CONVERSION )
# define VULKAN_HPP_TYPESAFE_EXPLICIT
#else
# define VULKAN_HPP_TYPESAFE_EXPLICIT explicit
#endif
#if defined( __cpp_constexpr )
# define VULKAN_HPP_CONSTEXPR constexpr
# if 201304 <= __cpp_constexpr
# define VULKAN_HPP_CONSTEXPR_14 constexpr
# else
# define VULKAN_HPP_CONSTEXPR_14
# endif
# if ( 201907 <= __cpp_constexpr ) && ( !defined(__GNUC__) || ( 110400 < GCC_VERSION ) )
# define VULKAN_HPP_CONSTEXPR_20 constexpr
# else
# define VULKAN_HPP_CONSTEXPR_20
# endif
# define VULKAN_HPP_CONST_OR_CONSTEXPR constexpr
#else
# define VULKAN_HPP_CONSTEXPR
# define VULKAN_HPP_CONSTEXPR_14
# define VULKAN_HPP_CONST_OR_CONSTEXPR const
#endif
#if !defined( VULKAN_HPP_CONSTEXPR_INLINE )
# if 201606L <= __cpp_inline_variables
# define VULKAN_HPP_CONSTEXPR_INLINE VULKAN_HPP_CONSTEXPR inline
# else
# define VULKAN_HPP_CONSTEXPR_INLINE VULKAN_HPP_CONSTEXPR
# endif
#endif
#if !defined( VULKAN_HPP_NOEXCEPT )
# if defined( _MSC_VER ) && ( _MSC_VER <= 1800 )
# define VULKAN_HPP_NOEXCEPT
# else
# define VULKAN_HPP_NOEXCEPT noexcept
# define VULKAN_HPP_HAS_NOEXCEPT 1
# if defined( VULKAN_HPP_NO_EXCEPTIONS )
# define VULKAN_HPP_NOEXCEPT_WHEN_NO_EXCEPTIONS noexcept
# else
# define VULKAN_HPP_NOEXCEPT_WHEN_NO_EXCEPTIONS
# endif
# endif
#endif
#if 14 <= VULKAN_HPP_CPP_VERSION
# define VULKAN_HPP_DEPRECATED( msg ) [[deprecated( msg )]]
#else
# define VULKAN_HPP_DEPRECATED( msg )
#endif
#if ( 17 <= VULKAN_HPP_CPP_VERSION ) && !defined( VULKAN_HPP_NO_NODISCARD_WARNINGS )
# define VULKAN_HPP_NODISCARD [[nodiscard]]
# if defined( VULKAN_HPP_NO_EXCEPTIONS )
# define VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS [[nodiscard]]
# else
# define VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS
# endif
#else
# define VULKAN_HPP_NODISCARD
# define VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS
#endif
#if !defined( VULKAN_HPP_NAMESPACE )
# define VULKAN_HPP_NAMESPACE vk
#endif
#define VULKAN_HPP_STRINGIFY2( text ) #text
#define VULKAN_HPP_STRINGIFY( text ) VULKAN_HPP_STRINGIFY2( text )
#define VULKAN_HPP_NAMESPACE_STRING VULKAN_HPP_STRINGIFY( VULKAN_HPP_NAMESPACE )
#if !defined(VULKAN_HPP_DISPATCH_LOADER_DYNAMIC)
# if defined( VK_NO_PROTOTYPES )
# define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 1
# else
# define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 0
# endif
#endif
#if !defined( VULKAN_HPP_STORAGE_API )
# if defined( VULKAN_HPP_STORAGE_SHARED )
# if defined( _MSC_VER )
# if defined( VULKAN_HPP_STORAGE_SHARED_EXPORT )
# define VULKAN_HPP_STORAGE_API __declspec( dllexport )
# else
# define VULKAN_HPP_STORAGE_API __declspec( dllimport )
# endif
# elif defined( __clang__ ) || defined( __GNUC__ )
# if defined( VULKAN_HPP_STORAGE_SHARED_EXPORT )
# define VULKAN_HPP_STORAGE_API __attribute__( ( visibility( "default" ) ) )
# else
# define VULKAN_HPP_STORAGE_API
# endif
# else
# define VULKAN_HPP_STORAGE_API
# pragma warning Unknown import / export semantics
# endif
# else
# define VULKAN_HPP_STORAGE_API
# endif
#endif
namespace VULKAN_HPP_NAMESPACE
{
class DispatchLoaderDynamic;
} // namespace VULKAN_HPP_NAMESPACE
#if !defined( VULKAN_HPP_DEFAULT_DISPATCHER )
# if VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1
# define VULKAN_HPP_DEFAULT_DISPATCHER ::VULKAN_HPP_NAMESPACE::defaultDispatchLoaderDynamic
# define VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE \
namespace VULKAN_HPP_NAMESPACE \
{ \
VULKAN_HPP_STORAGE_API ::VULKAN_HPP_NAMESPACE::DispatchLoaderDynamic defaultDispatchLoaderDynamic; \
}
namespace VULKAN_HPP_NAMESPACE
{
extern VULKAN_HPP_STORAGE_API VULKAN_HPP_NAMESPACE::DispatchLoaderDynamic defaultDispatchLoaderDynamic;
} // namespace VULKAN_HPP_NAMESPACE
# else
# define VULKAN_HPP_DEFAULT_DISPATCHER ::VULKAN_HPP_NAMESPACE::getDispatchLoaderStatic()
# define VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE
# endif
#endif
#if !defined( VULKAN_HPP_DEFAULT_DISPATCHER_TYPE )
# if VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1
# define VULKAN_HPP_DEFAULT_DISPATCHER_TYPE ::VULKAN_HPP_NAMESPACE::DispatchLoaderDynamic
# else
# define VULKAN_HPP_DEFAULT_DISPATCHER_TYPE ::VULKAN_HPP_NAMESPACE::DispatchLoaderStatic
# endif
#endif
#if defined( VULKAN_HPP_NO_DEFAULT_DISPATCHER )
# define VULKAN_HPP_DEFAULT_ARGUMENT_ASSIGNMENT
# define VULKAN_HPP_DEFAULT_ARGUMENT_NULLPTR_ASSIGNMENT
# define VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT
#else
# define VULKAN_HPP_DEFAULT_ARGUMENT_ASSIGNMENT = {}
# define VULKAN_HPP_DEFAULT_ARGUMENT_NULLPTR_ASSIGNMENT = nullptr
# define VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT = VULKAN_HPP_DEFAULT_DISPATCHER
#endif

View File

@ -1,10 +1,14 @@
cmake_minimum_required( VERSION 3.25 )
vulkan_hpp__setup_test( NAME Cpp20Modules CXX_STANDARD 20 LIBRARIES VulkanHppModule )
vulkan_hpp__setup_test( NAME Cpp20Modules CXX_STANDARD 20 LIBRARIES VulkanHppModule NO_UTILS )
if( NOT VULKAN_HPP_SAMPLES_BUILD_ONLY_DYNAMIC )
if ( VULKAN_HPP_CPP20_MODULE_DYNAMIC_DISPATCHER )
target_compile_definitions( Cpp20Modules PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1 )
else()
target_compile_definitions( Cpp20Modules PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=0 )
endif()
target_link_libraries( Cpp20Modules PRIVATE Vulkan::Vulkan )
set_target_properties( Cpp20Modules PROPERTIES
CXX_EXTENSIONS OFF
set_target_properties( Cpp20Modules PROPERTIES CXX_EXTENSIONS OFF
)
endif()

View File

@ -1,15 +1,25 @@
import vulkan;
import vulkan_hpp;
#include <iostream>
#include <vulkan/vulkan_hpp_macros.hpp>
static std::string AppName = "01_InitInstance";
static std::string EngineName = "Vulkan.hpp";
static std::string AppName = "Cpp20Modules";
static std::string EngineName = "Vulkan.cppm";
#if VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE
#endif
int main( int /*argc*/, char ** /*argv*/ )
{
/* VULKAN_HPP_KEY_START */
try
{
#if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 )
// initialize minimal set of function pointers
VULKAN_HPP_DEFAULT_DISPATCHER.init();
#endif
// initialize the vk::ApplicationInfo structure
vk::ApplicationInfo applicationInfo( AppName.c_str(), 1, EngineName.c_str(), 1, vk::makeApiVersion( 1, 0, 0, 0 ) );
@ -19,6 +29,11 @@ int main( int /*argc*/, char ** /*argv*/ )
// create an Instance
vk::Instance instance = vk::createInstance( instanceCreateInfo );
#if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 )
// initialize function pointers for instance
VULKAN_HPP_DEFAULT_DISPATCHER.init( instance );
#endif
// destroy it again
instance.destroy();
}

View File

@ -27,9 +27,18 @@ int main( int /*argc*/, char ** /*argv*/ )
{
try
{
// three equivalent minimal initializations of the default dispatcher... you just need to use one of them
// initialize minimal set of function pointers
VULKAN_HPP_DEFAULT_DISPATCHER.init();
// the same initialization, now with explicitly providing a DynamicLoader
vk::DynamicLoader dl;
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = dl.getProcAddress<PFN_vkGetInstanceProcAddr>( "vkGetInstanceProcAddr" );
VULKAN_HPP_DEFAULT_DISPATCHER.init( vkGetInstanceProcAddr );
VULKAN_HPP_DEFAULT_DISPATCHER.init( dl );
// the same initialization, now with explicitly providing the initial function pointer
PFN_vkGetInstanceProcAddr getInstanceProcAddr = dl.getProcAddress<PFN_vkGetInstanceProcAddr>( "vkGetInstanceProcAddr" );
VULKAN_HPP_DEFAULT_DISPATCHER.init( getInstanceProcAddr );
vk::Instance instance = vk::createInstance( {}, nullptr );
@ -42,7 +51,7 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::Device device = physicalDevices[0].createDevice( {}, nullptr );
// function pointer specialization for device
// optional function pointer specialization for device
VULKAN_HPP_DEFAULT_DISPATCHER.init( device );
}
catch ( vk::SystemError const & err )

View File

@ -23,9 +23,7 @@ int main( int /*argc*/, char ** /*argv*/ )
{
try
{
vk::DynamicLoader dl;
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = dl.getProcAddress<PFN_vkGetInstanceProcAddr>( "vkGetInstanceProcAddr" );
VULKAN_HPP_DEFAULT_DISPATCHER.init( vkGetInstanceProcAddr );
VULKAN_HPP_DEFAULT_DISPATCHER.init();
vk::Instance instance = vk::createInstance( {}, nullptr );

View File

@ -29,9 +29,7 @@ VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE
int main( int /*argc*/, char ** /*argv*/ )
{
vk::DynamicLoader dl;
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = dl.getProcAddress<PFN_vkGetInstanceProcAddr>( "vkGetInstanceProcAddr" );
VULKAN_HPP_DEFAULT_DISPATCHER.init( vkGetInstanceProcAddr );
VULKAN_HPP_DEFAULT_DISPATCHER.init();
vk::ApplicationInfo appInfo( AppName, 1, EngineName, 1, VK_API_VERSION_1_1 );
vk::UniqueInstance instance = vk::createInstanceUnique( vk::InstanceCreateInfo( {}, &appInfo ) ).value;

View File

@ -43,9 +43,7 @@ int main( int /*argc*/, char ** /*argv*/ )
{
try
{
vk::DynamicLoader dl;
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = dl.getProcAddress<PFN_vkGetInstanceProcAddr>( "vkGetInstanceProcAddr" );
VULKAN_HPP_DEFAULT_DISPATCHER.init( vkGetInstanceProcAddr );
VULKAN_HPP_DEFAULT_DISPATCHER.init();
vk::ApplicationInfo appInfo( AppName, 1, EngineName, 1, VK_API_VERSION_1_1 );
vk::UniqueInstance instance = vk::createInstanceUnique( vk::InstanceCreateInfo( {}, &appInfo ) );

View File

@ -49,9 +49,7 @@ vk::UniqueInstance createInstanceUnique( std::string const & appNam
uint32_t apiVersion = VK_API_VERSION_1_0 )
{
#if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 )
static vk::DynamicLoader dl;
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = dl.getProcAddress<PFN_vkGetInstanceProcAddr>( "vkGetInstanceProcAddr" );
VULKAN_HPP_DEFAULT_DISPATCHER.init( vkGetInstanceProcAddr );
VULKAN_HPP_DEFAULT_DISPATCHER.init();
#endif
vk::ApplicationInfo applicationInfo( appName.c_str(), 1, engineName.c_str(), 1, apiVersion );

View File

@ -5,6 +5,9 @@
// This header is generated from the Khronos Vulkan XML API Registry.
// Note: This module is still in an experimental state.
// Any feedback is welcome on https://github.com/KhronosGroup/Vulkan-Hpp/issues.
module;
#include <vulkan/vulkan.hpp>
@ -13,9 +16,7 @@ module;
#include <vulkan/vulkan_hash.hpp>
#include <vulkan/vulkan_raii.hpp>
export module vulkan;
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE
export module vulkan_hpp;
export namespace VULKAN_HPP_NAMESPACE
{
@ -25,6 +26,7 @@ export namespace VULKAN_HPP_NAMESPACE
using VULKAN_HPP_NAMESPACE::ArrayWrapper1D;
using VULKAN_HPP_NAMESPACE::ArrayWrapper2D;
using VULKAN_HPP_NAMESPACE::DispatchLoaderBase;
using VULKAN_HPP_NAMESPACE::DispatchLoaderDynamic;
using VULKAN_HPP_NAMESPACE::Flags;
using VULKAN_HPP_NAMESPACE::FlagTraits;
@ -2888,8 +2890,6 @@ export namespace VULKAN_HPP_NAMESPACE
using VULKAN_HPP_NAMESPACE::DynamicLoader;
#endif /*VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL*/
using VULKAN_HPP_NAMESPACE::DispatchLoaderDynamic;
//=====================
//=== Format Traits ===
//=====================

View File

@ -8,37 +8,17 @@
#ifndef VULKAN_HPP
#define VULKAN_HPP
#if defined( _MSVC_LANG )
# define VULKAN_HPP_CPLUSPLUS _MSVC_LANG
#else
# define VULKAN_HPP_CPLUSPLUS __cplusplus
#endif
#if 201703L < VULKAN_HPP_CPLUSPLUS
# define VULKAN_HPP_CPP_VERSION 20
#elif 201402L < VULKAN_HPP_CPLUSPLUS
# define VULKAN_HPP_CPP_VERSION 17
#elif 201103L < VULKAN_HPP_CPLUSPLUS
# define VULKAN_HPP_CPP_VERSION 14
#elif 199711L < VULKAN_HPP_CPLUSPLUS
# define VULKAN_HPP_CPP_VERSION 11
#else
# error "vulkan.hpp needs at least c++ standard version 11"
#endif
#include <algorithm>
#include <array> // ArrayWrapperND
#include <string> // std::string
#include <vulkan/vulkan.h>
#include <vulkan/vulkan_hpp_macros.hpp>
#if 17 <= VULKAN_HPP_CPP_VERSION
# include <string_view> // std::string_view
#endif
#if defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
# if !defined( VULKAN_HPP_NO_SMART_HANDLE )
# define VULKAN_HPP_NO_SMART_HANDLE
# endif
#else
#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
# include <tuple> // std::tie
# include <vector> // std::vector
#endif
@ -47,39 +27,8 @@
# include <system_error> // std::is_error_code_enum
#endif
#if defined( VULKAN_HPP_NO_CONSTRUCTORS )
# if !defined( VULKAN_HPP_NO_STRUCT_CONSTRUCTORS )
# define VULKAN_HPP_NO_STRUCT_CONSTRUCTORS
# endif
# if !defined( VULKAN_HPP_NO_UNION_CONSTRUCTORS )
# define VULKAN_HPP_NO_UNION_CONSTRUCTORS
# endif
#endif
#if defined( VULKAN_HPP_NO_SETTERS )
# if !defined( VULKAN_HPP_NO_STRUCT_SETTERS )
# define VULKAN_HPP_NO_STRUCT_SETTERS
# endif
# if !defined( VULKAN_HPP_NO_UNION_SETTERS )
# define VULKAN_HPP_NO_UNION_SETTERS
# endif
#endif
#if !defined( VULKAN_HPP_ASSERT )
#if ( VULKAN_HPP_ASSERT == assert )
# include <cassert>
# define VULKAN_HPP_ASSERT assert
#endif
#if !defined( VULKAN_HPP_ASSERT_ON_RESULT )
# define VULKAN_HPP_ASSERT_ON_RESULT VULKAN_HPP_ASSERT
#endif
#if !defined( VULKAN_HPP_STATIC_ASSERT )
# define VULKAN_HPP_STATIC_ASSERT static_assert
#endif
#if !defined( VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL )
# define VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL 1
#endif
#if VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL == 1
@ -98,32 +47,16 @@ extern "C" __declspec( dllimport ) FARPROC __stdcall GetProcAddress( HINSTANCE h
# endif
#endif
#if !defined( __has_include )
# define __has_include( x ) false
#endif
#if ( 201907 <= __cpp_lib_three_way_comparison ) && __has_include( <compare> ) && !defined( VULKAN_HPP_NO_SPACESHIP_OPERATOR )
# define VULKAN_HPP_HAS_SPACESHIP_OPERATOR
#endif
#if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR )
# include <compare>
#endif
#if ( 201803 <= __cpp_lib_span )
# define VULKAN_HPP_SUPPORT_SPAN
#if defined( VULKAN_HPP_SUPPORT_SPAN )
# include <span>
#endif
static_assert( VK_HEADER_VERSION == 262, "Wrong VK_HEADER_VERSION!" );
// 32-bit vulkan is not typesafe for non-dispatchable handles, so don't allow copy constructors on this platform by default.
// To enable this feature on 32-bit platforms please define VULKAN_HPP_TYPESAFE_CONVERSION
#if ( VK_USE_64_BIT_PTR_DEFINES == 1 )
# if !defined( VULKAN_HPP_TYPESAFE_CONVERSION )
# define VULKAN_HPP_TYPESAFE_CONVERSION
# endif
#endif
// <tuple> includes <sys/sysmacros.h> through some other header
// this results in major(x) being resolved to gnu_dev_major(x)
// which is an expression in a constructor initializer list.
@ -151,115 +84,6 @@ constexpr int True = 1;
constexpr int False = 0;
#endif
#if defined( __GNUC__ )
# define GCC_VERSION ( __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ )
#endif
#if !defined( VULKAN_HPP_HAS_UNRESTRICTED_UNIONS )
# if defined( __clang__ )
# if __has_feature( cxx_unrestricted_unions )
# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS
# endif
# elif defined( __GNUC__ )
# if 40600 <= GCC_VERSION
# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS
# endif
# elif defined( _MSC_VER )
# if 1900 <= _MSC_VER
# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS
# endif
# endif
#endif
#if !defined( VULKAN_HPP_INLINE )
# if defined( __clang__ )
# if __has_attribute( always_inline )
# define VULKAN_HPP_INLINE __attribute__( ( always_inline ) ) __inline__
# else
# define VULKAN_HPP_INLINE inline
# endif
# elif defined( __GNUC__ )
# define VULKAN_HPP_INLINE __attribute__( ( always_inline ) ) __inline__
# elif defined( _MSC_VER )
# define VULKAN_HPP_INLINE inline
# else
# define VULKAN_HPP_INLINE inline
# endif
#endif
#if defined( VULKAN_HPP_TYPESAFE_CONVERSION )
# define VULKAN_HPP_TYPESAFE_EXPLICIT
#else
# define VULKAN_HPP_TYPESAFE_EXPLICIT explicit
#endif
#if defined( __cpp_constexpr )
# define VULKAN_HPP_CONSTEXPR constexpr
# if 201304 <= __cpp_constexpr
# define VULKAN_HPP_CONSTEXPR_14 constexpr
# else
# define VULKAN_HPP_CONSTEXPR_14
# endif
# if ( 201907 <= __cpp_constexpr ) && ( !defined( __GNUC__ ) || ( 110400 < GCC_VERSION ) )
# define VULKAN_HPP_CONSTEXPR_20 constexpr
# else
# define VULKAN_HPP_CONSTEXPR_20
# endif
# define VULKAN_HPP_CONST_OR_CONSTEXPR constexpr
#else
# define VULKAN_HPP_CONSTEXPR
# define VULKAN_HPP_CONSTEXPR_14
# define VULKAN_HPP_CONST_OR_CONSTEXPR const
#endif
#if !defined( VULKAN_HPP_CONSTEXPR_INLINE )
# if 201606L <= __cpp_inline_variables
# define VULKAN_HPP_CONSTEXPR_INLINE VULKAN_HPP_CONSTEXPR inline
# else
# define VULKAN_HPP_CONSTEXPR_INLINE VULKAN_HPP_CONSTEXPR
# endif
#endif
#if !defined( VULKAN_HPP_NOEXCEPT )
# if defined( _MSC_VER ) && ( _MSC_VER <= 1800 )
# define VULKAN_HPP_NOEXCEPT
# else
# define VULKAN_HPP_NOEXCEPT noexcept
# define VULKAN_HPP_HAS_NOEXCEPT 1
# if defined( VULKAN_HPP_NO_EXCEPTIONS )
# define VULKAN_HPP_NOEXCEPT_WHEN_NO_EXCEPTIONS noexcept
# else
# define VULKAN_HPP_NOEXCEPT_WHEN_NO_EXCEPTIONS
# endif
# endif
#endif
#if 14 <= VULKAN_HPP_CPP_VERSION
# define VULKAN_HPP_DEPRECATED( msg ) [[deprecated( msg )]]
#else
# define VULKAN_HPP_DEPRECATED( msg )
#endif
#if ( 17 <= VULKAN_HPP_CPP_VERSION ) && !defined( VULKAN_HPP_NO_NODISCARD_WARNINGS )
# define VULKAN_HPP_NODISCARD [[nodiscard]]
# if defined( VULKAN_HPP_NO_EXCEPTIONS )
# define VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS [[nodiscard]]
# else
# define VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS
# endif
#else
# define VULKAN_HPP_NODISCARD
# define VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS
#endif
#if !defined( VULKAN_HPP_NAMESPACE )
# define VULKAN_HPP_NAMESPACE vk
#endif
#define VULKAN_HPP_STRINGIFY2( text ) #text
#define VULKAN_HPP_STRINGIFY( text ) VULKAN_HPP_STRINGIFY2( text )
#define VULKAN_HPP_NAMESPACE_STRING VULKAN_HPP_STRINGIFY( VULKAN_HPP_NAMESPACE )
namespace VULKAN_HPP_NAMESPACE
{
template <typename T, size_t N>
@ -6126,77 +5950,12 @@ namespace VULKAN_HPP_NAMESPACE
}
# endif /*VK_USE_PLATFORM_SCREEN_QNX*/
};
#endif
class DispatchLoaderDynamic;
#if !defined( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC )
# if defined( VK_NO_PROTOTYPES )
# define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 1
# else
# define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 0
# endif
#endif
#if !defined( VULKAN_HPP_STORAGE_API )
# if defined( VULKAN_HPP_STORAGE_SHARED )
# if defined( _MSC_VER )
# if defined( VULKAN_HPP_STORAGE_SHARED_EXPORT )
# define VULKAN_HPP_STORAGE_API __declspec( dllexport )
# else
# define VULKAN_HPP_STORAGE_API __declspec( dllimport )
# endif
# elif defined( __clang__ ) || defined( __GNUC__ )
# if defined( VULKAN_HPP_STORAGE_SHARED_EXPORT )
# define VULKAN_HPP_STORAGE_API __attribute__( ( visibility( "default" ) ) )
# else
# define VULKAN_HPP_STORAGE_API
# endif
# else
# define VULKAN_HPP_STORAGE_API
# pragma warning Unknown import / export semantics
# endif
# else
# define VULKAN_HPP_STORAGE_API
# endif
#endif
#if !defined( VULKAN_HPP_DEFAULT_DISPATCHER )
# if VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1
# define VULKAN_HPP_DEFAULT_DISPATCHER ::VULKAN_HPP_NAMESPACE::defaultDispatchLoaderDynamic
# define VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE \
namespace VULKAN_HPP_NAMESPACE \
{ \
VULKAN_HPP_STORAGE_API DispatchLoaderDynamic defaultDispatchLoaderDynamic; \
}
extern VULKAN_HPP_STORAGE_API DispatchLoaderDynamic defaultDispatchLoaderDynamic;
# else
inline ::VULKAN_HPP_NAMESPACE::DispatchLoaderStatic & getDispatchLoaderStatic()
{
static ::VULKAN_HPP_NAMESPACE::DispatchLoaderStatic dls;
return dls;
}
# define VULKAN_HPP_DEFAULT_DISPATCHER ::VULKAN_HPP_NAMESPACE::getDispatchLoaderStatic()
# define VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE
# endif
#endif
#if !defined( VULKAN_HPP_DEFAULT_DISPATCHER_TYPE )
# if VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1
# define VULKAN_HPP_DEFAULT_DISPATCHER_TYPE ::VULKAN_HPP_NAMESPACE::DispatchLoaderDynamic
# else
# define VULKAN_HPP_DEFAULT_DISPATCHER_TYPE ::VULKAN_HPP_NAMESPACE::DispatchLoaderStatic
# endif
#endif
#if defined( VULKAN_HPP_NO_DEFAULT_DISPATCHER )
# define VULKAN_HPP_DEFAULT_ARGUMENT_ASSIGNMENT
# define VULKAN_HPP_DEFAULT_ARGUMENT_NULLPTR_ASSIGNMENT
# define VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT
#else
# define VULKAN_HPP_DEFAULT_ARGUMENT_ASSIGNMENT = {}
# define VULKAN_HPP_DEFAULT_ARGUMENT_NULLPTR_ASSIGNMENT = nullptr
# define VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT = VULKAN_HPP_DEFAULT_DISPATCHER
#endif
#if !defined( VULKAN_HPP_NO_SMART_HANDLE )
@ -15517,6 +15276,33 @@ namespace VULKAN_HPP_NAMESPACE
init( getInstanceProcAddr );
}
// This interface does not require a linked vulkan library.
DispatchLoaderDynamic( VkInstance instance,
PFN_vkGetInstanceProcAddr getInstanceProcAddr,
VkDevice device = {},
PFN_vkGetDeviceProcAddr getDeviceProcAddr = nullptr ) VULKAN_HPP_NOEXCEPT
{
init( instance, getInstanceProcAddr, device, getDeviceProcAddr );
}
template <typename DynamicLoader
#if VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL
= VULKAN_HPP_NAMESPACE::DynamicLoader
#endif
>
void init()
{
static DynamicLoader dl;
init( dl );
}
template <typename DynamicLoader>
void init( DynamicLoader const & dl ) VULKAN_HPP_NOEXCEPT
{
PFN_vkGetInstanceProcAddr getInstanceProcAddr = dl.template getProcAddress<PFN_vkGetInstanceProcAddr>( "vkGetInstanceProcAddr" );
init( getInstanceProcAddr );
}
void init( PFN_vkGetInstanceProcAddr getInstanceProcAddr ) VULKAN_HPP_NOEXCEPT
{
VULKAN_HPP_ASSERT( getInstanceProcAddr );
@ -15533,15 +15319,6 @@ namespace VULKAN_HPP_NAMESPACE
vkEnumerateInstanceVersion = PFN_vkEnumerateInstanceVersion( vkGetInstanceProcAddr( NULL, "vkEnumerateInstanceVersion" ) );
}
// This interface does not require a linked vulkan library.
DispatchLoaderDynamic( VkInstance instance,
PFN_vkGetInstanceProcAddr getInstanceProcAddr,
VkDevice device = {},
PFN_vkGetDeviceProcAddr getDeviceProcAddr = nullptr ) VULKAN_HPP_NOEXCEPT
{
init( instance, getInstanceProcAddr, device, getDeviceProcAddr );
}
// This interface does not require a linked vulkan library.
void init( VkInstance instance,
PFN_vkGetInstanceProcAddr getInstanceProcAddr,

View File

@ -0,0 +1,271 @@
// Copyright 2015-2023 The Khronos Group Inc.
//
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
// This header is generated from the Khronos Vulkan XML API Registry.
#ifndef VULKAN_HPP_MACROS_HPP
#define VULKAN_HPP_MACROS_HPP
#if defined( _MSVC_LANG )
# define VULKAN_HPP_CPLUSPLUS _MSVC_LANG
#else
# define VULKAN_HPP_CPLUSPLUS __cplusplus
#endif
#if 201703L < VULKAN_HPP_CPLUSPLUS
# define VULKAN_HPP_CPP_VERSION 20
#elif 201402L < VULKAN_HPP_CPLUSPLUS
# define VULKAN_HPP_CPP_VERSION 17
#elif 201103L < VULKAN_HPP_CPLUSPLUS
# define VULKAN_HPP_CPP_VERSION 14
#elif 199711L < VULKAN_HPP_CPLUSPLUS
# define VULKAN_HPP_CPP_VERSION 11
#else
# error "vulkan.hpp needs at least c++ standard version 11"
#endif
#if defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
# if !defined( VULKAN_HPP_NO_SMART_HANDLE )
# define VULKAN_HPP_NO_SMART_HANDLE
# endif
#endif
#if defined( VULKAN_HPP_NO_CONSTRUCTORS )
# if !defined( VULKAN_HPP_NO_STRUCT_CONSTRUCTORS )
# define VULKAN_HPP_NO_STRUCT_CONSTRUCTORS
# endif
# if !defined( VULKAN_HPP_NO_UNION_CONSTRUCTORS )
# define VULKAN_HPP_NO_UNION_CONSTRUCTORS
# endif
#endif
#if defined( VULKAN_HPP_NO_SETTERS )
# if !defined( VULKAN_HPP_NO_STRUCT_SETTERS )
# define VULKAN_HPP_NO_STRUCT_SETTERS
# endif
# if !defined( VULKAN_HPP_NO_UNION_SETTERS )
# define VULKAN_HPP_NO_UNION_SETTERS
# endif
#endif
#if !defined( VULKAN_HPP_ASSERT )
# define VULKAN_HPP_ASSERT assert
#endif
#if !defined( VULKAN_HPP_ASSERT_ON_RESULT )
# define VULKAN_HPP_ASSERT_ON_RESULT VULKAN_HPP_ASSERT
#endif
#if !defined( VULKAN_HPP_STATIC_ASSERT )
# define VULKAN_HPP_STATIC_ASSERT static_assert
#endif
#if !defined( VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL )
# define VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL 1
#endif
#if !defined( __has_include )
# define __has_include( x ) false
#endif
#if ( 201907 <= __cpp_lib_three_way_comparison ) && __has_include( <compare> ) && !defined( VULKAN_HPP_NO_SPACESHIP_OPERATOR )
# define VULKAN_HPP_HAS_SPACESHIP_OPERATOR
#endif
#if ( 201803 <= __cpp_lib_span )
# define VULKAN_HPP_SUPPORT_SPAN
#endif
// 32-bit vulkan is not typesafe for non-dispatchable handles, so don't allow copy constructors on this platform by default.
// To enable this feature on 32-bit platforms please define VULKAN_HPP_TYPESAFE_CONVERSION
#if ( VK_USE_64_BIT_PTR_DEFINES == 1 )
# if !defined( VULKAN_HPP_TYPESAFE_CONVERSION )
# define VULKAN_HPP_TYPESAFE_CONVERSION
# endif
#endif
#if defined( __GNUC__ )
# define GCC_VERSION ( __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ )
#endif
#if !defined( VULKAN_HPP_HAS_UNRESTRICTED_UNIONS )
# if defined( __clang__ )
# if __has_feature( cxx_unrestricted_unions )
# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS
# endif
# elif defined( __GNUC__ )
# if 40600 <= GCC_VERSION
# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS
# endif
# elif defined( _MSC_VER )
# if 1900 <= _MSC_VER
# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS
# endif
# endif
#endif
#if !defined( VULKAN_HPP_INLINE )
# if defined( __clang__ )
# if __has_attribute( always_inline )
# define VULKAN_HPP_INLINE __attribute__( ( always_inline ) ) __inline__
# else
# define VULKAN_HPP_INLINE inline
# endif
# elif defined( __GNUC__ )
# define VULKAN_HPP_INLINE __attribute__( ( always_inline ) ) __inline__
# elif defined( _MSC_VER )
# define VULKAN_HPP_INLINE inline
# else
# define VULKAN_HPP_INLINE inline
# endif
#endif
#if defined( VULKAN_HPP_TYPESAFE_CONVERSION )
# define VULKAN_HPP_TYPESAFE_EXPLICIT
#else
# define VULKAN_HPP_TYPESAFE_EXPLICIT explicit
#endif
#if defined( __cpp_constexpr )
# define VULKAN_HPP_CONSTEXPR constexpr
# if 201304 <= __cpp_constexpr
# define VULKAN_HPP_CONSTEXPR_14 constexpr
# else
# define VULKAN_HPP_CONSTEXPR_14
# endif
# if ( 201907 <= __cpp_constexpr ) && ( !defined( __GNUC__ ) || ( 110400 < GCC_VERSION ) )
# define VULKAN_HPP_CONSTEXPR_20 constexpr
# else
# define VULKAN_HPP_CONSTEXPR_20
# endif
# define VULKAN_HPP_CONST_OR_CONSTEXPR constexpr
#else
# define VULKAN_HPP_CONSTEXPR
# define VULKAN_HPP_CONSTEXPR_14
# define VULKAN_HPP_CONST_OR_CONSTEXPR const
#endif
#if !defined( VULKAN_HPP_CONSTEXPR_INLINE )
# if 201606L <= __cpp_inline_variables
# define VULKAN_HPP_CONSTEXPR_INLINE VULKAN_HPP_CONSTEXPR inline
# else
# define VULKAN_HPP_CONSTEXPR_INLINE VULKAN_HPP_CONSTEXPR
# endif
#endif
#if !defined( VULKAN_HPP_NOEXCEPT )
# if defined( _MSC_VER ) && ( _MSC_VER <= 1800 )
# define VULKAN_HPP_NOEXCEPT
# else
# define VULKAN_HPP_NOEXCEPT noexcept
# define VULKAN_HPP_HAS_NOEXCEPT 1
# if defined( VULKAN_HPP_NO_EXCEPTIONS )
# define VULKAN_HPP_NOEXCEPT_WHEN_NO_EXCEPTIONS noexcept
# else
# define VULKAN_HPP_NOEXCEPT_WHEN_NO_EXCEPTIONS
# endif
# endif
#endif
#if 14 <= VULKAN_HPP_CPP_VERSION
# define VULKAN_HPP_DEPRECATED( msg ) [[deprecated( msg )]]
#else
# define VULKAN_HPP_DEPRECATED( msg )
#endif
#if ( 17 <= VULKAN_HPP_CPP_VERSION ) && !defined( VULKAN_HPP_NO_NODISCARD_WARNINGS )
# define VULKAN_HPP_NODISCARD [[nodiscard]]
# if defined( VULKAN_HPP_NO_EXCEPTIONS )
# define VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS [[nodiscard]]
# else
# define VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS
# endif
#else
# define VULKAN_HPP_NODISCARD
# define VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS
#endif
#if !defined( VULKAN_HPP_NAMESPACE )
# define VULKAN_HPP_NAMESPACE vk
#endif
#define VULKAN_HPP_STRINGIFY2( text ) #text
#define VULKAN_HPP_STRINGIFY( text ) VULKAN_HPP_STRINGIFY2( text )
#define VULKAN_HPP_NAMESPACE_STRING VULKAN_HPP_STRINGIFY( VULKAN_HPP_NAMESPACE )
#if !defined( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC )
# if defined( VK_NO_PROTOTYPES )
# define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 1
# else
# define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 0
# endif
#endif
#if !defined( VULKAN_HPP_STORAGE_API )
# if defined( VULKAN_HPP_STORAGE_SHARED )
# if defined( _MSC_VER )
# if defined( VULKAN_HPP_STORAGE_SHARED_EXPORT )
# define VULKAN_HPP_STORAGE_API __declspec( dllexport )
# else
# define VULKAN_HPP_STORAGE_API __declspec( dllimport )
# endif
# elif defined( __clang__ ) || defined( __GNUC__ )
# if defined( VULKAN_HPP_STORAGE_SHARED_EXPORT )
# define VULKAN_HPP_STORAGE_API __attribute__( ( visibility( "default" ) ) )
# else
# define VULKAN_HPP_STORAGE_API
# endif
# else
# define VULKAN_HPP_STORAGE_API
# pragma warning Unknown import / export semantics
# endif
# else
# define VULKAN_HPP_STORAGE_API
# endif
#endif
namespace VULKAN_HPP_NAMESPACE
{
class DispatchLoaderDynamic;
} // namespace VULKAN_HPP_NAMESPACE
#if !defined( VULKAN_HPP_DEFAULT_DISPATCHER )
# if VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1
# define VULKAN_HPP_DEFAULT_DISPATCHER ::VULKAN_HPP_NAMESPACE::defaultDispatchLoaderDynamic
# define VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE \
namespace VULKAN_HPP_NAMESPACE \
{ \
VULKAN_HPP_STORAGE_API ::VULKAN_HPP_NAMESPACE::DispatchLoaderDynamic defaultDispatchLoaderDynamic; \
}
namespace VULKAN_HPP_NAMESPACE
{
extern VULKAN_HPP_STORAGE_API VULKAN_HPP_NAMESPACE::DispatchLoaderDynamic defaultDispatchLoaderDynamic;
} // namespace VULKAN_HPP_NAMESPACE
# else
# define VULKAN_HPP_DEFAULT_DISPATCHER ::VULKAN_HPP_NAMESPACE::getDispatchLoaderStatic()
# define VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE
# endif
#endif
#if !defined( VULKAN_HPP_DEFAULT_DISPATCHER_TYPE )
# if VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1
# define VULKAN_HPP_DEFAULT_DISPATCHER_TYPE ::VULKAN_HPP_NAMESPACE::DispatchLoaderDynamic
# else
# define VULKAN_HPP_DEFAULT_DISPATCHER_TYPE ::VULKAN_HPP_NAMESPACE::DispatchLoaderStatic
# endif
#endif
#if defined( VULKAN_HPP_NO_DEFAULT_DISPATCHER )
# define VULKAN_HPP_DEFAULT_ARGUMENT_ASSIGNMENT
# define VULKAN_HPP_DEFAULT_ARGUMENT_NULLPTR_ASSIGNMENT
# define VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT
#else
# define VULKAN_HPP_DEFAULT_ARGUMENT_ASSIGNMENT = {}
# define VULKAN_HPP_DEFAULT_ARGUMENT_NULLPTR_ASSIGNMENT = nullptr
# define VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT = VULKAN_HPP_DEFAULT_DISPATCHER
#endif
#endif

View File

@ -5,6 +5,9 @@
// This header is generated from the Khronos Vulkan XML API Registry.
// Note: This module is still in an experimental state.
// Any feedback is welcome on https://github.com/KhronosGroup/Vulkan-Hpp/issues.
module;
#include <vulkan/vulkansc.hpp>
@ -13,9 +16,7 @@ module;
#include <vulkan/vulkansc_hash.hpp>
#include <vulkan/vulkansc_raii.hpp>
export module vulkansc;
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE
export module vulkansc_hpp;
export namespace VULKAN_HPP_NAMESPACE
{
@ -25,6 +26,7 @@ export namespace VULKAN_HPP_NAMESPACE
using VULKAN_HPP_NAMESPACE::ArrayWrapper1D;
using VULKAN_HPP_NAMESPACE::ArrayWrapper2D;
using VULKAN_HPP_NAMESPACE::DispatchLoaderBase;
using VULKAN_HPP_NAMESPACE::DispatchLoaderDynamic;
using VULKAN_HPP_NAMESPACE::Flags;
using VULKAN_HPP_NAMESPACE::FlagTraits;
@ -1362,8 +1364,6 @@ export namespace VULKAN_HPP_NAMESPACE
using VULKAN_HPP_NAMESPACE::DynamicLoader;
#endif /*VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL*/
using VULKAN_HPP_NAMESPACE::DispatchLoaderDynamic;
//=====================
//=== Format Traits ===
//=====================

View File

@ -8,37 +8,17 @@
#ifndef VULKAN_HPP
#define VULKAN_HPP
#if defined( _MSVC_LANG )
# define VULKAN_HPP_CPLUSPLUS _MSVC_LANG
#else
# define VULKAN_HPP_CPLUSPLUS __cplusplus
#endif
#if 201703L < VULKAN_HPP_CPLUSPLUS
# define VULKAN_HPP_CPP_VERSION 20
#elif 201402L < VULKAN_HPP_CPLUSPLUS
# define VULKAN_HPP_CPP_VERSION 17
#elif 201103L < VULKAN_HPP_CPLUSPLUS
# define VULKAN_HPP_CPP_VERSION 14
#elif 199711L < VULKAN_HPP_CPLUSPLUS
# define VULKAN_HPP_CPP_VERSION 11
#else
# error "vulkansc.hpp needs at least c++ standard version 11"
#endif
#include <algorithm>
#include <array> // ArrayWrapperND
#include <string> // std::string
#include <vulkan/vulkan_hpp_macros.hpp>
#include <vulkan/vulkan_sc_core.h>
#if 17 <= VULKAN_HPP_CPP_VERSION
# include <string_view> // std::string_view
#endif
#if defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
# if !defined( VULKAN_HPP_NO_SMART_HANDLE )
# define VULKAN_HPP_NO_SMART_HANDLE
# endif
#else
#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
# include <tuple> // std::tie
# include <vector> // std::vector
#endif
@ -47,39 +27,8 @@
# include <system_error> // std::is_error_code_enum
#endif
#if defined( VULKAN_HPP_NO_CONSTRUCTORS )
# if !defined( VULKAN_HPP_NO_STRUCT_CONSTRUCTORS )
# define VULKAN_HPP_NO_STRUCT_CONSTRUCTORS
# endif
# if !defined( VULKAN_HPP_NO_UNION_CONSTRUCTORS )
# define VULKAN_HPP_NO_UNION_CONSTRUCTORS
# endif
#endif
#if defined( VULKAN_HPP_NO_SETTERS )
# if !defined( VULKAN_HPP_NO_STRUCT_SETTERS )
# define VULKAN_HPP_NO_STRUCT_SETTERS
# endif
# if !defined( VULKAN_HPP_NO_UNION_SETTERS )
# define VULKAN_HPP_NO_UNION_SETTERS
# endif
#endif
#if !defined( VULKAN_HPP_ASSERT )
#if ( VULKAN_HPP_ASSERT == assert )
# include <cassert>
# define VULKAN_HPP_ASSERT assert
#endif
#if !defined( VULKAN_HPP_ASSERT_ON_RESULT )
# define VULKAN_HPP_ASSERT_ON_RESULT VULKAN_HPP_ASSERT
#endif
#if !defined( VULKAN_HPP_STATIC_ASSERT )
# define VULKAN_HPP_STATIC_ASSERT static_assert
#endif
#if !defined( VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL )
# define VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL 1
#endif
#if VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL == 1
@ -98,32 +47,16 @@ extern "C" __declspec( dllimport ) FARPROC __stdcall GetProcAddress( HINSTANCE h
# endif
#endif
#if !defined( __has_include )
# define __has_include( x ) false
#endif
#if ( 201907 <= __cpp_lib_three_way_comparison ) && __has_include( <compare> ) && !defined( VULKAN_HPP_NO_SPACESHIP_OPERATOR )
# define VULKAN_HPP_HAS_SPACESHIP_OPERATOR
#endif
#if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR )
# include <compare>
#endif
#if ( 201803 <= __cpp_lib_span )
# define VULKAN_HPP_SUPPORT_SPAN
#if defined( VULKAN_HPP_SUPPORT_SPAN )
# include <span>
#endif
static_assert( VK_HEADER_VERSION == 12, "Wrong VK_HEADER_VERSION!" );
// 32-bit vulkan is not typesafe for non-dispatchable handles, so don't allow copy constructors on this platform by default.
// To enable this feature on 32-bit platforms please define VULKAN_HPP_TYPESAFE_CONVERSION
#if ( VK_USE_64_BIT_PTR_DEFINES == 1 )
# if !defined( VULKAN_HPP_TYPESAFE_CONVERSION )
# define VULKAN_HPP_TYPESAFE_CONVERSION
# endif
#endif
// <tuple> includes <sys/sysmacros.h> through some other header
// this results in major(x) being resolved to gnu_dev_major(x)
// which is an expression in a constructor initializer list.
@ -151,115 +84,6 @@ constexpr int True = 1;
constexpr int False = 0;
#endif
#if defined( __GNUC__ )
# define GCC_VERSION ( __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ )
#endif
#if !defined( VULKAN_HPP_HAS_UNRESTRICTED_UNIONS )
# if defined( __clang__ )
# if __has_feature( cxx_unrestricted_unions )
# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS
# endif
# elif defined( __GNUC__ )
# if 40600 <= GCC_VERSION
# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS
# endif
# elif defined( _MSC_VER )
# if 1900 <= _MSC_VER
# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS
# endif
# endif
#endif
#if !defined( VULKAN_HPP_INLINE )
# if defined( __clang__ )
# if __has_attribute( always_inline )
# define VULKAN_HPP_INLINE __attribute__( ( always_inline ) ) __inline__
# else
# define VULKAN_HPP_INLINE inline
# endif
# elif defined( __GNUC__ )
# define VULKAN_HPP_INLINE __attribute__( ( always_inline ) ) __inline__
# elif defined( _MSC_VER )
# define VULKAN_HPP_INLINE inline
# else
# define VULKAN_HPP_INLINE inline
# endif
#endif
#if defined( VULKAN_HPP_TYPESAFE_CONVERSION )
# define VULKAN_HPP_TYPESAFE_EXPLICIT
#else
# define VULKAN_HPP_TYPESAFE_EXPLICIT explicit
#endif
#if defined( __cpp_constexpr )
# define VULKAN_HPP_CONSTEXPR constexpr
# if 201304 <= __cpp_constexpr
# define VULKAN_HPP_CONSTEXPR_14 constexpr
# else
# define VULKAN_HPP_CONSTEXPR_14
# endif
# if ( 201907 <= __cpp_constexpr ) && ( !defined( __GNUC__ ) || ( 110400 < GCC_VERSION ) )
# define VULKAN_HPP_CONSTEXPR_20 constexpr
# else
# define VULKAN_HPP_CONSTEXPR_20
# endif
# define VULKAN_HPP_CONST_OR_CONSTEXPR constexpr
#else
# define VULKAN_HPP_CONSTEXPR
# define VULKAN_HPP_CONSTEXPR_14
# define VULKAN_HPP_CONST_OR_CONSTEXPR const
#endif
#if !defined( VULKAN_HPP_CONSTEXPR_INLINE )
# if 201606L <= __cpp_inline_variables
# define VULKAN_HPP_CONSTEXPR_INLINE VULKAN_HPP_CONSTEXPR inline
# else
# define VULKAN_HPP_CONSTEXPR_INLINE VULKAN_HPP_CONSTEXPR
# endif
#endif
#if !defined( VULKAN_HPP_NOEXCEPT )
# if defined( _MSC_VER ) && ( _MSC_VER <= 1800 )
# define VULKAN_HPP_NOEXCEPT
# else
# define VULKAN_HPP_NOEXCEPT noexcept
# define VULKAN_HPP_HAS_NOEXCEPT 1
# if defined( VULKAN_HPP_NO_EXCEPTIONS )
# define VULKAN_HPP_NOEXCEPT_WHEN_NO_EXCEPTIONS noexcept
# else
# define VULKAN_HPP_NOEXCEPT_WHEN_NO_EXCEPTIONS
# endif
# endif
#endif
#if 14 <= VULKAN_HPP_CPP_VERSION
# define VULKAN_HPP_DEPRECATED( msg ) [[deprecated( msg )]]
#else
# define VULKAN_HPP_DEPRECATED( msg )
#endif
#if ( 17 <= VULKAN_HPP_CPP_VERSION ) && !defined( VULKAN_HPP_NO_NODISCARD_WARNINGS )
# define VULKAN_HPP_NODISCARD [[nodiscard]]
# if defined( VULKAN_HPP_NO_EXCEPTIONS )
# define VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS [[nodiscard]]
# else
# define VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS
# endif
#else
# define VULKAN_HPP_NODISCARD
# define VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS
#endif
#if !defined( VULKAN_HPP_NAMESPACE )
# define VULKAN_HPP_NAMESPACE vk
#endif
#define VULKAN_HPP_STRINGIFY2( text ) #text
#define VULKAN_HPP_STRINGIFY( text ) VULKAN_HPP_STRINGIFY2( text )
#define VULKAN_HPP_NAMESPACE_STRING VULKAN_HPP_STRINGIFY( VULKAN_HPP_NAMESPACE )
namespace VULKAN_HPP_NAMESPACE
{
template <typename T, size_t N>
@ -3513,77 +3337,12 @@ namespace VULKAN_HPP_NAMESPACE
}
# endif /*VK_USE_PLATFORM_SCREEN_QNX*/
};
#endif
class DispatchLoaderDynamic;
#if !defined( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC )
# if defined( VK_NO_PROTOTYPES )
# define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 1
# else
# define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 0
# endif
#endif
#if !defined( VULKAN_HPP_STORAGE_API )
# if defined( VULKAN_HPP_STORAGE_SHARED )
# if defined( _MSC_VER )
# if defined( VULKAN_HPP_STORAGE_SHARED_EXPORT )
# define VULKAN_HPP_STORAGE_API __declspec( dllexport )
# else
# define VULKAN_HPP_STORAGE_API __declspec( dllimport )
# endif
# elif defined( __clang__ ) || defined( __GNUC__ )
# if defined( VULKAN_HPP_STORAGE_SHARED_EXPORT )
# define VULKAN_HPP_STORAGE_API __attribute__( ( visibility( "default" ) ) )
# else
# define VULKAN_HPP_STORAGE_API
# endif
# else
# define VULKAN_HPP_STORAGE_API
# pragma warning Unknown import / export semantics
# endif
# else
# define VULKAN_HPP_STORAGE_API
# endif
#endif
#if !defined( VULKAN_HPP_DEFAULT_DISPATCHER )
# if VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1
# define VULKAN_HPP_DEFAULT_DISPATCHER ::VULKAN_HPP_NAMESPACE::defaultDispatchLoaderDynamic
# define VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE \
namespace VULKAN_HPP_NAMESPACE \
{ \
VULKAN_HPP_STORAGE_API DispatchLoaderDynamic defaultDispatchLoaderDynamic; \
}
extern VULKAN_HPP_STORAGE_API DispatchLoaderDynamic defaultDispatchLoaderDynamic;
# else
inline ::VULKAN_HPP_NAMESPACE::DispatchLoaderStatic & getDispatchLoaderStatic()
{
static ::VULKAN_HPP_NAMESPACE::DispatchLoaderStatic dls;
return dls;
}
# define VULKAN_HPP_DEFAULT_DISPATCHER ::VULKAN_HPP_NAMESPACE::getDispatchLoaderStatic()
# define VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE
# endif
#endif
#if !defined( VULKAN_HPP_DEFAULT_DISPATCHER_TYPE )
# if VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1
# define VULKAN_HPP_DEFAULT_DISPATCHER_TYPE ::VULKAN_HPP_NAMESPACE::DispatchLoaderDynamic
# else
# define VULKAN_HPP_DEFAULT_DISPATCHER_TYPE ::VULKAN_HPP_NAMESPACE::DispatchLoaderStatic
# endif
#endif
#if defined( VULKAN_HPP_NO_DEFAULT_DISPATCHER )
# define VULKAN_HPP_DEFAULT_ARGUMENT_ASSIGNMENT
# define VULKAN_HPP_DEFAULT_ARGUMENT_NULLPTR_ASSIGNMENT
# define VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT
#else
# define VULKAN_HPP_DEFAULT_ARGUMENT_ASSIGNMENT = {}
# define VULKAN_HPP_DEFAULT_ARGUMENT_NULLPTR_ASSIGNMENT = nullptr
# define VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT = VULKAN_HPP_DEFAULT_DISPATCHER
#endif
#if !defined( VULKAN_HPP_NO_SMART_HANDLE )
@ -7554,6 +7313,33 @@ namespace VULKAN_HPP_NAMESPACE
init( getInstanceProcAddr );
}
// This interface does not require a linked vulkan library.
DispatchLoaderDynamic( VkInstance instance,
PFN_vkGetInstanceProcAddr getInstanceProcAddr,
VkDevice device = {},
PFN_vkGetDeviceProcAddr getDeviceProcAddr = nullptr ) VULKAN_HPP_NOEXCEPT
{
init( instance, getInstanceProcAddr, device, getDeviceProcAddr );
}
template <typename DynamicLoader
#if VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL
= VULKAN_HPP_NAMESPACE::DynamicLoader
#endif
>
void init()
{
static DynamicLoader dl;
init( dl );
}
template <typename DynamicLoader>
void init( DynamicLoader const & dl ) VULKAN_HPP_NOEXCEPT
{
PFN_vkGetInstanceProcAddr getInstanceProcAddr = dl.template getProcAddress<PFN_vkGetInstanceProcAddr>( "vkGetInstanceProcAddr" );
init( getInstanceProcAddr );
}
void init( PFN_vkGetInstanceProcAddr getInstanceProcAddr ) VULKAN_HPP_NOEXCEPT
{
VULKAN_HPP_ASSERT( getInstanceProcAddr );
@ -7570,15 +7356,6 @@ namespace VULKAN_HPP_NAMESPACE
vkEnumerateInstanceVersion = PFN_vkEnumerateInstanceVersion( vkGetInstanceProcAddr( NULL, "vkEnumerateInstanceVersion" ) );
}
// This interface does not require a linked vulkan library.
DispatchLoaderDynamic( VkInstance instance,
PFN_vkGetInstanceProcAddr getInstanceProcAddr,
VkDevice device = {},
PFN_vkGetDeviceProcAddr getDeviceProcAddr = nullptr ) VULKAN_HPP_NOEXCEPT
{
init( instance, getInstanceProcAddr, device, getDeviceProcAddr );
}
// This interface does not require a linked vulkan library.
void init( VkInstance instance,
PFN_vkGetInstanceProcAddr getInstanceProcAddr,

View File

@ -0,0 +1,271 @@
// Copyright 2015-2023 The Khronos Group Inc.
//
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
// This header is generated from the Khronos Vulkan XML API Registry.
#ifndef VULKAN_HPP_MACROS_HPP
#define VULKAN_HPP_MACROS_HPP
#if defined( _MSVC_LANG )
# define VULKAN_HPP_CPLUSPLUS _MSVC_LANG
#else
# define VULKAN_HPP_CPLUSPLUS __cplusplus
#endif
#if 201703L < VULKAN_HPP_CPLUSPLUS
# define VULKAN_HPP_CPP_VERSION 20
#elif 201402L < VULKAN_HPP_CPLUSPLUS
# define VULKAN_HPP_CPP_VERSION 17
#elif 201103L < VULKAN_HPP_CPLUSPLUS
# define VULKAN_HPP_CPP_VERSION 14
#elif 199711L < VULKAN_HPP_CPLUSPLUS
# define VULKAN_HPP_CPP_VERSION 11
#else
# error "vulkansc.hpp needs at least c++ standard version 11"
#endif
#if defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
# if !defined( VULKAN_HPP_NO_SMART_HANDLE )
# define VULKAN_HPP_NO_SMART_HANDLE
# endif
#endif
#if defined( VULKAN_HPP_NO_CONSTRUCTORS )
# if !defined( VULKAN_HPP_NO_STRUCT_CONSTRUCTORS )
# define VULKAN_HPP_NO_STRUCT_CONSTRUCTORS
# endif
# if !defined( VULKAN_HPP_NO_UNION_CONSTRUCTORS )
# define VULKAN_HPP_NO_UNION_CONSTRUCTORS
# endif
#endif
#if defined( VULKAN_HPP_NO_SETTERS )
# if !defined( VULKAN_HPP_NO_STRUCT_SETTERS )
# define VULKAN_HPP_NO_STRUCT_SETTERS
# endif
# if !defined( VULKAN_HPP_NO_UNION_SETTERS )
# define VULKAN_HPP_NO_UNION_SETTERS
# endif
#endif
#if !defined( VULKAN_HPP_ASSERT )
# define VULKAN_HPP_ASSERT assert
#endif
#if !defined( VULKAN_HPP_ASSERT_ON_RESULT )
# define VULKAN_HPP_ASSERT_ON_RESULT VULKAN_HPP_ASSERT
#endif
#if !defined( VULKAN_HPP_STATIC_ASSERT )
# define VULKAN_HPP_STATIC_ASSERT static_assert
#endif
#if !defined( VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL )
# define VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL 1
#endif
#if !defined( __has_include )
# define __has_include( x ) false
#endif
#if ( 201907 <= __cpp_lib_three_way_comparison ) && __has_include( <compare> ) && !defined( VULKAN_HPP_NO_SPACESHIP_OPERATOR )
# define VULKAN_HPP_HAS_SPACESHIP_OPERATOR
#endif
#if ( 201803 <= __cpp_lib_span )
# define VULKAN_HPP_SUPPORT_SPAN
#endif
// 32-bit vulkan is not typesafe for non-dispatchable handles, so don't allow copy constructors on this platform by default.
// To enable this feature on 32-bit platforms please define VULKAN_HPP_TYPESAFE_CONVERSION
#if ( VK_USE_64_BIT_PTR_DEFINES == 1 )
# if !defined( VULKAN_HPP_TYPESAFE_CONVERSION )
# define VULKAN_HPP_TYPESAFE_CONVERSION
# endif
#endif
#if defined( __GNUC__ )
# define GCC_VERSION ( __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ )
#endif
#if !defined( VULKAN_HPP_HAS_UNRESTRICTED_UNIONS )
# if defined( __clang__ )
# if __has_feature( cxx_unrestricted_unions )
# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS
# endif
# elif defined( __GNUC__ )
# if 40600 <= GCC_VERSION
# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS
# endif
# elif defined( _MSC_VER )
# if 1900 <= _MSC_VER
# define VULKAN_HPP_HAS_UNRESTRICTED_UNIONS
# endif
# endif
#endif
#if !defined( VULKAN_HPP_INLINE )
# if defined( __clang__ )
# if __has_attribute( always_inline )
# define VULKAN_HPP_INLINE __attribute__( ( always_inline ) ) __inline__
# else
# define VULKAN_HPP_INLINE inline
# endif
# elif defined( __GNUC__ )
# define VULKAN_HPP_INLINE __attribute__( ( always_inline ) ) __inline__
# elif defined( _MSC_VER )
# define VULKAN_HPP_INLINE inline
# else
# define VULKAN_HPP_INLINE inline
# endif
#endif
#if defined( VULKAN_HPP_TYPESAFE_CONVERSION )
# define VULKAN_HPP_TYPESAFE_EXPLICIT
#else
# define VULKAN_HPP_TYPESAFE_EXPLICIT explicit
#endif
#if defined( __cpp_constexpr )
# define VULKAN_HPP_CONSTEXPR constexpr
# if 201304 <= __cpp_constexpr
# define VULKAN_HPP_CONSTEXPR_14 constexpr
# else
# define VULKAN_HPP_CONSTEXPR_14
# endif
# if ( 201907 <= __cpp_constexpr ) && ( !defined( __GNUC__ ) || ( 110400 < GCC_VERSION ) )
# define VULKAN_HPP_CONSTEXPR_20 constexpr
# else
# define VULKAN_HPP_CONSTEXPR_20
# endif
# define VULKAN_HPP_CONST_OR_CONSTEXPR constexpr
#else
# define VULKAN_HPP_CONSTEXPR
# define VULKAN_HPP_CONSTEXPR_14
# define VULKAN_HPP_CONST_OR_CONSTEXPR const
#endif
#if !defined( VULKAN_HPP_CONSTEXPR_INLINE )
# if 201606L <= __cpp_inline_variables
# define VULKAN_HPP_CONSTEXPR_INLINE VULKAN_HPP_CONSTEXPR inline
# else
# define VULKAN_HPP_CONSTEXPR_INLINE VULKAN_HPP_CONSTEXPR
# endif
#endif
#if !defined( VULKAN_HPP_NOEXCEPT )
# if defined( _MSC_VER ) && ( _MSC_VER <= 1800 )
# define VULKAN_HPP_NOEXCEPT
# else
# define VULKAN_HPP_NOEXCEPT noexcept
# define VULKAN_HPP_HAS_NOEXCEPT 1
# if defined( VULKAN_HPP_NO_EXCEPTIONS )
# define VULKAN_HPP_NOEXCEPT_WHEN_NO_EXCEPTIONS noexcept
# else
# define VULKAN_HPP_NOEXCEPT_WHEN_NO_EXCEPTIONS
# endif
# endif
#endif
#if 14 <= VULKAN_HPP_CPP_VERSION
# define VULKAN_HPP_DEPRECATED( msg ) [[deprecated( msg )]]
#else
# define VULKAN_HPP_DEPRECATED( msg )
#endif
#if ( 17 <= VULKAN_HPP_CPP_VERSION ) && !defined( VULKAN_HPP_NO_NODISCARD_WARNINGS )
# define VULKAN_HPP_NODISCARD [[nodiscard]]
# if defined( VULKAN_HPP_NO_EXCEPTIONS )
# define VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS [[nodiscard]]
# else
# define VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS
# endif
#else
# define VULKAN_HPP_NODISCARD
# define VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS
#endif
#if !defined( VULKAN_HPP_NAMESPACE )
# define VULKAN_HPP_NAMESPACE vk
#endif
#define VULKAN_HPP_STRINGIFY2( text ) #text
#define VULKAN_HPP_STRINGIFY( text ) VULKAN_HPP_STRINGIFY2( text )
#define VULKAN_HPP_NAMESPACE_STRING VULKAN_HPP_STRINGIFY( VULKAN_HPP_NAMESPACE )
#if !defined( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC )
# if defined( VK_NO_PROTOTYPES )
# define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 1
# else
# define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 0
# endif
#endif
#if !defined( VULKAN_HPP_STORAGE_API )
# if defined( VULKAN_HPP_STORAGE_SHARED )
# if defined( _MSC_VER )
# if defined( VULKAN_HPP_STORAGE_SHARED_EXPORT )
# define VULKAN_HPP_STORAGE_API __declspec( dllexport )
# else
# define VULKAN_HPP_STORAGE_API __declspec( dllimport )
# endif
# elif defined( __clang__ ) || defined( __GNUC__ )
# if defined( VULKAN_HPP_STORAGE_SHARED_EXPORT )
# define VULKAN_HPP_STORAGE_API __attribute__( ( visibility( "default" ) ) )
# else
# define VULKAN_HPP_STORAGE_API
# endif
# else
# define VULKAN_HPP_STORAGE_API
# pragma warning Unknown import / export semantics
# endif
# else
# define VULKAN_HPP_STORAGE_API
# endif
#endif
namespace VULKAN_HPP_NAMESPACE
{
class DispatchLoaderDynamic;
} // namespace VULKAN_HPP_NAMESPACE
#if !defined( VULKAN_HPP_DEFAULT_DISPATCHER )
# if VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1
# define VULKAN_HPP_DEFAULT_DISPATCHER ::VULKAN_HPP_NAMESPACE::defaultDispatchLoaderDynamic
# define VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE \
namespace VULKAN_HPP_NAMESPACE \
{ \
VULKAN_HPP_STORAGE_API ::VULKAN_HPP_NAMESPACE::DispatchLoaderDynamic defaultDispatchLoaderDynamic; \
}
namespace VULKAN_HPP_NAMESPACE
{
extern VULKAN_HPP_STORAGE_API VULKAN_HPP_NAMESPACE::DispatchLoaderDynamic defaultDispatchLoaderDynamic;
} // namespace VULKAN_HPP_NAMESPACE
# else
# define VULKAN_HPP_DEFAULT_DISPATCHER ::VULKAN_HPP_NAMESPACE::getDispatchLoaderStatic()
# define VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE
# endif
#endif
#if !defined( VULKAN_HPP_DEFAULT_DISPATCHER_TYPE )
# if VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1
# define VULKAN_HPP_DEFAULT_DISPATCHER_TYPE ::VULKAN_HPP_NAMESPACE::DispatchLoaderDynamic
# else
# define VULKAN_HPP_DEFAULT_DISPATCHER_TYPE ::VULKAN_HPP_NAMESPACE::DispatchLoaderStatic
# endif
#endif
#if defined( VULKAN_HPP_NO_DEFAULT_DISPATCHER )
# define VULKAN_HPP_DEFAULT_ARGUMENT_ASSIGNMENT
# define VULKAN_HPP_DEFAULT_ARGUMENT_NULLPTR_ASSIGNMENT
# define VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT
#else
# define VULKAN_HPP_DEFAULT_ARGUMENT_ASSIGNMENT = {}
# define VULKAN_HPP_DEFAULT_ARGUMENT_NULLPTR_ASSIGNMENT = nullptr
# define VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT = VULKAN_HPP_DEFAULT_DISPATCHER
#endif
#endif