Use import std; guarded by macro (#1932)
Some checks are pending
Set Version Tag / set-version-tag (push) Waiting to run

* Initial build and tests setup

* Enable the `CppStdModule` test

* Snippets and generator changes

* Generated files changes

* Enable std module with macro

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

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

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

* Top-level CMake changes

* Reorganise logic, and propagate external macro correctly

* RAII: vulkan_hpp before ifdef

* Define `VK_USE_64_BIT_PTR_DEFINES` in `vulkan_hpp_macros.hpp`

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

* Refactored handling for `VK_USE_64_BIT_PTR_DEFINES`

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

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

* Use only `std.compat`

* FIx after rebase
This commit is contained in:
Sharadh Rajaraman 2024-09-05 07:48:19 +01:00 committed by GitHub
parent 7d423e64bf
commit 6abd3f42a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
22 changed files with 286 additions and 76 deletions

View File

@ -37,6 +37,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_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_BUILD_WITH_LOCAL_VULKAN_HPP "Build with local Vulkan headers" ON )
option( VULKAN_HPP_ENABLE_CPP20_MODULES "Build Vulkan-Hpp as C++20 module; requires minimum CMake version 3.28" OFF ) option( VULKAN_HPP_ENABLE_CPP20_MODULES "Build Vulkan-Hpp as C++20 module; requires minimum CMake version 3.28" OFF )
option( VULKAN_HPP_ENABLE_STD_MODULE "Build Vulkan-Hpp with import std; requires minimum CMake version 3.30" OFF )
option( VULKAN_HPP_CPP20_MODULE_DYNAMIC_DISPATCHER "Build C++20 module with dynamic Dispatcher" ON ) option( VULKAN_HPP_CPP20_MODULE_DYNAMIC_DISPATCHER "Build C++20 module with dynamic Dispatcher" ON )
if ( VULKAN_HPP_ENABLE_CPP20_MODULES ) if ( VULKAN_HPP_ENABLE_CPP20_MODULES )
@ -346,7 +347,12 @@ if( VULKAN_HPP_ENABLE_CPP20_MODULES )
else() else()
target_compile_definitions( VulkanHppModule PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=0 ) target_compile_definitions( VulkanHppModule PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=0 )
endif() endif()
target_compile_features( VulkanHppModule PUBLIC cxx_std_20 ) if( VULKAN_HPP_ENABLE_STD_MODULE )
target_compile_features( VulkanHppModule PUBLIC cxx_std_23 )
set_target_properties( VulkanHppModule PROPERTIES CXX_MODULE_STD ON )
else()
target_compile_features( VulkanHppModule PUBLIC cxx_std_20 )
endif()
target_sources( VulkanHppModule target_sources( VulkanHppModule
PUBLIC PUBLIC
FILE_SET vulkan_module_file BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} TYPE CXX_MODULES FILES vulkan/vulkan.cppm ) FILE_SET vulkan_module_file BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} TYPE CXX_MODULES FILES vulkan/vulkan.cppm )

View File

