diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index 6044d43..af7077c 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -2467,7 +2467,7 @@ std::string VulkanHppGenerator::generateBitmaskToString( std::mapsecond.values ) { - auto [enter, leave] = generateProtection( value.protect ); std::string valueName = generateEnumValueName( bitmaskBitsIt->first, value.name, true ); - if ( value.singleBit ) + if ( value.value == "0" ) { + assert( emptyValue == "{}" ); + emptyValue = valueName.substr( 1 ); + } + else if ( !value.bitpos.empty() ) + { + assert( value.alias.empty() ); + auto [enter, leave] = generateProtection( value.protect ); toStringChecks += ( ( previousEnter != enter ) ? ( previousLeave + enter ) : "" ) + " if ( value & " + enumName + "::" + valueName + " ) result += \"" + valueName.substr( 1 ) + " | \";\n"; + previousEnter = enter; + previousLeave = leave; } - previousEnter = enter; - previousLeave = leave; } if ( !previousLeave.empty() ) { @@ -2496,7 +2503,7 @@ ${toStringChecks} previousLeave.resize( previousLeave.size() - strlen( "\n" ) ); } - str += replaceWithMap( bitmaskToStringTemplate, { { "bitmaskName", bitmaskName }, { "toStringChecks", toStringChecks } } ); + str += replaceWithMap( bitmaskToStringTemplate, { { "bitmaskName", bitmaskName }, { "emptyValue", emptyValue }, { "toStringChecks", toStringChecks } } ); } return str; @@ -11832,7 +11839,7 @@ void VulkanHppGenerator::readEnumsEnum( tinyxml2::XMLElement const * element, st checkForError( name.starts_with( prefix ), line, "encountered enum value <" + name + "> that does not begin with expected prefix <" + prefix + ">" ); checkForError( bitpos.empty() ^ value.empty(), line, "both or none of \"bitpos\" and \"value\" are set for enum <" + name + "> which is invalid" ); - enumIt->second.addEnumValue( line, name, "", !bitpos.empty(), true ); + enumIt->second.addEnumValue( line, name, "", bitpos, value, true ); } } @@ -12669,7 +12676,7 @@ void VulkanHppGenerator::readRequireEnum( tinyxml2::XMLElement const * element, auto enumIt = m_enums.find( extends ); assert( enumIt != m_enums.end() ); - enumIt->second.addEnumValue( line, name, protect, !bitpos.empty(), ( api.empty() || ( api == m_api ) ) && supported ); + enumIt->second.addEnumValue( line, name, protect, bitpos + offset, value, ( api.empty() || ( api == m_api ) ) && supported ); } } else @@ -13846,36 +13853,37 @@ void VulkanHppGenerator::EnumData::addEnumAlias( int line, std::string const & n { if ( supported ) { - checkForError( ( valueIt->alias == alias ) && ( valueIt->protect == protect ) && !valueIt->singleBit, + checkForError( ( valueIt->alias == alias ) && ( valueIt->protect == protect ) && valueIt->bitpos.empty() && valueIt->value.empty(), line, "enum alias <" + name + "> already specified with different attributes" ); } else { - checkForWarning( ( valueIt->alias == alias ) && ( valueIt->protect == protect ) && !valueIt->singleBit, + checkForWarning( ( valueIt->alias == alias ) && ( valueIt->protect == protect ) && valueIt->bitpos.empty() && valueIt->value.empty(), line, "enum alias <" + name + "> already specified with different attributes" ); } } else { - valuesRef.push_back( { alias, name, protect, false, line } ); + valuesRef.push_back( { alias, "", name, protect, "", line } ); } } -void VulkanHppGenerator::EnumData::addEnumValue( int line, std::string const & name, std::string const & protect, bool singleBit, bool supported ) +void VulkanHppGenerator::EnumData::addEnumValue( + int line, std::string const & name, std::string const & protect, std::string const & bitpos, std::string const & value, bool supported ) { auto & valuesRef = supported ? values : unsupportedValues; auto valueIt = std::find_if( valuesRef.begin(), valuesRef.end(), [&name]( EnumValueData const & evd ) { return evd.name == name; } ); if ( valueIt != valuesRef.end() ) { - checkForError( valueIt->alias.empty() && ( valueIt->protect == protect ) && ( valueIt->singleBit == singleBit ), + checkForError( valueIt->alias.empty() && ( valueIt->protect == protect ) && ( valueIt->bitpos == bitpos ) && ( valueIt->value == value ), line, "enum value <" + name + "> already specified with different attributes" ); } else { - valuesRef.push_back( { "", name, protect, singleBit, line } ); + valuesRef.push_back( { "", bitpos, name, protect, value, line } ); } } diff --git a/VulkanHppGenerator.hpp b/VulkanHppGenerator.hpp index 63e4025..ee42971 100644 --- a/VulkanHppGenerator.hpp +++ b/VulkanHppGenerator.hpp @@ -196,17 +196,19 @@ private: struct EnumValueData { - std::string alias = {}; - std::string name = {}; - std::string protect = {}; - bool singleBit = false; - int xmlLine = {}; + std::string alias = {}; + std::string bitpos = {}; + std::string name = {}; + std::string protect = {}; + std::string value = {}; + int xmlLine = {}; }; struct EnumData { void addEnumAlias( int line, std::string const & name, std::string const & alias, std::string const & protect, bool supported ); - void addEnumValue( int line, std::string const & valueName, std::string const & protect, bool singleBit, bool supported ); + void addEnumValue( + int line, std::string const & valueName, std::string const & protect, std::string const & bitpos, std::string const & value, bool supported ); std::string bitwidth = {}; bool isBitmask = false; diff --git a/vulkan/vulkan.hpp b/vulkan/vulkan.hpp index f44bed2..567baef 100644 --- a/vulkan/vulkan.hpp +++ b/vulkan/vulkan.hpp @@ -6001,6 +6001,11 @@ namespace VULKAN_HPP_NAMESPACE return m_allocationCallbacks; } + Dispatch const & getDispatch() const VULKAN_HPP_NOEXCEPT + { + return *m_dispatch; + } + protected: template void destroy( T t ) VULKAN_HPP_NOEXCEPT @@ -6035,6 +6040,11 @@ namespace VULKAN_HPP_NAMESPACE return m_allocationCallbacks; } + Dispatch const & getDispatch() const VULKAN_HPP_NOEXCEPT + { + return *m_dispatch; + } + protected: template void destroy( T t ) VULKAN_HPP_NOEXCEPT @@ -6073,6 +6083,11 @@ namespace VULKAN_HPP_NAMESPACE return m_allocationCallbacks; } + Dispatch const & getDispatch() const VULKAN_HPP_NOEXCEPT + { + return *m_dispatch; + } + protected: template void destroy( T t ) VULKAN_HPP_NOEXCEPT @@ -6104,6 +6119,11 @@ namespace VULKAN_HPP_NAMESPACE return m_owner; } + Dispatch const & getDispatch() const VULKAN_HPP_NOEXCEPT + { + return *m_dispatch; + } + protected: template void destroy( T t ) VULKAN_HPP_NOEXCEPT @@ -6140,6 +6160,11 @@ namespace VULKAN_HPP_NAMESPACE return m_pool; } + Dispatch const & getDispatch() const VULKAN_HPP_NOEXCEPT + { + return *m_dispatch; + } + protected: template void destroy( T t ) VULKAN_HPP_NOEXCEPT @@ -13283,7 +13308,7 @@ namespace VULKAN_HPP_NAMESPACE # elif defined( __APPLE__ ) m_library = dlopen( "libvulkan.dylib", RTLD_NOW | RTLD_LOCAL ); # elif defined( _WIN32 ) - m_library = ::LoadLibraryA( "vulkan-1.dll" ); + m_library = ::LoadLibraryA( "vulkan-1.dll" ); # else # error unsupported platform # endif diff --git a/vulkan/vulkan_to_string.hpp b/vulkan/vulkan_to_string.hpp index 399901c..63a2c8e 100644 --- a/vulkan/vulkan_to_string.hpp +++ b/vulkan/vulkan_to_string.hpp @@ -325,7 +325,7 @@ namespace VULKAN_HPP_NAMESPACE VULKAN_HPP_INLINE std::string to_string( PipelineStageFlags value ) { if ( !value ) - return "{}"; + return "None"; std::string result; if ( value & PipelineStageFlagBits::eTopOfPipe ) @@ -392,7 +392,7 @@ namespace VULKAN_HPP_NAMESPACE VULKAN_HPP_INLINE std::string to_string( ImageAspectFlags value ) { if ( !value ) - return "{}"; + return "None"; std::string result; if ( value & ImageAspectFlagBits::eColor ) @@ -684,7 +684,7 @@ namespace VULKAN_HPP_NAMESPACE VULKAN_HPP_INLINE std::string to_string( CullModeFlags value ) { if ( !value ) - return "{}"; + return "None"; std::string result; if ( value & CullModeFlagBits::eFront ) @@ -962,7 +962,7 @@ namespace VULKAN_HPP_NAMESPACE VULKAN_HPP_INLINE std::string to_string( AccessFlags value ) { if ( !value ) - return "{}"; + return "None"; std::string result; if ( value & AccessFlagBits::eIndirectCommandRead ) @@ -1434,7 +1434,7 @@ namespace VULKAN_HPP_NAMESPACE VULKAN_HPP_INLINE std::string to_string( ResolveModeFlags value ) { if ( !value ) - return "{}"; + return "None"; std::string result; if ( value & ResolveModeFlagBits::eSampleZero ) @@ -1511,7 +1511,7 @@ namespace VULKAN_HPP_NAMESPACE VULKAN_HPP_INLINE std::string to_string( PipelineStageFlags2 value ) { if ( !value ) - return "{}"; + return "None"; std::string result; if ( value & PipelineStageFlagBits2::eTopOfPipe ) @@ -1605,7 +1605,7 @@ namespace VULKAN_HPP_NAMESPACE VULKAN_HPP_INLINE std::string to_string( AccessFlags2 value ) { if ( !value ) - return "{}"; + return "None"; std::string result; if ( value & AccessFlagBits2::eIndirectCommandRead ) @@ -2012,7 +2012,7 @@ namespace VULKAN_HPP_NAMESPACE VULKAN_HPP_INLINE std::string to_string( VideoCodecOperationFlagsKHR value ) { if ( !value ) - return "{}"; + return "None"; std::string result; #if defined( VK_ENABLE_BETA_EXTENSIONS ) @@ -2032,7 +2032,7 @@ namespace VULKAN_HPP_NAMESPACE VULKAN_HPP_INLINE std::string to_string( VideoChromaSubsamplingFlagsKHR value ) { if ( !value ) - return "{}"; + return "Invalid"; std::string result; if ( value & VideoChromaSubsamplingFlagBitsKHR::eMonochrome ) @@ -2050,7 +2050,7 @@ namespace VULKAN_HPP_NAMESPACE VULKAN_HPP_INLINE std::string to_string( VideoComponentBitDepthFlagsKHR value ) { if ( !value ) - return "{}"; + return "Invalid"; std::string result; if ( value & VideoComponentBitDepthFlagBitsKHR::e8 ) @@ -2141,7 +2141,7 @@ namespace VULKAN_HPP_NAMESPACE VULKAN_HPP_INLINE std::string to_string( VideoDecodeUsageFlagsKHR value ) { if ( !value ) - return "{}"; + return "Default"; std::string result; if ( value & VideoDecodeUsageFlagBitsKHR::eTranscoding ) @@ -2339,7 +2339,7 @@ namespace VULKAN_HPP_NAMESPACE VULKAN_HPP_INLINE std::string to_string( VideoDecodeH264PictureLayoutFlagsKHR value ) { if ( !value ) - return "{}"; + return "Progressive"; std::string result; if ( value & VideoDecodeH264PictureLayoutFlagBitsKHR::eInterlacedInterleavedLines ) @@ -2817,7 +2817,7 @@ namespace VULKAN_HPP_NAMESPACE VULKAN_HPP_INLINE std::string to_string( VideoEncodeUsageFlagsKHR value ) { if ( !value ) - return "{}"; + return "Default"; std::string result; if ( value & VideoEncodeUsageFlagBitsKHR::eTranscoding ) @@ -2835,7 +2835,7 @@ namespace VULKAN_HPP_NAMESPACE VULKAN_HPP_INLINE std::string to_string( VideoEncodeContentFlagsKHR value ) { if ( !value ) - return "{}"; + return "Default"; std::string result; if ( value & VideoEncodeContentFlagBitsKHR::eCamera ) @@ -2856,7 +2856,7 @@ namespace VULKAN_HPP_NAMESPACE VULKAN_HPP_INLINE std::string to_string( VideoEncodeRateControlModeFlagsKHR value ) { if ( !value ) - return "{}"; + return "Default"; std::string result; if ( value & VideoEncodeRateControlModeFlagBitsKHR::eDisabled ) @@ -2953,7 +2953,7 @@ namespace VULKAN_HPP_NAMESPACE VULKAN_HPP_INLINE std::string to_string( ImageCompressionFlagsEXT value ) { if ( !value ) - return "{}"; + return "Default"; std::string result; if ( value & ImageCompressionFlagBitsEXT::eFixedRateDefault ) @@ -2969,7 +2969,7 @@ namespace VULKAN_HPP_NAMESPACE VULKAN_HPP_INLINE std::string to_string( ImageCompressionFixedRateFlagsEXT value ) { if ( !value ) - return "{}"; + return "None"; std::string result; if ( value & ImageCompressionFixedRateFlagBitsEXT::e1Bpc ) @@ -3141,7 +3141,7 @@ namespace VULKAN_HPP_NAMESPACE VULKAN_HPP_INLINE std::string to_string( OpticalFlowUsageFlagsNV value ) { if ( !value ) - return "{}"; + return "Unknown"; std::string result; if ( value & OpticalFlowUsageFlagBitsNV::eInput ) @@ -3161,7 +3161,7 @@ namespace VULKAN_HPP_NAMESPACE VULKAN_HPP_INLINE std::string to_string( OpticalFlowGridSizeFlagsNV value ) { if ( !value ) - return "{}"; + return "Unknown"; std::string result; if ( value & OpticalFlowGridSizeFlagBitsNV::e1X1 ) diff --git a/vulkan/vulkansc.hpp b/vulkan/vulkansc.hpp index 3ba35e6..cdc2118 100644 --- a/vulkan/vulkansc.hpp +++ b/vulkan/vulkansc.hpp @@ -3552,6 +3552,11 @@ namespace VULKAN_HPP_NAMESPACE return m_allocationCallbacks; } + Dispatch const & getDispatch() const VULKAN_HPP_NOEXCEPT + { + return *m_dispatch; + } + protected: template void destroy( T t ) VULKAN_HPP_NOEXCEPT @@ -3586,6 +3591,11 @@ namespace VULKAN_HPP_NAMESPACE return m_allocationCallbacks; } + Dispatch const & getDispatch() const VULKAN_HPP_NOEXCEPT + { + return *m_dispatch; + } + protected: template void destroy( T t ) VULKAN_HPP_NOEXCEPT @@ -3624,6 +3634,11 @@ namespace VULKAN_HPP_NAMESPACE return m_allocationCallbacks; } + Dispatch const & getDispatch() const VULKAN_HPP_NOEXCEPT + { + return *m_dispatch; + } + protected: template void destroy( T t ) VULKAN_HPP_NOEXCEPT @@ -3655,6 +3670,11 @@ namespace VULKAN_HPP_NAMESPACE return m_owner; } + Dispatch const & getDispatch() const VULKAN_HPP_NOEXCEPT + { + return *m_dispatch; + } + protected: template void destroy( T t ) VULKAN_HPP_NOEXCEPT @@ -3691,6 +3711,11 @@ namespace VULKAN_HPP_NAMESPACE return m_pool; } + Dispatch const & getDispatch() const VULKAN_HPP_NOEXCEPT + { + return *m_dispatch; + } + protected: template void destroy( T t ) VULKAN_HPP_NOEXCEPT @@ -6772,7 +6797,7 @@ namespace VULKAN_HPP_NAMESPACE # elif defined( __APPLE__ ) m_library = dlopen( "libvulkan.dylib", RTLD_NOW | RTLD_LOCAL ); # elif defined( _WIN32 ) - m_library = ::LoadLibraryA( "vulkan-1.dll" ); + m_library = ::LoadLibraryA( "vulkan-1.dll" ); # else # error unsupported platform # endif diff --git a/vulkan/vulkansc_to_string.hpp b/vulkan/vulkansc_to_string.hpp index 4c4da08..156cbb8 100644 --- a/vulkan/vulkansc_to_string.hpp +++ b/vulkan/vulkansc_to_string.hpp @@ -254,7 +254,7 @@ namespace VULKAN_HPP_NAMESPACE VULKAN_HPP_INLINE std::string to_string( PipelineStageFlags value ) { if ( !value ) - return "{}"; + return "None"; std::string result; if ( value & PipelineStageFlagBits::eTopOfPipe ) @@ -305,7 +305,7 @@ namespace VULKAN_HPP_NAMESPACE VULKAN_HPP_INLINE std::string to_string( ImageAspectFlags value ) { if ( !value ) - return "{}"; + return "None"; std::string result; if ( value & ImageAspectFlagBits::eColor ) @@ -515,7 +515,7 @@ namespace VULKAN_HPP_NAMESPACE VULKAN_HPP_INLINE std::string to_string( CullModeFlags value ) { if ( !value ) - return "{}"; + return "None"; std::string result; if ( value & CullModeFlagBits::eFront ) @@ -671,7 +671,7 @@ namespace VULKAN_HPP_NAMESPACE VULKAN_HPP_INLINE std::string to_string( AccessFlags value ) { if ( !value ) - return "{}"; + return "None"; std::string result; if ( value & AccessFlagBits::eIndirectCommandRead ) @@ -1076,7 +1076,7 @@ namespace VULKAN_HPP_NAMESPACE VULKAN_HPP_INLINE std::string to_string( ResolveModeFlags value ) { if ( !value ) - return "{}"; + return "None"; std::string result; if ( value & ResolveModeFlagBits::eSampleZero ) @@ -1149,7 +1149,7 @@ namespace VULKAN_HPP_NAMESPACE VULKAN_HPP_INLINE std::string to_string( PipelineStageFlags2 value ) { if ( !value ) - return "{}"; + return "None"; std::string result; if ( value & PipelineStageFlagBits2::eTopOfPipe ) @@ -1225,7 +1225,7 @@ namespace VULKAN_HPP_NAMESPACE VULKAN_HPP_INLINE std::string to_string( AccessFlags2 value ) { if ( !value ) - return "{}"; + return "None"; std::string result; if ( value & AccessFlagBits2::eIndirectCommandRead )