From 056abda3e2d9364d90b21001ccc61e7de2fb6d1e Mon Sep 17 00:00:00 2001 From: asuessenbach Date: Wed, 27 Jul 2022 14:01:36 +0200 Subject: [PATCH] Reduce number of included headers --- VulkanHppGenerator.cpp | 55 +-- samples/utils/utils.hpp | 1 + vulkan/vulkan.hpp | 744 ++++++++++++++++++------------------ vulkan/vulkan_structs.hpp | 2 + vulkan/vulkan_to_string.hpp | 10 + 5 files changed, 418 insertions(+), 394 deletions(-) diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index 9555311..0b974dd 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -400,9 +400,13 @@ std::string VulkanHppGenerator::generateEnumsToString() const VULKAN_HPP_INLINE std::string toHexString( uint32_t value ) { +#if ( ( 20 <= VULKAN_HPP_CPP_VERSION ) && __has_include( ) ) + return std::format( "{:x}", value ); +#else std::stringstream stream; stream << std::hex << value; return stream.str(); +#endif } ${enumsToString} @@ -13377,7 +13381,6 @@ std::string toString( tinyxml2::XMLError error ) int main( int argc, char ** argv ) { static const std::string classArrayProxy = R"( -#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE ) template class ArrayProxy { @@ -13664,7 +13667,6 @@ int main( int argc, char ** argv ) uint32_t m_count; T * m_ptr; }; -#endif )"; static const std::string classArrayWrapper = R"( @@ -14592,8 +14594,7 @@ int main( int argc, char ** argv ) uniqueToRaw( std::vector const & handles ) { std::vector newBuffer( handles.size() ); - std::transform( - handles.begin(), handles.end(), newBuffer.begin(), []( UniqueType const & handle ) { return handle.get(); } ); + std::transform( handles.begin(), handles.end(), newBuffer.begin(), []( UniqueType const & handle ) { return handle.get(); } ); return newBuffer; } @@ -15010,22 +15011,11 @@ int main( int argc, char ** argv ) # error "vulkan.hpp needs at least c++ standard version 11" #endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include // ArrayWrapperND +#include // std::string #include #if 17 <= VULKAN_HPP_CPP_VERSION -# include +# include // std::string_view #endif #if defined( VULKAN_HPP_DISABLE_ENHANCED_MODE ) @@ -15033,8 +15023,16 @@ int main( int argc, char ** argv ) # define VULKAN_HPP_NO_SMART_HANDLE # endif #else -# include -# include +# include // std::tie +# include // std::vector +#endif + +#if !defined( VULKAN_HPP_NO_EXCEPTIONS ) +# include // std::is_error_code_enum +#endif + +#if !defined( VULKAN_HPP_NO_SMART_HANDLE ) +# include // std::transform #endif #if defined( VULKAN_HPP_NO_CONSTRUCTORS ) @@ -15366,6 +15364,8 @@ namespace VULKAN_HPP_NAMESPACE #ifndef VULKAN_STRUCTS_HPP # define VULKAN_STRUCTS_HPP +#include // strcmp + namespace VULKAN_HPP_NAMESPACE { )"; @@ -15408,12 +15408,13 @@ namespace VULKAN_HPP_NAMESPACE "# define VULKAN_HPP_TYPESAFE_CONVERSION\n" "# endif\n" "#endif\n"; - str += defines + "\n" + "namespace VULKAN_HPP_NAMESPACE\n" + "{" + classArrayProxy + classArrayWrapper + classFlags + classOptional + classStructureChain + - classUniqueHandle; + str += defines + "\n" + "namespace VULKAN_HPP_NAMESPACE\n" + "{" + classArrayWrapper + classFlags + "#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )\n" + + classArrayProxy + classOptional + classStructureChain + classUniqueHandle + "#endif // VULKAN_HPP_DISABLE_ENHANCED_MODE\n"; str += dispatchLoaderBase; str += generator.generateDispatchLoaderStatic(); str += dispatchLoaderDefault; - str += classObjectDestroy + classObjectFree + classObjectRelease + classPoolFree + "\n"; + str += "#if !defined( VULKAN_HPP_NO_SMART_HANDLE )\n" + classObjectDestroy + classObjectFree + classObjectRelease + classPoolFree + "\n" + + "#endif // !VULKAN_HPP_NO_SMART_HANDLE\n"; str += generator.generateBaseTypes(); str += R"(} // namespace VULKAN_HPP_NAMESPACE @@ -15450,7 +15451,7 @@ namespace VULKAN_HPP_NAMESPACE namespace VULKAN_HPP_NAMESPACE { )"; - str += generator.generateStructExtendsStructs(); + str += "#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )\n" + generator.generateStructExtendsStructs() + "#endif // VULKAN_HPP_DISABLE_ENHANCED_MODE\n"; str += dynamicLoader; str += generator.generateDispatchLoaderDynamic(); str += @@ -15501,6 +15502,12 @@ namespace std #include +#if ( ( 20 <= VULKAN_HPP_CPP_VERSION ) && __has_include( ) ) +# include // std::format +#else +# include // std::stringstream +#endif + namespace VULKAN_HPP_NAMESPACE { )"; diff --git a/samples/utils/utils.hpp b/samples/utils/utils.hpp index c23c6e7..594955c 100644 --- a/samples/utils/utils.hpp +++ b/samples/utils/utils.hpp @@ -22,6 +22,7 @@ #include #include #include +#include // std::unique_ptr namespace vk { diff --git a/vulkan/vulkan.hpp b/vulkan/vulkan.hpp index 8906b6f..e89a249 100644 --- a/vulkan/vulkan.hpp +++ b/vulkan/vulkan.hpp @@ -26,22 +26,11 @@ # error "vulkan.hpp needs at least c++ standard version 11" #endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include // ArrayWrapperND +#include // std::string #include #if 17 <= VULKAN_HPP_CPP_VERSION -# include +# include // std::string_view #endif #if defined( VULKAN_HPP_DISABLE_ENHANCED_MODE ) @@ -49,8 +38,16 @@ # define VULKAN_HPP_NO_SMART_HANDLE # endif #else -# include -# include +# include // std::tie +# include // std::vector +#endif + +#if !defined( VULKAN_HPP_NO_EXCEPTIONS ) +# include // std::is_error_code_enum +#endif + +#if !defined( VULKAN_HPP_NO_SMART_HANDLE ) +# include // std::transform #endif #if defined( VULKAN_HPP_NO_CONSTRUCTORS ) @@ -241,318 +238,6 @@ static_assert( VK_HEADER_VERSION == 222, "Wrong VK_HEADER_VERSION!" ); namespace VULKAN_HPP_NAMESPACE { -#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE ) - template - class ArrayProxy - { - public: - VULKAN_HPP_CONSTEXPR ArrayProxy() VULKAN_HPP_NOEXCEPT - : m_count( 0 ) - , m_ptr( nullptr ) - { - } - - VULKAN_HPP_CONSTEXPR ArrayProxy( std::nullptr_t ) VULKAN_HPP_NOEXCEPT - : m_count( 0 ) - , m_ptr( nullptr ) - { - } - - ArrayProxy( T & value ) VULKAN_HPP_NOEXCEPT - : m_count( 1 ) - , m_ptr( &value ) - { - } - - template ::value, int>::type = 0> - ArrayProxy( typename std::remove_const::type & value ) VULKAN_HPP_NOEXCEPT - : m_count( 1 ) - , m_ptr( &value ) - { - } - - ArrayProxy( uint32_t count, T * ptr ) VULKAN_HPP_NOEXCEPT - : m_count( count ) - , m_ptr( ptr ) - { - } - - template ::value, int>::type = 0> - ArrayProxy( uint32_t count, typename std::remove_const::type * ptr ) VULKAN_HPP_NOEXCEPT - : m_count( count ) - , m_ptr( ptr ) - { - } - - template - ArrayProxy( T ( &ptr )[C] ) VULKAN_HPP_NOEXCEPT - : m_count( C ) - , m_ptr( ptr ) - { - } - - template ::value, int>::type = 0> - ArrayProxy( typename std::remove_const::type ( &ptr )[C] ) VULKAN_HPP_NOEXCEPT - : m_count( C ) - , m_ptr( ptr ) - { - } - -# if __GNUC__ >= 9 -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Winit-list-lifetime" -# endif - - ArrayProxy( std::initializer_list const & list ) VULKAN_HPP_NOEXCEPT - : m_count( static_cast( list.size() ) ) - , m_ptr( list.begin() ) - { - } - - template ::value, int>::type = 0> - ArrayProxy( std::initializer_list::type> const & list ) VULKAN_HPP_NOEXCEPT - : m_count( static_cast( list.size() ) ) - , m_ptr( list.begin() ) - { - } - - ArrayProxy( std::initializer_list & list ) VULKAN_HPP_NOEXCEPT - : m_count( static_cast( list.size() ) ) - , m_ptr( list.begin() ) - { - } - - template ::value, int>::type = 0> - ArrayProxy( std::initializer_list::type> & list ) VULKAN_HPP_NOEXCEPT - : m_count( static_cast( list.size() ) ) - , m_ptr( list.begin() ) - { - } - -# if __GNUC__ >= 9 -# pragma GCC diagnostic pop -# endif - - // Any type with a .data() return type implicitly convertible to T*, and a .size() return type implicitly - // convertible to size_t. The const version can capture temporaries, with lifetime ending at end of statement. - template ().data() ), T *>::value && - std::is_convertible().size() ), std::size_t>::value>::type * = nullptr> - ArrayProxy( V const & v ) VULKAN_HPP_NOEXCEPT - : m_count( static_cast( v.size() ) ) - , m_ptr( v.data() ) - { - } - - template ().data() ), T *>::value && - std::is_convertible().size() ), std::size_t>::value>::type * = nullptr> - ArrayProxy( V & v ) VULKAN_HPP_NOEXCEPT - : m_count( static_cast( v.size() ) ) - , m_ptr( v.data() ) - { - } - - const T * begin() const VULKAN_HPP_NOEXCEPT - { - return m_ptr; - } - - const T * end() const VULKAN_HPP_NOEXCEPT - { - return m_ptr + m_count; - } - - const T & front() const VULKAN_HPP_NOEXCEPT - { - VULKAN_HPP_ASSERT( m_count && m_ptr ); - return *m_ptr; - } - - const T & back() const VULKAN_HPP_NOEXCEPT - { - VULKAN_HPP_ASSERT( m_count && m_ptr ); - return *( m_ptr + m_count - 1 ); - } - - bool empty() const VULKAN_HPP_NOEXCEPT - { - return ( m_count == 0 ); - } - - uint32_t size() const VULKAN_HPP_NOEXCEPT - { - return m_count; - } - - T * data() const VULKAN_HPP_NOEXCEPT - { - return m_ptr; - } - - private: - uint32_t m_count; - T * m_ptr; - }; - - template - class ArrayProxyNoTemporaries - { - public: - VULKAN_HPP_CONSTEXPR ArrayProxyNoTemporaries() VULKAN_HPP_NOEXCEPT - : m_count( 0 ) - , m_ptr( nullptr ) - { - } - - VULKAN_HPP_CONSTEXPR ArrayProxyNoTemporaries( std::nullptr_t ) VULKAN_HPP_NOEXCEPT - : m_count( 0 ) - , m_ptr( nullptr ) - { - } - - ArrayProxyNoTemporaries( T & value ) VULKAN_HPP_NOEXCEPT - : m_count( 1 ) - , m_ptr( &value ) - { - } - - template - ArrayProxyNoTemporaries( V && value ) = delete; - - template ::value, int>::type = 0> - ArrayProxyNoTemporaries( typename std::remove_const::type & value ) VULKAN_HPP_NOEXCEPT - : m_count( 1 ) - , m_ptr( &value ) - { - } - - template ::value, int>::type = 0> - ArrayProxyNoTemporaries( typename std::remove_const::type && value ) = delete; - - ArrayProxyNoTemporaries( uint32_t count, T * ptr ) VULKAN_HPP_NOEXCEPT - : m_count( count ) - , m_ptr( ptr ) - { - } - - template ::value, int>::type = 0> - ArrayProxyNoTemporaries( uint32_t count, typename std::remove_const::type * ptr ) VULKAN_HPP_NOEXCEPT - : m_count( count ) - , m_ptr( ptr ) - { - } - - template - ArrayProxyNoTemporaries( T ( &ptr )[C] ) VULKAN_HPP_NOEXCEPT - : m_count( C ) - , m_ptr( ptr ) - { - } - - template - ArrayProxyNoTemporaries( T( &&ptr )[C] ) = delete; - - template ::value, int>::type = 0> - ArrayProxyNoTemporaries( typename std::remove_const::type ( &ptr )[C] ) VULKAN_HPP_NOEXCEPT - : m_count( C ) - , m_ptr( ptr ) - { - } - - template ::value, int>::type = 0> - ArrayProxyNoTemporaries( typename std::remove_const::type( &&ptr )[C] ) = delete; - - ArrayProxyNoTemporaries( std::initializer_list const & list ) VULKAN_HPP_NOEXCEPT - : m_count( static_cast( list.size() ) ) - , m_ptr( list.begin() ) - { - } - - ArrayProxyNoTemporaries( std::initializer_list const && list ) = delete; - - template ::value, int>::type = 0> - ArrayProxyNoTemporaries( std::initializer_list::type> const & list ) VULKAN_HPP_NOEXCEPT - : m_count( static_cast( list.size() ) ) - , m_ptr( list.begin() ) - { - } - - template ::value, int>::type = 0> - ArrayProxyNoTemporaries( std::initializer_list::type> const && list ) = delete; - - ArrayProxyNoTemporaries( std::initializer_list & list ) VULKAN_HPP_NOEXCEPT - : m_count( static_cast( list.size() ) ) - , m_ptr( list.begin() ) - { - } - - ArrayProxyNoTemporaries( std::initializer_list && list ) = delete; - - template ::value, int>::type = 0> - ArrayProxyNoTemporaries( std::initializer_list::type> & list ) VULKAN_HPP_NOEXCEPT - : m_count( static_cast( list.size() ) ) - , m_ptr( list.begin() ) - { - } - - template ::value, int>::type = 0> - ArrayProxyNoTemporaries( std::initializer_list::type> && list ) = delete; - - // Any type with a .data() return type implicitly convertible to T*, and a // .size() return type implicitly - // convertible to size_t. - template ().data() ), T *>::value && - std::is_convertible().size() ), std::size_t>::value>::type * = nullptr> - ArrayProxyNoTemporaries( V & v ) VULKAN_HPP_NOEXCEPT - : m_count( static_cast( v.size() ) ) - , m_ptr( v.data() ) - { - } - - const T * begin() const VULKAN_HPP_NOEXCEPT - { - return m_ptr; - } - - const T * end() const VULKAN_HPP_NOEXCEPT - { - return m_ptr + m_count; - } - - const T & front() const VULKAN_HPP_NOEXCEPT - { - VULKAN_HPP_ASSERT( m_count && m_ptr ); - return *m_ptr; - } - - const T & back() const VULKAN_HPP_NOEXCEPT - { - VULKAN_HPP_ASSERT( m_count && m_ptr ); - return *( m_ptr + m_count - 1 ); - } - - bool empty() const VULKAN_HPP_NOEXCEPT - { - return ( m_count == 0 ); - } - - uint32_t size() const VULKAN_HPP_NOEXCEPT - { - return m_count; - } - - T * data() const VULKAN_HPP_NOEXCEPT - { - return m_ptr; - } - - private: - uint32_t m_count; - T * m_ptr; - }; -#endif - template class ArrayWrapper1D : public std::array { @@ -871,6 +556,317 @@ namespace VULKAN_HPP_NAMESPACE { return flags.operator^( bit ); } +#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE ) + + template + class ArrayProxy + { + public: + VULKAN_HPP_CONSTEXPR ArrayProxy() VULKAN_HPP_NOEXCEPT + : m_count( 0 ) + , m_ptr( nullptr ) + { + } + + VULKAN_HPP_CONSTEXPR ArrayProxy( std::nullptr_t ) VULKAN_HPP_NOEXCEPT + : m_count( 0 ) + , m_ptr( nullptr ) + { + } + + ArrayProxy( T & value ) VULKAN_HPP_NOEXCEPT + : m_count( 1 ) + , m_ptr( &value ) + { + } + + template ::value, int>::type = 0> + ArrayProxy( typename std::remove_const::type & value ) VULKAN_HPP_NOEXCEPT + : m_count( 1 ) + , m_ptr( &value ) + { + } + + ArrayProxy( uint32_t count, T * ptr ) VULKAN_HPP_NOEXCEPT + : m_count( count ) + , m_ptr( ptr ) + { + } + + template ::value, int>::type = 0> + ArrayProxy( uint32_t count, typename std::remove_const::type * ptr ) VULKAN_HPP_NOEXCEPT + : m_count( count ) + , m_ptr( ptr ) + { + } + + template + ArrayProxy( T ( &ptr )[C] ) VULKAN_HPP_NOEXCEPT + : m_count( C ) + , m_ptr( ptr ) + { + } + + template ::value, int>::type = 0> + ArrayProxy( typename std::remove_const::type ( &ptr )[C] ) VULKAN_HPP_NOEXCEPT + : m_count( C ) + , m_ptr( ptr ) + { + } + +# if __GNUC__ >= 9 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Winit-list-lifetime" +# endif + + ArrayProxy( std::initializer_list const & list ) VULKAN_HPP_NOEXCEPT + : m_count( static_cast( list.size() ) ) + , m_ptr( list.begin() ) + { + } + + template ::value, int>::type = 0> + ArrayProxy( std::initializer_list::type> const & list ) VULKAN_HPP_NOEXCEPT + : m_count( static_cast( list.size() ) ) + , m_ptr( list.begin() ) + { + } + + ArrayProxy( std::initializer_list & list ) VULKAN_HPP_NOEXCEPT + : m_count( static_cast( list.size() ) ) + , m_ptr( list.begin() ) + { + } + + template ::value, int>::type = 0> + ArrayProxy( std::initializer_list::type> & list ) VULKAN_HPP_NOEXCEPT + : m_count( static_cast( list.size() ) ) + , m_ptr( list.begin() ) + { + } + +# if __GNUC__ >= 9 +# pragma GCC diagnostic pop +# endif + + // Any type with a .data() return type implicitly convertible to T*, and a .size() return type implicitly + // convertible to size_t. The const version can capture temporaries, with lifetime ending at end of statement. + template ().data() ), T *>::value && + std::is_convertible().size() ), std::size_t>::value>::type * = nullptr> + ArrayProxy( V const & v ) VULKAN_HPP_NOEXCEPT + : m_count( static_cast( v.size() ) ) + , m_ptr( v.data() ) + { + } + + template ().data() ), T *>::value && + std::is_convertible().size() ), std::size_t>::value>::type * = nullptr> + ArrayProxy( V & v ) VULKAN_HPP_NOEXCEPT + : m_count( static_cast( v.size() ) ) + , m_ptr( v.data() ) + { + } + + const T * begin() const VULKAN_HPP_NOEXCEPT + { + return m_ptr; + } + + const T * end() const VULKAN_HPP_NOEXCEPT + { + return m_ptr + m_count; + } + + const T & front() const VULKAN_HPP_NOEXCEPT + { + VULKAN_HPP_ASSERT( m_count && m_ptr ); + return *m_ptr; + } + + const T & back() const VULKAN_HPP_NOEXCEPT + { + VULKAN_HPP_ASSERT( m_count && m_ptr ); + return *( m_ptr + m_count - 1 ); + } + + bool empty() const VULKAN_HPP_NOEXCEPT + { + return ( m_count == 0 ); + } + + uint32_t size() const VULKAN_HPP_NOEXCEPT + { + return m_count; + } + + T * data() const VULKAN_HPP_NOEXCEPT + { + return m_ptr; + } + + private: + uint32_t m_count; + T * m_ptr; + }; + + template + class ArrayProxyNoTemporaries + { + public: + VULKAN_HPP_CONSTEXPR ArrayProxyNoTemporaries() VULKAN_HPP_NOEXCEPT + : m_count( 0 ) + , m_ptr( nullptr ) + { + } + + VULKAN_HPP_CONSTEXPR ArrayProxyNoTemporaries( std::nullptr_t ) VULKAN_HPP_NOEXCEPT + : m_count( 0 ) + , m_ptr( nullptr ) + { + } + + ArrayProxyNoTemporaries( T & value ) VULKAN_HPP_NOEXCEPT + : m_count( 1 ) + , m_ptr( &value ) + { + } + + template + ArrayProxyNoTemporaries( V && value ) = delete; + + template ::value, int>::type = 0> + ArrayProxyNoTemporaries( typename std::remove_const::type & value ) VULKAN_HPP_NOEXCEPT + : m_count( 1 ) + , m_ptr( &value ) + { + } + + template ::value, int>::type = 0> + ArrayProxyNoTemporaries( typename std::remove_const::type && value ) = delete; + + ArrayProxyNoTemporaries( uint32_t count, T * ptr ) VULKAN_HPP_NOEXCEPT + : m_count( count ) + , m_ptr( ptr ) + { + } + + template ::value, int>::type = 0> + ArrayProxyNoTemporaries( uint32_t count, typename std::remove_const::type * ptr ) VULKAN_HPP_NOEXCEPT + : m_count( count ) + , m_ptr( ptr ) + { + } + + template + ArrayProxyNoTemporaries( T ( &ptr )[C] ) VULKAN_HPP_NOEXCEPT + : m_count( C ) + , m_ptr( ptr ) + { + } + + template + ArrayProxyNoTemporaries( T( &&ptr )[C] ) = delete; + + template ::value, int>::type = 0> + ArrayProxyNoTemporaries( typename std::remove_const::type ( &ptr )[C] ) VULKAN_HPP_NOEXCEPT + : m_count( C ) + , m_ptr( ptr ) + { + } + + template ::value, int>::type = 0> + ArrayProxyNoTemporaries( typename std::remove_const::type( &&ptr )[C] ) = delete; + + ArrayProxyNoTemporaries( std::initializer_list const & list ) VULKAN_HPP_NOEXCEPT + : m_count( static_cast( list.size() ) ) + , m_ptr( list.begin() ) + { + } + + ArrayProxyNoTemporaries( std::initializer_list const && list ) = delete; + + template ::value, int>::type = 0> + ArrayProxyNoTemporaries( std::initializer_list::type> const & list ) VULKAN_HPP_NOEXCEPT + : m_count( static_cast( list.size() ) ) + , m_ptr( list.begin() ) + { + } + + template ::value, int>::type = 0> + ArrayProxyNoTemporaries( std::initializer_list::type> const && list ) = delete; + + ArrayProxyNoTemporaries( std::initializer_list & list ) VULKAN_HPP_NOEXCEPT + : m_count( static_cast( list.size() ) ) + , m_ptr( list.begin() ) + { + } + + ArrayProxyNoTemporaries( std::initializer_list && list ) = delete; + + template ::value, int>::type = 0> + ArrayProxyNoTemporaries( std::initializer_list::type> & list ) VULKAN_HPP_NOEXCEPT + : m_count( static_cast( list.size() ) ) + , m_ptr( list.begin() ) + { + } + + template ::value, int>::type = 0> + ArrayProxyNoTemporaries( std::initializer_list::type> && list ) = delete; + + // Any type with a .data() return type implicitly convertible to T*, and a // .size() return type implicitly + // convertible to size_t. + template ().data() ), T *>::value && + std::is_convertible().size() ), std::size_t>::value>::type * = nullptr> + ArrayProxyNoTemporaries( V & v ) VULKAN_HPP_NOEXCEPT + : m_count( static_cast( v.size() ) ) + , m_ptr( v.data() ) + { + } + + const T * begin() const VULKAN_HPP_NOEXCEPT + { + return m_ptr; + } + + const T * end() const VULKAN_HPP_NOEXCEPT + { + return m_ptr + m_count; + } + + const T & front() const VULKAN_HPP_NOEXCEPT + { + VULKAN_HPP_ASSERT( m_count && m_ptr ); + return *m_ptr; + } + + const T & back() const VULKAN_HPP_NOEXCEPT + { + VULKAN_HPP_ASSERT( m_count && m_ptr ); + return *( m_ptr + m_count - 1 ); + } + + bool empty() const VULKAN_HPP_NOEXCEPT + { + return ( m_count == 0 ); + } + + uint32_t size() const VULKAN_HPP_NOEXCEPT + { + return m_count; + } + + T * data() const VULKAN_HPP_NOEXCEPT + { + return m_ptr; + } + + private: + uint32_t m_count; + T * m_ptr; + }; template class Optional @@ -1142,7 +1138,7 @@ namespace VULKAN_HPP_NAMESPACE } }; -#if !defined( VULKAN_HPP_NO_SMART_HANDLE ) +# if !defined( VULKAN_HPP_NO_SMART_HANDLE ) template class UniqueHandleTraits; @@ -1265,7 +1261,8 @@ namespace VULKAN_HPP_NAMESPACE { lhs.swap( rhs ); } -#endif +# endif +#endif // VULKAN_HPP_DISABLE_ENHANCED_MODE class DispatchLoaderBase { @@ -5409,6 +5406,7 @@ namespace VULKAN_HPP_NAMESPACE # 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 ) struct AllocationCallbacks; @@ -5587,6 +5585,8 @@ namespace VULKAN_HPP_NAMESPACE Dispatch const * m_dispatch = nullptr; }; +#endif // !VULKAN_HPP_NO_SMART_HANDLE + //================== //=== BASE TYPEs === //================== @@ -6196,6 +6196,8 @@ namespace VULKAN_HPP_NAMESPACE namespace VULKAN_HPP_NAMESPACE { +#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE ) + //======================= //=== STRUCTS EXTENDS === //======================= @@ -7488,7 +7490,7 @@ namespace VULKAN_HPP_NAMESPACE }; }; -#if defined( VK_ENABLE_BETA_EXTENSIONS ) +# if defined( VK_ENABLE_BETA_EXTENSIONS ) //=== VK_KHR_video_queue === template <> struct StructExtends @@ -7546,9 +7548,9 @@ namespace VULKAN_HPP_NAMESPACE value = true }; }; -#endif /*VK_ENABLE_BETA_EXTENSIONS*/ +# endif /*VK_ENABLE_BETA_EXTENSIONS*/ -#if defined( VK_ENABLE_BETA_EXTENSIONS ) +# if defined( VK_ENABLE_BETA_EXTENSIONS ) //=== VK_KHR_video_decode_queue === template <> struct StructExtends @@ -7558,7 +7560,7 @@ namespace VULKAN_HPP_NAMESPACE value = true }; }; -#endif /*VK_ENABLE_BETA_EXTENSIONS*/ +# endif /*VK_ENABLE_BETA_EXTENSIONS*/ //=== VK_NV_dedicated_allocation === template <> @@ -7620,7 +7622,7 @@ namespace VULKAN_HPP_NAMESPACE }; }; -#if defined( VK_ENABLE_BETA_EXTENSIONS ) +# if defined( VK_ENABLE_BETA_EXTENSIONS ) //=== VK_EXT_video_encode_h264 === template <> struct StructExtends @@ -7694,9 +7696,9 @@ namespace VULKAN_HPP_NAMESPACE value = true }; }; -#endif /*VK_ENABLE_BETA_EXTENSIONS*/ +# endif /*VK_ENABLE_BETA_EXTENSIONS*/ -#if defined( VK_ENABLE_BETA_EXTENSIONS ) +# if defined( VK_ENABLE_BETA_EXTENSIONS ) //=== VK_EXT_video_encode_h265 === template <> struct StructExtends @@ -7770,9 +7772,9 @@ namespace VULKAN_HPP_NAMESPACE value = true }; }; -#endif /*VK_ENABLE_BETA_EXTENSIONS*/ +# endif /*VK_ENABLE_BETA_EXTENSIONS*/ -#if defined( VK_ENABLE_BETA_EXTENSIONS ) +# if defined( VK_ENABLE_BETA_EXTENSIONS ) //=== VK_EXT_video_decode_h264 === template <> struct StructExtends @@ -7838,7 +7840,7 @@ namespace VULKAN_HPP_NAMESPACE value = true }; }; -#endif /*VK_ENABLE_BETA_EXTENSIONS*/ +# endif /*VK_ENABLE_BETA_EXTENSIONS*/ //=== VK_AMD_texture_gather_bias_lod === template <> @@ -7944,7 +7946,7 @@ namespace VULKAN_HPP_NAMESPACE }; }; -#if defined( VK_USE_PLATFORM_WIN32_KHR ) +# if defined( VK_USE_PLATFORM_WIN32_KHR ) //=== VK_NV_external_memory_win32 === template <> struct StructExtends @@ -7962,9 +7964,9 @@ namespace VULKAN_HPP_NAMESPACE value = true }; }; -#endif /*VK_USE_PLATFORM_WIN32_KHR*/ +# endif /*VK_USE_PLATFORM_WIN32_KHR*/ -#if defined( VK_USE_PLATFORM_WIN32_KHR ) +# if defined( VK_USE_PLATFORM_WIN32_KHR ) //=== VK_NV_win32_keyed_mutex === template <> struct StructExtends @@ -7982,7 +7984,7 @@ namespace VULKAN_HPP_NAMESPACE value = true }; }; -#endif /*VK_USE_PLATFORM_WIN32_KHR*/ +# endif /*VK_USE_PLATFORM_WIN32_KHR*/ //=== VK_EXT_validation_flags === template <> @@ -8078,7 +8080,7 @@ namespace VULKAN_HPP_NAMESPACE }; }; -#if defined( VK_USE_PLATFORM_WIN32_KHR ) +# if defined( VK_USE_PLATFORM_WIN32_KHR ) //=== VK_KHR_external_memory_win32 === template <> struct StructExtends @@ -8096,7 +8098,7 @@ namespace VULKAN_HPP_NAMESPACE value = true }; }; -#endif /*VK_USE_PLATFORM_WIN32_KHR*/ +# endif /*VK_USE_PLATFORM_WIN32_KHR*/ //=== VK_KHR_external_memory_fd === template <> @@ -8108,7 +8110,7 @@ namespace VULKAN_HPP_NAMESPACE }; }; -#if defined( VK_USE_PLATFORM_WIN32_KHR ) +# if defined( VK_USE_PLATFORM_WIN32_KHR ) //=== VK_KHR_win32_keyed_mutex === template <> struct StructExtends @@ -8126,9 +8128,9 @@ namespace VULKAN_HPP_NAMESPACE value = true }; }; -#endif /*VK_USE_PLATFORM_WIN32_KHR*/ +# endif /*VK_USE_PLATFORM_WIN32_KHR*/ -#if defined( VK_USE_PLATFORM_WIN32_KHR ) +# if defined( VK_USE_PLATFORM_WIN32_KHR ) //=== VK_KHR_external_semaphore_win32 === template <> struct StructExtends @@ -8146,7 +8148,7 @@ namespace VULKAN_HPP_NAMESPACE value = true }; }; -#endif /*VK_USE_PLATFORM_WIN32_KHR*/ +# endif /*VK_USE_PLATFORM_WIN32_KHR*/ //=== VK_KHR_push_descriptor === template <> @@ -8316,7 +8318,7 @@ namespace VULKAN_HPP_NAMESPACE }; }; -#if defined( VK_USE_PLATFORM_WIN32_KHR ) +# if defined( VK_USE_PLATFORM_WIN32_KHR ) //=== VK_KHR_external_fence_win32 === template <> struct StructExtends @@ -8326,7 +8328,7 @@ namespace VULKAN_HPP_NAMESPACE value = true }; }; -#endif /*VK_USE_PLATFORM_WIN32_KHR*/ +# endif /*VK_USE_PLATFORM_WIN32_KHR*/ //=== VK_KHR_performance_query === template <> @@ -8396,7 +8398,7 @@ namespace VULKAN_HPP_NAMESPACE }; }; -#if defined( VK_USE_PLATFORM_ANDROID_KHR ) +# if defined( VK_USE_PLATFORM_ANDROID_KHR ) //=== VK_ANDROID_external_memory_android_hardware_buffer === template <> struct StructExtends @@ -8446,7 +8448,7 @@ namespace VULKAN_HPP_NAMESPACE value = true }; }; -#endif /*VK_USE_PLATFORM_ANDROID_KHR*/ +# endif /*VK_USE_PLATFORM_ANDROID_KHR*/ //=== VK_EXT_sample_locations === template <> @@ -8664,7 +8666,7 @@ namespace VULKAN_HPP_NAMESPACE }; }; -#if defined( VK_ENABLE_BETA_EXTENSIONS ) +# if defined( VK_ENABLE_BETA_EXTENSIONS ) //=== VK_KHR_portability_subset === template <> struct StructExtends @@ -8690,7 +8692,7 @@ namespace VULKAN_HPP_NAMESPACE value = true }; }; -#endif /*VK_ENABLE_BETA_EXTENSIONS*/ +# endif /*VK_ENABLE_BETA_EXTENSIONS*/ //=== VK_NV_shading_rate_image === template <> @@ -8860,7 +8862,7 @@ namespace VULKAN_HPP_NAMESPACE }; }; -#if defined( VK_ENABLE_BETA_EXTENSIONS ) +# if defined( VK_ENABLE_BETA_EXTENSIONS ) //=== VK_EXT_video_decode_h265 === template <> struct StructExtends @@ -8918,7 +8920,7 @@ namespace VULKAN_HPP_NAMESPACE value = true }; }; -#endif /*VK_ENABLE_BETA_EXTENSIONS*/ +# endif /*VK_ENABLE_BETA_EXTENSIONS*/ //=== VK_KHR_global_priority === template <> @@ -8998,7 +9000,7 @@ namespace VULKAN_HPP_NAMESPACE }; }; -#if defined( VK_USE_PLATFORM_GGP ) +# if defined( VK_USE_PLATFORM_GGP ) //=== VK_GGP_frame_token === template <> struct StructExtends @@ -9008,7 +9010,7 @@ namespace VULKAN_HPP_NAMESPACE value = true }; }; -#endif /*VK_USE_PLATFORM_GGP*/ +# endif /*VK_USE_PLATFORM_GGP*/ //=== VK_NV_compute_shader_derivatives === template <> @@ -9534,7 +9536,7 @@ namespace VULKAN_HPP_NAMESPACE }; }; -#if defined( VK_USE_PLATFORM_WIN32_KHR ) +# if defined( VK_USE_PLATFORM_WIN32_KHR ) //=== VK_EXT_full_screen_exclusive === template <> struct StructExtends @@ -9576,7 +9578,7 @@ namespace VULKAN_HPP_NAMESPACE value = true }; }; -#endif /*VK_USE_PLATFORM_WIN32_KHR*/ +# endif /*VK_USE_PLATFORM_WIN32_KHR*/ //=== VK_EXT_line_rasterization === template <> @@ -9920,7 +9922,7 @@ namespace VULKAN_HPP_NAMESPACE }; }; -#if defined( VK_ENABLE_BETA_EXTENSIONS ) +# if defined( VK_ENABLE_BETA_EXTENSIONS ) //=== VK_KHR_video_encode_queue === template <> struct StructExtends @@ -9946,7 +9948,7 @@ namespace VULKAN_HPP_NAMESPACE value = true }; }; -#endif /*VK_ENABLE_BETA_EXTENSIONS*/ +# endif /*VK_ENABLE_BETA_EXTENSIONS*/ //=== VK_NV_device_diagnostics_config === template <> @@ -9974,7 +9976,7 @@ namespace VULKAN_HPP_NAMESPACE }; }; -#if defined( VK_USE_PLATFORM_METAL_EXT ) +# if defined( VK_USE_PLATFORM_METAL_EXT ) //=== VK_EXT_metal_objects === template <> struct StructExtends @@ -10120,7 +10122,7 @@ namespace VULKAN_HPP_NAMESPACE value = true }; }; -#endif /*VK_USE_PLATFORM_METAL_EXT*/ +# endif /*VK_USE_PLATFORM_METAL_EXT*/ //=== VK_KHR_synchronization2 === template <> @@ -10646,7 +10648,7 @@ namespace VULKAN_HPP_NAMESPACE }; }; -#if defined( VK_USE_PLATFORM_FUCHSIA ) +# if defined( VK_USE_PLATFORM_FUCHSIA ) //=== VK_FUCHSIA_external_memory === template <> struct StructExtends @@ -10656,9 +10658,9 @@ namespace VULKAN_HPP_NAMESPACE value = true }; }; -#endif /*VK_USE_PLATFORM_FUCHSIA*/ +# endif /*VK_USE_PLATFORM_FUCHSIA*/ -#if defined( VK_USE_PLATFORM_FUCHSIA ) +# if defined( VK_USE_PLATFORM_FUCHSIA ) //=== VK_FUCHSIA_buffer_collection === template <> struct StructExtends @@ -10684,7 +10686,7 @@ namespace VULKAN_HPP_NAMESPACE value = true }; }; -#endif /*VK_USE_PLATFORM_FUCHSIA*/ +# endif /*VK_USE_PLATFORM_FUCHSIA*/ //=== VK_HUAWEI_subpass_shading === template <> @@ -11252,6 +11254,8 @@ namespace VULKAN_HPP_NAMESPACE }; }; +#endif // VULKAN_HPP_DISABLE_ENHANCED_MODE + #if VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL class DynamicLoader { diff --git a/vulkan/vulkan_structs.hpp b/vulkan/vulkan_structs.hpp index d9efec5..476dcd2 100644 --- a/vulkan/vulkan_structs.hpp +++ b/vulkan/vulkan_structs.hpp @@ -8,6 +8,8 @@ #ifndef VULKAN_STRUCTS_HPP #define VULKAN_STRUCTS_HPP +#include // strcmp + namespace VULKAN_HPP_NAMESPACE { //=============== diff --git a/vulkan/vulkan_to_string.hpp b/vulkan/vulkan_to_string.hpp index 7e1f4b2..0e0c2ca 100644 --- a/vulkan/vulkan_to_string.hpp +++ b/vulkan/vulkan_to_string.hpp @@ -10,6 +10,12 @@ #include +#if ( ( 20 <= VULKAN_HPP_CPP_VERSION ) && __has_include( ) ) +# include // std::format +#else +# include // std::stringstream +#endif + namespace VULKAN_HPP_NAMESPACE { //========================== @@ -2989,9 +2995,13 @@ namespace VULKAN_HPP_NAMESPACE VULKAN_HPP_INLINE std::string toHexString( uint32_t value ) { +#if ( ( 20 <= VULKAN_HPP_CPP_VERSION ) && __has_include( ) ) + return std::format( "{:x}", value ); +#else std::stringstream stream; stream << std::hex << value; return stream.str(); +#endif } //=== VK_VERSION_1_0 ===