@ -130,11 +130,15 @@ void VulkanHppGenerator::generateExtensionInspectionFile() const
#ifndef VULKAN_EXTENSION_INSPECTION_HPP #ifndef VULKAN_EXTENSION_INSPECTION_HPP
# define VULKAN_EXTENSION_INSPECTION_HPP # define VULKAN_EXTENSION_INSPECTION_HPP
#include <map> #if defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE )
#include <set> import VULKAN_HPP_STD_MODULE;
#include <string> #else
#include <vector> # include <map>
#include <vulkan/${api}.hpp> # include <set>
# include <string>
# include <vector>
# include <vulkan/${api}.hpp>
#endif
namespace VULKAN_HPP_NAMESPACE namespace VULKAN_HPP_NAMESPACE
{ {
@ -578,7 +582,11 @@ ${macros}
std::string str = replaceWithMap( std::string str = replaceWithMap(
macrosTemplate, macrosTemplate,
{ { "licenseHeader", m_vulkanLicenseHeader }, { "macros", replaceWithMap( readSnippet( "macros.hpp" ), { { "vulkan_hpp", m_api + ".hpp" } } ) } } ); { { "licenseHeader", m_vulkanLicenseHeader },
{ "macros",
replaceWithMap( readSnippet( "macros.hpp" ),
{ { "vulkan_hpp", m_api + ".hpp" },
{ "vulkan_64_bit_ptr_defines", m_defines.at( "VK_USE_64_BIT_PTR_DEFINES" ).possibleDefinition } } ) } } );
writeToFile( str, macros_hpp ); writeToFile( str, macros_hpp );
} }
@ -592,9 +600,11 @@ void VulkanHppGenerator::generateRAIIHppFile() const
#ifndef VULKAN_RAII_HPP #ifndef VULKAN_RAII_HPP
#define VULKAN_RAII_HPP #define VULKAN_RAII_HPP
#include <memory> // std::unique_ptr
#include <utility> // std::forward
#include <vulkan/${api}.hpp> #include <vulkan/${api}.hpp>
#if !( defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE ) )
# include <memory> // std::unique_ptr
# include <utility> // std::forward
#endif
#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE ) #if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
namespace VULKAN_HPP_NAMESPACE namespace VULKAN_HPP_NAMESPACE
@ -668,8 +678,10 @@ void VulkanHppGenerator::generateSharedHppFile() const
#define VULKAN_SHARED_HPP #define VULKAN_SHARED_HPP
#include <vulkan/${api}.hpp> #include <vulkan/${api}.hpp>
#include <atomic> // std::atomic_size_t
#if !( defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE ) )
#include <atomic> // std::atomic_size_t
#endif
namespace VULKAN_HPP_NAMESPACE namespace VULKAN_HPP_NAMESPACE
{ {
@ -769,10 +781,14 @@ void VulkanHppGenerator::generateToStringHppFile() const
# pragma warning( disable : 4996 ) # pragma warning( disable : 4996 )
#endif #endif
#if __cpp_lib_format #if defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE )
# include <format> // std::format import VULKAN_HPP_STD_MODULE;
#else #else
# include <sstream> // std::stringstream # if __cpp_lib_format
# include <format> // std::format
# else
# include <sstream> // std::stringstream
# endif
#endif #endif
namespace VULKAN_HPP_NAMESPACE namespace VULKAN_HPP_NAMESPACE
@ -811,6 +827,12 @@ void VulkanHppGenerator::generateCppModuleFile() const
module; module;
#include <vulkan/vulkan_hpp_macros.hpp>
#if defined( __cpp_lib_modules )
#define VULKAN_HPP_ENABLE_STD_MODULE
#endif
#include <vulkan/${api}.hpp> #include <vulkan/${api}.hpp>
#include <vulkan/${api}_extension_inspection.hpp> #include <vulkan/${api}_extension_inspection.hpp>
#include <vulkan/${api}_format_traits.hpp> #include <vulkan/${api}_format_traits.hpp>
@ -16417,6 +16439,12 @@ namespace
std::erase( rawComment, '/' ); std::erase( rawComment, '/' );
auto const strippedComment = trim( stripPostfix( stripPrefix( rawComment, " DEPRECATED:" ), "#define " ) ); auto const strippedComment = trim( stripPostfix( stripPrefix( rawComment, " DEPRECATED:" ), "#define " ) );
// special case for VK_USE_64_BIT_PTR_DEFINES
if ( completeMacro.size() == 1 && completeMacro.front().find( "#ifndef VK_USE_64_BIT_PTR_DEFINES" ) != std::string::npos )
{
return { {}, {}, {}, strippedComment };
}
// macro with parameters and implementation // macro with parameters and implementation
if ( completeMacro.size() == 3 ) if ( completeMacro.size() == 3 )
{ {

View File

@ -1,21 +1,27 @@
#include <algorithm>
#include <array> // ArrayWrapperND
#include <string.h> // strnlen
#include <string> // std::string
#include <utility> // std::exchange
#include <vulkan/${vulkan_h}>
#include <vulkan/vulkan_hpp_macros.hpp> #include <vulkan/vulkan_hpp_macros.hpp>
#if 17 <= VULKAN_HPP_CPP_VERSION #if defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE )
#include <string.h>
import VULKAN_HPP_STD_MODULE;
#else
# include <algorithm>
# include <array> // ArrayWrapperND
# include <string.h> // strnlen
# include <string> // std::string
# include <utility> // std::exchange
#endif
#include <vulkan/${vulkan_h}>
#if 17 <= VULKAN_HPP_CPP_VERSION && !( defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE ) )
# include <string_view> # include <string_view>
#endif #endif
#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE ) #if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE ) && !( defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE ) )
# include <tuple> // std::tie # include <tuple> // std::tie
# include <vector> // std::vector # include <vector> // std::vector
#endif #endif
#if !defined( VULKAN_HPP_NO_EXCEPTIONS ) #if !defined( VULKAN_HPP_NO_EXCEPTIONS ) && !( defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE ) )
# include <system_error> // std::is_error_code_enum # include <system_error> // std::is_error_code_enum
#endif #endif
@ -39,10 +45,10 @@ extern "C" __declspec( dllimport ) FARPROC __stdcall GetProcAddress( HINSTANCE h
# endif # endif
#endif #endif
#if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR ) #if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR ) && !( defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE ) )
# include <compare> # include <compare>
#endif #endif
#if defined( VULKAN_HPP_SUPPORT_SPAN ) #if defined( VULKAN_HPP_SUPPORT_SPAN ) && !( defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE ) )
# include <span> # include <span>
#endif #endif

View File

@ -77,6 +77,12 @@
# define VULKAN_HPP_SUPPORT_SPAN # define VULKAN_HPP_SUPPORT_SPAN
#endif #endif
#if defined( __cpp_lib_modules ) && !defined( VULKAN_HPP_STD_MODULE ) && defined( VULKAN_HPP_ENABLE_STD_MODULE )
# define VULKAN_HPP_STD_MODULE std.compat
#endif
${vulkan_64_bit_ptr_defines}
// 32-bit vulkan is not typesafe for non-dispatchable handles, so don't allow copy constructors on this platform by default. // 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 1 // To enable this feature on 32-bit platforms please #define VULKAN_HPP_TYPESAFE_CONVERSION 1
// To disable this feature on 64-bit platforms please #define VULKAN_HPP_TYPESAFE_CONVERSION 0 // To disable this feature on 64-bit platforms please #define VULKAN_HPP_TYPESAFE_CONVERSION 0
@ -86,7 +92,6 @@
# endif # endif
#endif #endif
#if defined( __GNUC__ ) #if defined( __GNUC__ )
# define GCC_VERSION ( __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ ) # define GCC_VERSION ( __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ )
#endif #endif
@ -276,7 +281,9 @@ namespace VULKAN_HPP_NAMESPACE
#endif #endif
#if !defined( VULKAN_HPP_EXPECTED ) && ( 23 <= VULKAN_HPP_CPP_VERSION ) && defined( __cpp_lib_expected ) #if !defined( VULKAN_HPP_EXPECTED ) && ( 23 <= VULKAN_HPP_CPP_VERSION ) && defined( __cpp_lib_expected )
# include <expected> # if !( defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE ) )
# include <expected>
# endif
# define VULKAN_HPP_EXPECTED std::expected # define VULKAN_HPP_EXPECTED std::expected
# define VULKAN_HPP_UNEXPECTED std::unexpected # define VULKAN_HPP_UNEXPECTED std::unexpected
#endif #endif

View File

@ -15,6 +15,9 @@
add_subdirectory( ArrayProxy ) add_subdirectory( ArrayProxy )
add_subdirectory( ArrayProxyNoTemporaries ) add_subdirectory( ArrayProxyNoTemporaries )
add_subdirectory( ArrayWrapper ) add_subdirectory( ArrayWrapper )
if( VULKAN_HPP_ENABLE_STD_MODULE )
add_subdirectory( CppStdModule )
endif()
if( VULKAN_HPP_ENABLE_CPP20_MODULES ) if( VULKAN_HPP_ENABLE_CPP20_MODULES )
add_subdirectory( Cpp20Modules ) add_subdirectory( Cpp20Modules )
endif() endif()

View File

@ -1,4 +1,4 @@
cmake_minimum_required( VERSION 3.25 ) cmake_minimum_required( VERSION 3.28 )
vulkan_hpp__setup_test( NAME Cpp20Modules CXX_STANDARD 20 LIBRARIES VulkanHppModule NO_UTILS ) vulkan_hpp__setup_test( NAME Cpp20Modules CXX_STANDARD 20 LIBRARIES VulkanHppModule NO_UTILS )
@ -9,6 +9,5 @@ if( NOT VULKAN_HPP_SAMPLES_BUILD_ONLY_DYNAMIC )
target_compile_definitions( Cpp20Modules PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=0 ) target_compile_definitions( Cpp20Modules PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=0 )
endif() endif()
target_link_libraries( Cpp20Modules PRIVATE Vulkan::Vulkan ) target_link_libraries( Cpp20Modules PRIVATE Vulkan::Vulkan )
set_target_properties( Cpp20Modules PROPERTIES CXX_EXTENSIONS OFF set_target_properties( Cpp20Modules PROPERTIES CXX_EXTENSIONS OFF )
)
endif() endif()

View File

@ -0,0 +1,18 @@
cmake_minimum_required( VERSION 3.30 )
target_compile_features( VulkanHppModule PUBLIC cxx_std_23 )
target_compile_definitions( VulkanHppModule PUBLIC VULKAN_HPP_ENABLE_STD_MODULE )
vulkan_hpp__setup_test( NAME CppStdModule CXX_STANDARD 23 LIBRARIES VulkanHppModule NO_UTILS )
target_compile_features( CppStdModule PUBLIC cxx_std_23 )
if( NOT VULKAN_HPP_SAMPLES_BUILD_ONLY_DYNAMIC )
if ( VULKAN_HPP_CPP20_MODULE_DYNAMIC_DISPATCHER )
target_compile_definitions( CppStdModule PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1 )
else()
target_compile_definitions( CppStdModule PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=0 )
endif()
target_link_libraries( CppStdModule PRIVATE Vulkan::Vulkan )
set_target_properties( CppStdModule PROPERTIES CXX_EXTENSIONS OFF )
endif()

View File

@ -0,0 +1,59 @@
import std;
import vulkan_hpp;
#include <vulkan/vulkan_hpp_macros.hpp>
static std::string AppName = "CppStdModule";
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));
// initialize the vk::InstanceCreateInfo
vk::InstanceCreateInfo instanceCreateInfo({}, &applicationInfo);
// 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();
}
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;
}

View File

@ -10,6 +10,12 @@
module; module;
#include <vulkan/vulkan_hpp_macros.hpp>
#if defined( __cpp_lib_modules )
# define VULKAN_HPP_ENABLE_STD_MODULE
#endif
#include <vulkan/vulkan.hpp> #include <vulkan/vulkan.hpp>
#include <vulkan/vulkan_extension_inspection.hpp> #include <vulkan/vulkan_extension_inspection.hpp>
#include <vulkan/vulkan_format_traits.hpp> #include <vulkan/vulkan_format_traits.hpp>
@ -2580,6 +2586,7 @@ export namespace VULKAN_HPP_NAMESPACE
//=== CONSTEXPR VALUEs === //=== CONSTEXPR VALUEs ===
//======================== //========================
using VULKAN_HPP_NAMESPACE::HeaderVersion; using VULKAN_HPP_NAMESPACE::HeaderVersion;
using VULKAN_HPP_NAMESPACE::Use64BitPtrDefines;
//========================= //=========================
//=== CONSTEXPR CALLEEs === //=== CONSTEXPR CALLEEs ===

View File

@ -8,24 +8,30 @@
#ifndef VULKAN_HPP #ifndef VULKAN_HPP
#define VULKAN_HPP #define VULKAN_HPP
#include <algorithm>
#include <array> // ArrayWrapperND
#include <string.h> // strnlen
#include <string> // std::string
#include <utility> // std::exchange
#include <vulkan/vulkan.h>
#include <vulkan/vulkan_hpp_macros.hpp> #include <vulkan/vulkan_hpp_macros.hpp>
#if 17 <= VULKAN_HPP_CPP_VERSION #if defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE )
# include <string.h>
import VULKAN_HPP_STD_MODULE;
#else
# include <algorithm>
# include <array> // ArrayWrapperND
# include <string.h> // strnlen
# include <string> // std::string
# include <utility> // std::exchange
#endif
#include <vulkan/vulkan.h>
#if 17 <= VULKAN_HPP_CPP_VERSION && !( defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE ) )
# include <string_view> # include <string_view>
#endif #endif
#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE ) #if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE ) && !( defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE ) )
# include <tuple> // std::tie # include <tuple> // std::tie
# include <vector> // std::vector # include <vector> // std::vector
#endif #endif
#if !defined( VULKAN_HPP_NO_EXCEPTIONS ) #if !defined( VULKAN_HPP_NO_EXCEPTIONS ) && !( defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE ) )
# include <system_error> // std::is_error_code_enum # include <system_error> // std::is_error_code_enum
#endif #endif
@ -49,11 +55,11 @@ extern "C" __declspec( dllimport ) FARPROC __stdcall GetProcAddress( HINSTANCE h
# endif # endif
#endif #endif
#if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR ) #if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR ) && !( defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE ) )
# include <compare> # include <compare>
#endif #endif
#if defined( VULKAN_HPP_SUPPORT_SPAN ) #if defined( VULKAN_HPP_SUPPORT_SPAN ) && !( defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE ) )
# include <span> # include <span>
#endif #endif
@ -6875,7 +6881,8 @@ namespace VULKAN_HPP_NAMESPACE
//======================== //========================
//=== CONSTEXPR VALUEs === //=== CONSTEXPR VALUEs ===
//======================== //========================
VULKAN_HPP_CONSTEXPR_INLINE uint32_t HeaderVersion = VK_HEADER_VERSION; VULKAN_HPP_CONSTEXPR_INLINE uint32_t HeaderVersion = VK_HEADER_VERSION;
VULKAN_HPP_CONSTEXPR_INLINE uint32_t Use64BitPtrDefines = VK_USE_64_BIT_PTR_DEFINES;
//========================= //=========================
//=== CONSTEXPR CALLEEs === //=== CONSTEXPR CALLEEs ===

View File

@ -8,11 +8,15 @@
#ifndef VULKAN_EXTENSION_INSPECTION_HPP #ifndef VULKAN_EXTENSION_INSPECTION_HPP
#define VULKAN_EXTENSION_INSPECTION_HPP #define VULKAN_EXTENSION_INSPECTION_HPP
#include <map> #if defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE )
#include <set> import VULKAN_HPP_STD_MODULE;
#include <string> #else
#include <vector> # include <map>
#include <vulkan/vulkan.hpp> # include <set>
# include <string>
# include <vector>
# include <vulkan/vulkan.hpp>
#endif
namespace VULKAN_HPP_NAMESPACE namespace VULKAN_HPP_NAMESPACE
{ {

View File

@ -87,6 +87,19 @@
# define VULKAN_HPP_SUPPORT_SPAN # define VULKAN_HPP_SUPPORT_SPAN
#endif #endif
#if defined( __cpp_lib_modules ) && !defined( VULKAN_HPP_STD_MODULE ) && defined( VULKAN_HPP_ENABLE_STD_MODULE )
# define VULKAN_HPP_STD_MODULE std.compat
#endif
#ifndef VK_USE_64_BIT_PTR_DEFINES
# if defined( __LP64__ ) || defined( _WIN64 ) || ( defined( __x86_64__ ) && !defined( __ILP32__ ) ) || defined( _M_X64 ) || defined( __ia64 ) || \
defined( _M_IA64 ) || defined( __aarch64__ ) || defined( __powerpc64__ ) || ( defined( __riscv ) && __riscv_xlen == 64 )
# define VK_USE_64_BIT_PTR_DEFINES 1
# else
# define VK_USE_64_BIT_PTR_DEFINES 0
# endif
#endif
// 32-bit vulkan is not typesafe for non-dispatchable handles, so don't allow copy constructors on this platform by default. // 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 1 // To enable this feature on 32-bit platforms please #define VULKAN_HPP_TYPESAFE_CONVERSION 1
// To disable this feature on 64-bit platforms please #define VULKAN_HPP_TYPESAFE_CONVERSION 0 // To disable this feature on 64-bit platforms please #define VULKAN_HPP_TYPESAFE_CONVERSION 0
@ -285,7 +298,9 @@ namespace VULKAN_HPP_NAMESPACE
#endif #endif
#if !defined( VULKAN_HPP_EXPECTED ) && ( 23 <= VULKAN_HPP_CPP_VERSION ) && defined( __cpp_lib_expected ) #if !defined( VULKAN_HPP_EXPECTED ) && ( 23 <= VULKAN_HPP_CPP_VERSION ) && defined( __cpp_lib_expected )
# include <expected> # if !( defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE ) )
# include <expected>
# endif
# define VULKAN_HPP_EXPECTED std::expected # define VULKAN_HPP_EXPECTED std::expected
# define VULKAN_HPP_UNEXPECTED std::unexpected # define VULKAN_HPP_UNEXPECTED std::unexpected
#endif #endif

View File

@ -8,9 +8,11 @@
#ifndef VULKAN_RAII_HPP #ifndef VULKAN_RAII_HPP
#define VULKAN_RAII_HPP #define VULKAN_RAII_HPP
#include <memory> // std::unique_ptr
#include <utility> // std::forward
#include <vulkan/vulkan.hpp> #include <vulkan/vulkan.hpp>
#if !( defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE ) )
# include <memory> // std::unique_ptr
# include <utility> // std::forward
#endif
#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE ) #if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
namespace VULKAN_HPP_NAMESPACE namespace VULKAN_HPP_NAMESPACE

View File

@ -8,9 +8,12 @@
#ifndef VULKAN_SHARED_HPP #ifndef VULKAN_SHARED_HPP
#define VULKAN_SHARED_HPP #define VULKAN_SHARED_HPP
#include <atomic> // std::atomic_size_t
#include <vulkan/vulkan.hpp> #include <vulkan/vulkan.hpp>
#if !( defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE ) )
# include <atomic> // std::atomic_size_t
#endif
namespace VULKAN_HPP_NAMESPACE namespace VULKAN_HPP_NAMESPACE
{ {
#if !defined( VULKAN_HPP_NO_SMART_HANDLE ) #if !defined( VULKAN_HPP_NO_SMART_HANDLE )

View File

@ -19,10 +19,14 @@
# pragma warning( disable : 4996 ) # pragma warning( disable : 4996 )
#endif #endif
#if __cpp_lib_format #if defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE )
# include <format> // std::format import VULKAN_HPP_STD_MODULE;
#else #else
# include <sstream> // std::stringstream # if __cpp_lib_format
# include <format> // std::format
# else
# include <sstream> // std::stringstream
# endif
#endif #endif
namespace VULKAN_HPP_NAMESPACE namespace VULKAN_HPP_NAMESPACE

View File

@ -10,6 +10,12 @@
module; module;
#include <vulkan/vulkan_hpp_macros.hpp>
#if defined( __cpp_lib_modules )
# define VULKAN_HPP_ENABLE_STD_MODULE
#endif
#include <vulkan/vulkansc.hpp> #include <vulkan/vulkansc.hpp>
#include <vulkan/vulkansc_extension_inspection.hpp> #include <vulkan/vulkansc_extension_inspection.hpp>
#include <vulkan/vulkansc_format_traits.hpp> #include <vulkan/vulkansc_format_traits.hpp>
@ -841,6 +847,7 @@ export namespace VULKAN_HPP_NAMESPACE
//=== CONSTEXPR VALUEs === //=== CONSTEXPR VALUEs ===
//======================== //========================
using VULKAN_HPP_NAMESPACE::HeaderVersion; using VULKAN_HPP_NAMESPACE::HeaderVersion;
using VULKAN_HPP_NAMESPACE::Use64BitPtrDefines;
//========================= //=========================
//=== CONSTEXPR CALLEEs === //=== CONSTEXPR CALLEEs ===

View File

@ -8,24 +8,30 @@
#ifndef VULKAN_HPP #ifndef VULKAN_HPP
#define VULKAN_HPP #define VULKAN_HPP
#include <algorithm>
#include <array> // ArrayWrapperND
#include <string.h> // strnlen
#include <string> // std::string
#include <utility> // std::exchange
#include <vulkan/vulkan_hpp_macros.hpp> #include <vulkan/vulkan_hpp_macros.hpp>
#if defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE )
# include <string.h>
import VULKAN_HPP_STD_MODULE;
#else
# include <algorithm>
# include <array> // ArrayWrapperND
# include <string.h> // strnlen
# include <string> // std::string
# include <utility> // std::exchange
#endif
#include <vulkan/vulkan_sc_core.h> #include <vulkan/vulkan_sc_core.h>
#if 17 <= VULKAN_HPP_CPP_VERSION #if 17 <= VULKAN_HPP_CPP_VERSION && !( defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE ) )
# include <string_view> # include <string_view>
#endif #endif
#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE ) #if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE ) && !( defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE ) )
# include <tuple> // std::tie # include <tuple> // std::tie
# include <vector> // std::vector # include <vector> // std::vector
#endif #endif
#if !defined( VULKAN_HPP_NO_EXCEPTIONS ) #if !defined( VULKAN_HPP_NO_EXCEPTIONS ) && !( defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE ) )
# include <system_error> // std::is_error_code_enum # include <system_error> // std::is_error_code_enum
#endif #endif
@ -49,11 +55,11 @@ extern "C" __declspec( dllimport ) FARPROC __stdcall GetProcAddress( HINSTANCE h
# endif # endif
#endif #endif
#if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR ) #if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR ) && !( defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE ) )
# include <compare> # include <compare>
#endif #endif
#if defined( VULKAN_HPP_SUPPORT_SPAN ) #if defined( VULKAN_HPP_SUPPORT_SPAN ) && !( defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE ) )
# include <span> # include <span>
#endif #endif
@ -3952,7 +3958,8 @@ namespace VULKAN_HPP_NAMESPACE
//======================== //========================
//=== CONSTEXPR VALUEs === //=== CONSTEXPR VALUEs ===
//======================== //========================
VULKAN_HPP_CONSTEXPR_INLINE uint32_t HeaderVersion = VK_HEADER_VERSION; VULKAN_HPP_CONSTEXPR_INLINE uint32_t HeaderVersion = VK_HEADER_VERSION;
VULKAN_HPP_CONSTEXPR_INLINE uint32_t Use64BitPtrDefines = VK_USE_64_BIT_PTR_DEFINES;
//========================= //=========================
//=== CONSTEXPR CALLEEs === //=== CONSTEXPR CALLEEs ===

View File

@ -8,11 +8,15 @@
#ifndef VULKAN_EXTENSION_INSPECTION_HPP #ifndef VULKAN_EXTENSION_INSPECTION_HPP
#define VULKAN_EXTENSION_INSPECTION_HPP #define VULKAN_EXTENSION_INSPECTION_HPP
#include <map> #if defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE )
#include <set> import VULKAN_HPP_STD_MODULE;
#include <string> #else
#include <vector> # include <map>
#include <vulkan/vulkansc.hpp> # include <set>
# include <string>
# include <vector>
# include <vulkan/vulkansc.hpp>
#endif
namespace VULKAN_HPP_NAMESPACE namespace VULKAN_HPP_NAMESPACE
{ {

View File

@ -87,6 +87,19 @@
# define VULKAN_HPP_SUPPORT_SPAN # define VULKAN_HPP_SUPPORT_SPAN
#endif #endif
#if defined( __cpp_lib_modules ) && !defined( VULKAN_HPP_STD_MODULE ) && defined( VULKAN_HPP_ENABLE_STD_MODULE )
# define VULKAN_HPP_STD_MODULE std.compat
#endif
#ifndef VK_USE_64_BIT_PTR_DEFINES
# if defined( __LP64__ ) || defined( _WIN64 ) || ( defined( __x86_64__ ) && !defined( __ILP32__ ) ) || defined( _M_X64 ) || defined( __ia64 ) || \
defined( _M_IA64 ) || defined( __aarch64__ ) || defined( __powerpc64__ ) || ( defined( __riscv ) && __riscv_xlen == 64 )
# define VK_USE_64_BIT_PTR_DEFINES 1
# else
# define VK_USE_64_BIT_PTR_DEFINES 0
# endif
#endif
// 32-bit vulkan is not typesafe for non-dispatchable handles, so don't allow copy constructors on this platform by default. // 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 1 // To enable this feature on 32-bit platforms please #define VULKAN_HPP_TYPESAFE_CONVERSION 1
// To disable this feature on 64-bit platforms please #define VULKAN_HPP_TYPESAFE_CONVERSION 0 // To disable this feature on 64-bit platforms please #define VULKAN_HPP_TYPESAFE_CONVERSION 0
@ -285,7 +298,9 @@ namespace VULKAN_HPP_NAMESPACE
#endif #endif
#if !defined( VULKAN_HPP_EXPECTED ) && ( 23 <= VULKAN_HPP_CPP_VERSION ) && defined( __cpp_lib_expected ) #if !defined( VULKAN_HPP_EXPECTED ) && ( 23 <= VULKAN_HPP_CPP_VERSION ) && defined( __cpp_lib_expected )
# include <expected> # if !( defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE ) )
# include <expected>
# endif
# define VULKAN_HPP_EXPECTED std::expected # define VULKAN_HPP_EXPECTED std::expected
# define VULKAN_HPP_UNEXPECTED std::unexpected # define VULKAN_HPP_UNEXPECTED std::unexpected
#endif #endif

View File

@ -8,9 +8,11 @@
#ifndef VULKAN_RAII_HPP #ifndef VULKAN_RAII_HPP
#define VULKAN_RAII_HPP #define VULKAN_RAII_HPP
#include <memory> // std::unique_ptr
#include <utility> // std::forward
#include <vulkan/vulkansc.hpp> #include <vulkan/vulkansc.hpp>
#if !( defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE ) )
# include <memory> // std::unique_ptr
# include <utility> // std::forward
#endif
#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE ) #if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
namespace VULKAN_HPP_NAMESPACE namespace VULKAN_HPP_NAMESPACE

View File

@ -8,9 +8,12 @@
#ifndef VULKAN_SHARED_HPP #ifndef VULKAN_SHARED_HPP
#define VULKAN_SHARED_HPP #define VULKAN_SHARED_HPP
#include <atomic> // std::atomic_size_t
#include <vulkan/vulkansc.hpp> #include <vulkan/vulkansc.hpp>
#if !( defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE ) )
# include <atomic> // std::atomic_size_t
#endif
namespace VULKAN_HPP_NAMESPACE namespace VULKAN_HPP_NAMESPACE
{ {
#if !defined( VULKAN_HPP_NO_SMART_HANDLE ) #if !defined( VULKAN_HPP_NO_SMART_HANDLE )

View File

@ -19,10 +19,14 @@
# pragma warning( disable : 4996 ) # pragma warning( disable : 4996 )
#endif #endif
#if __cpp_lib_format #if defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE )
# include <format> // std::format import VULKAN_HPP_STD_MODULE;
#else #else
# include <sstream> // std::stringstream # if __cpp_lib_format
# include <format> // std::format
# else
# include <sstream> // std::stringstream
# endif
#endif #endif
namespace VULKAN_HPP_NAMESPACE namespace VULKAN_HPP_NAMESPACE