From 8a53e8da061450132795878f6860c4aa692aa777 Mon Sep 17 00:00:00 2001 From: asuessenbach Date: Mon, 2 Nov 2020 15:15:35 +0100 Subject: [PATCH] Update to VK_HEADER_VERSION 159. --- Vulkan-Headers | 2 +- VulkanHppGenerator.cpp | 276 ++++++++++++++++++++++++++++++++++++++++- VulkanHppGenerator.hpp | 10 ++ vulkan/vulkan.hpp | 113 ++++++++++++++++- 4 files changed, 395 insertions(+), 6 deletions(-) diff --git a/Vulkan-Headers b/Vulkan-Headers index 320af06..87451c5 160000 --- a/Vulkan-Headers +++ b/Vulkan-Headers @@ -1 +1 @@ -Subproject commit 320af06cbdd29848e1d7100d9b8e4e517db1dfd5 +Subproject commit 87451c55aa8b4f00831fab6ffc4b721d0f148102 diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index bb87e06..ea3ccb0 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -723,7 +723,7 @@ VulkanHppGenerator::VulkanHppGenerator( tinyxml2::XMLDocument const & document ) checkElements( line, elements, { { "registry", true } } ); check( elements.size() == 1, line, - "encountered " + std::to_string( elements.size() ) + " elments named but only one is allowed" ); + "encountered " + std::to_string( elements.size() ) + " elements named but only one is allowed" ); readRegistry( elements[0] ); checkCorrectness(); } @@ -8555,6 +8555,8 @@ void VulkanHppGenerator::readRegistry( tinyxml2::XMLElement const * element ) { "extensions", true }, { "feature", false }, { "platforms", true }, + { "spirvcapabilities", true }, + { "spirvextensions", true }, { "tags", true }, { "types", true } } ); for ( auto child : children ) @@ -8588,6 +8590,14 @@ void VulkanHppGenerator::readRegistry( tinyxml2::XMLElement const * element ) { readPlatforms( child ); } + else if ( value == "spirvcapabilities" ) + { + readSPIRVCapabilities( child ); + } + else if ( value == "spirvextensions" ) + { + readSPIRVExtensions( child ); + } else if ( value == "tags" ) { readTags( child ); @@ -8747,6 +8757,270 @@ void VulkanHppGenerator::readRequires( tinyxml2::XMLElement const * } } +void VulkanHppGenerator::readSPIRVCapability( tinyxml2::XMLElement const * element ) +{ + int line = element->GetLineNum(); + std::map attributes = getAttributes( element ); + checkAttributes( line, attributes, { { "name", {} } }, {} ); + std::vector children = getChildElements( element ); + checkElements( line, children, {}, { "enable" } ); + + for ( auto child : children ) + { + std::string value = child->Value(); + assert( value == "enable" ); + readSPIRVCapabilityEnable( child ); + } +} + +void VulkanHppGenerator::readSPIRVCapabilityEnable( tinyxml2::XMLElement const * element ) +{ + int line = element->GetLineNum(); + std::map attributes = getAttributes( element ); + checkElements( line, getChildElements( element ), {}, {} ); + + if ( attributes.find( "extension" ) != attributes.end() ) + { + readSPIRVCapabilityEnableExtension( line, attributes ); + } + else if ( attributes.find( "property" ) != attributes.end() ) + { + readSPIRVCapabilityEnableProperty( line, attributes ); + } + else if ( attributes.find( "struct" ) != attributes.end() ) + { + readSPIRVCapabilityEnableStruct( line, attributes ); + } + else if ( attributes.find( "version" ) != attributes.end() ) + { + readSPIRVCapabilityEnableVersion( line, attributes ); + } + else + { + check( false, line, "unknown set of attributes specified for SPIR-V capability" ); + } +} + +void VulkanHppGenerator::readSPIRVCapabilityEnableExtension( int xmlLine, + std::map const & attributes ) +{ + checkAttributes( xmlLine, attributes, { { "extension", {} } }, {} ); + + check( attributes.size() == 1, + xmlLine, + "unexpected attributes in addition to specified for SPIR-V capability" ); + for ( auto const & attribute : attributes ) + { + assert( attribute.first == "extension" ); + check( m_extensions.find( attribute.second ) != m_extensions.end(), + xmlLine, + "unknown extension <" + attribute.second + "> specified for SPIR-V capability" ); + } +} + +void VulkanHppGenerator::readSPIRVCapabilityEnableProperty( int xmlLine, + std::map const & attributes ) +{ + checkAttributes( + xmlLine, attributes, { { "member", {} }, { "property", {} }, { "requires", {} }, { "value", {} } }, {} ); + + std::string member, property, value; + for ( auto const & attribute : attributes ) + { + if ( attribute.first == "member" ) + { + member = attribute.second; + } + else if ( attribute.first == "property" ) + { + property = attribute.second; + } + if ( attribute.first == "requires" ) + { + std::vector requires = tokenize( attribute.second, "," ); + for ( auto const & r : requires ) + { + check( ( m_features.find( r ) != m_features.end() ) || ( m_extensions.find( r ) != m_extensions.end() ), + xmlLine, + "unknown requires <" + r + "> specified for SPIR-V capability" ); + } + } + else if ( attribute.first == "value" ) + { + value = attribute.second; + } + } + assert( !member.empty() && !property.empty() && !value.empty() ); + + auto propertyIt = m_structures.find( property ); + check( + propertyIt != m_structures.end(), xmlLine, "unknown property <" + property + "> specified for SPIR-V capability" ); + auto memberIt = std::find_if( propertyIt->second.members.begin(), + propertyIt->second.members.end(), + [&member]( MemberData const & md ) { return md.name == member; } ); + check( memberIt != propertyIt->second.members.end(), + xmlLine, + "unknown member <" + member + "> specified for SPIR-V capability" ); + if ( memberIt->type.type == "VkBool32" ) + { + check( ( value == "VK_FALSE" ) || ( value == "VK_TRUE" ), + xmlLine, + "unknown value <" + value + "> for boolean member <" + member + "> specified for SPIR-V capability" ); + } + else + { + auto bitmaskIt = m_bitmasks.find( memberIt->type.type ); + check( bitmaskIt != m_bitmasks.end(), + xmlLine, + "attribute member = <" + member + "> specified for SPIR-V capability is not a bitmask" ); + assert( !bitmaskIt->second.requirements.empty() ); + auto enumIt = m_enums.find( bitmaskIt->second.requirements ); + check( enumIt != m_enums.end(), + xmlLine, + "attribute member = <" + member + "> specified for SPIR-V capability requires an unknown enum <" + + bitmaskIt->second.requirements + ">" ); + auto valueIt = std::find_if( enumIt->second.values.begin(), + enumIt->second.values.end(), + [&value]( EnumValueData const & evd ) { return evd.vulkanValue == value; } ); + check( valueIt != enumIt->second.values.end(), + xmlLine, + "unknown attribute value = <" + value + "> specified for SPIR-V capability" ); + } +} + +void VulkanHppGenerator::readSPIRVCapabilityEnableStruct( int xmlLine, + std::map const & attributes ) +{ + checkAttributes( xmlLine, attributes, { { "feature", {} }, { "struct", {} } }, { { "alias", {} }, { "requires", {} } } ); + + for ( auto const & attribute : attributes ) + { + if ( attribute.first == "requires" ) + { + std::vector requires = tokenize( attribute.second, "," ); + for ( auto const & r : requires ) + { + check( ( m_features.find( r ) != m_features.end() ) || ( m_extensions.find( r ) != m_extensions.end() ), + xmlLine, + "unknown requires <" + r + "> specified for SPIR-V capability" ); + } + } + else if ( attribute.first == "struct" ) + { + check( m_structures.find( attribute.second ) != m_structures.end(), + xmlLine, + "unknown structure <" + attribute.second + "> specified for SPIR-V capability" ); + check( attributes.find( "feature" ) != attributes.end(), + xmlLine, + "missing feature attribute for SPIR-V capability specified with struct <" + attribute.second + ">" ); + } + else + { + assert( ( attribute.first == "alias" ) || ( attribute.first == "feature" ) ); + } + } +} + +void VulkanHppGenerator::readSPIRVCapabilityEnableVersion( int xmlLine, + std::map const & attributes ) +{ + checkAttributes( xmlLine, attributes, { { "version", {} } }, {} ); + + check( + attributes.size() == 1, xmlLine, "unexpected attributes in addition to specified for SPIR-V capability" ); + for ( auto const & attribute : attributes ) + { + assert( attribute.first == "version" ); + check( beginsWith( attribute.second, "VK_API_VERSION_" ), + xmlLine, + "unknown version <" + attribute.second + "> specified for SPIR-V capability" ); + std::string feature = attribute.second; + feature.erase( 3, 4 ); // remove "API_" from the version -> VK_VERSION_x_y + check( m_features.find( feature ) != m_features.end(), + xmlLine, + "unknown version <" + attribute.second + "> specified for SPIR-V capability" ); + } +} + +void VulkanHppGenerator::readSPIRVCapabilities( tinyxml2::XMLElement const * element ) +{ + int line = element->GetLineNum(); + std::map attributes = getAttributes( element ); + checkAttributes( line, attributes, { { "comment", {} } }, {} ); + std::vector children = getChildElements( element ); + checkElements( line, children, {}, { "spirvcapability" } ); + + for ( auto child : children ) + { + std::string value = child->Value(); + assert( value == "spirvcapability" ); + readSPIRVCapability( child ); + } +} + +void VulkanHppGenerator::readSPIRVExtension( tinyxml2::XMLElement const * element ) +{ + int line = element->GetLineNum(); + std::map attributes = getAttributes( element ); + checkAttributes( line, attributes, { { "name", {} } }, {} ); + std::vector children = getChildElements( element ); + checkElements( line, children, {}, { "enable" } ); + + for ( auto child : children ) + { + std::string value = child->Value(); + assert( value == "enable" ); + readSPIRVExtensionEnable( child ); + } +} + +void VulkanHppGenerator::readSPIRVExtensionEnable( tinyxml2::XMLElement const * element ) +{ + int line = element->GetLineNum(); + std::map attributes = getAttributes( element ); + checkAttributes( line, attributes, {}, { { "extension", {} }, { "version", {} } } ); + checkElements( line, getChildElements( element ), {}, {} ); + + check( !attributes.empty(), line, "no version or extension specified for SPIR-V extension" ); + for ( auto const & attribute : attributes ) + { + if ( attribute.first == "extension" ) + { + check( m_extensions.find( attribute.second ) != m_extensions.end(), + line, + "unknown extension <" + attribute.second + "> specified for SPIR-V extension" ); + } + else + { + assert( attribute.first == "version" ); + check( beginsWith( attribute.second, "VK_API_VERSION_" ), + line, + "unknown version <" + attribute.second + "> specified for SPIR-V extension" ); + std::string feature = attribute.second; + feature.erase( 3, 4 ); // remove "API_" from the version -> VK_VERSION_x_y + check( m_features.find( feature ) != m_features.end(), + line, + "unknown version <" + attribute.second + "> specified for SPIR-V extension" ); + } + } +} + +void VulkanHppGenerator::readSPIRVExtensions( tinyxml2::XMLElement const * element ) +{ + int line = element->GetLineNum(); + std::map attributes = getAttributes( element ); + checkAttributes( line, attributes, { { "comment", {} } }, {} ); + std::vector children = getChildElements( element ); + checkElements( line, children, {}, { "spirvextension" } ); + + for ( auto child : children ) + { + std::string value = child->Value(); + assert( value == "spirvextension" ); + readSPIRVExtension( child ); + } +} + void VulkanHppGenerator::readStruct( tinyxml2::XMLElement const * element, bool isUnion, std::map const & attributes ) diff --git a/VulkanHppGenerator.hpp b/VulkanHppGenerator.hpp index b8a9f4b..2085386 100644 --- a/VulkanHppGenerator.hpp +++ b/VulkanHppGenerator.hpp @@ -735,6 +735,16 @@ private: std::map const & attributes, std::string const & tag ); void readRequires( tinyxml2::XMLElement const * element, std::map const & attributes ); + void readSPIRVCapability( tinyxml2::XMLElement const * element ); + void readSPIRVCapabilityEnable( tinyxml2::XMLElement const * element ); + void readSPIRVCapabilityEnableExtension( int xmlLine, std::map const & attributes ); + void readSPIRVCapabilityEnableProperty( int xmlLine, std::map const & attributes ); + void readSPIRVCapabilityEnableStruct( int xmlLine, std::map const & attributes ); + void readSPIRVCapabilityEnableVersion( int xmlLine, std::map const & attributes ); + void readSPIRVCapabilities( tinyxml2::XMLElement const * element ); + void readSPIRVExtension( tinyxml2::XMLElement const * element ); + void readSPIRVExtensionEnable( tinyxml2::XMLElement const * element ); + void readSPIRVExtensions( tinyxml2::XMLElement const * element ); void readStruct( tinyxml2::XMLElement const * element, bool isUnion, std::map const & attributes ); diff --git a/vulkan/vulkan.hpp b/vulkan/vulkan.hpp index 18f6696..b74a3fb 100644 --- a/vulkan/vulkan.hpp +++ b/vulkan/vulkan.hpp @@ -93,7 +93,7 @@ extern "C" __declspec( dllimport ) FARPROC __stdcall GetProcAddress( HINSTANCE h # include #endif -static_assert( VK_HEADER_VERSION == 158, "Wrong VK_HEADER_VERSION!" ); +static_assert( VK_HEADER_VERSION == 159, "Wrong VK_HEADER_VERSION!" ); // 32-bit vulkan is not typesafe for 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 @@ -8158,8 +8158,8 @@ namespace VULKAN_HPP_NAMESPACE enum class PerformanceCounterDescriptionFlagBitsKHR : VkPerformanceCounterDescriptionFlagsKHR { - ePerformanceImpacting = VK_PERFORMANCE_COUNTER_DESCRIPTION_PERFORMANCE_IMPACTING_KHR, - eConcurrentlyImpacted = VK_PERFORMANCE_COUNTER_DESCRIPTION_CONCURRENTLY_IMPACTED_KHR + ePerformanceImpacting = VK_PERFORMANCE_COUNTER_DESCRIPTION_PERFORMANCE_IMPACTING_BIT_KHR, + eConcurrentlyImpacted = VK_PERFORMANCE_COUNTER_DESCRIPTION_CONCURRENTLY_IMPACTED_BIT_KHR }; VULKAN_HPP_INLINE std::string to_string( PerformanceCounterDescriptionFlagBitsKHR value ) @@ -9960,6 +9960,7 @@ namespace VULKAN_HPP_NAMESPACE VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_FEATURES_EXT, ePhysicalDeviceFragmentDensityMap2PropertiesEXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_PROPERTIES_EXT, + eCopyCommandTransformInfoQCOM = VK_STRUCTURE_TYPE_COPY_COMMAND_TRANSFORM_INFO_QCOM, ePhysicalDeviceImageRobustnessFeaturesEXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_ROBUSTNESS_FEATURES_EXT, eCopyBufferInfo2KHR = VK_STRUCTURE_TYPE_COPY_BUFFER_INFO_2_KHR, eCopyImageInfo2KHR = VK_STRUCTURE_TYPE_COPY_IMAGE_INFO_2_KHR, @@ -10678,6 +10679,7 @@ namespace VULKAN_HPP_NAMESPACE return "PhysicalDeviceFragmentDensityMap2FeaturesEXT"; case StructureType::ePhysicalDeviceFragmentDensityMap2PropertiesEXT: return "PhysicalDeviceFragmentDensityMap2PropertiesEXT"; + case StructureType::eCopyCommandTransformInfoQCOM: return "CopyCommandTransformInfoQCOM"; case StructureType::ePhysicalDeviceImageRobustnessFeaturesEXT: return "PhysicalDeviceImageRobustnessFeaturesEXT"; case StructureType::eCopyBufferInfo2KHR: return "CopyBufferInfo2KHR"; case StructureType::eCopyImageInfo2KHR: return "CopyImageInfo2KHR"; @@ -10764,7 +10766,7 @@ namespace VULKAN_HPP_NAMESPACE enum class SurfaceCounterFlagBitsEXT : VkSurfaceCounterFlagsEXT { - eVblank = VK_SURFACE_COUNTER_VBLANK_EXT + eVblank = VK_SURFACE_COUNTER_VBLANK_BIT_EXT }; VULKAN_HPP_INLINE std::string to_string( SurfaceCounterFlagBitsEXT value ) @@ -29008,6 +29010,93 @@ namespace VULKAN_HPP_NAMESPACE using Type = CopyBufferToImageInfo2KHR; }; + struct CopyCommandTransformInfoQCOM + { + static const bool allowDuplicate = false; + static VULKAN_HPP_CONST_OR_CONSTEXPR StructureType structureType = StructureType::eCopyCommandTransformInfoQCOM; + +#if !defined( VULKAN_HPP_NO_STRUCT_CONSTRUCTORS ) + VULKAN_HPP_CONSTEXPR + CopyCommandTransformInfoQCOM( VULKAN_HPP_NAMESPACE::SurfaceTransformFlagBitsKHR transform_ = + VULKAN_HPP_NAMESPACE::SurfaceTransformFlagBitsKHR::eIdentity ) VULKAN_HPP_NOEXCEPT + : transform( transform_ ) + {} + + VULKAN_HPP_CONSTEXPR + CopyCommandTransformInfoQCOM( CopyCommandTransformInfoQCOM const & rhs ) VULKAN_HPP_NOEXCEPT = default; + + CopyCommandTransformInfoQCOM( VkCopyCommandTransformInfoQCOM const & rhs ) VULKAN_HPP_NOEXCEPT + { + *this = rhs; + } +#endif // !defined( VULKAN_HPP_NO_STRUCT_CONSTRUCTORS ) + + CopyCommandTransformInfoQCOM & operator=( VkCopyCommandTransformInfoQCOM const & rhs ) VULKAN_HPP_NOEXCEPT + { + *this = *reinterpret_cast( &rhs ); + return *this; + } + + CopyCommandTransformInfoQCOM & operator=( CopyCommandTransformInfoQCOM const & rhs ) VULKAN_HPP_NOEXCEPT + { + memcpy( static_cast( this ), &rhs, sizeof( CopyCommandTransformInfoQCOM ) ); + return *this; + } + + CopyCommandTransformInfoQCOM & setPNext( const void * pNext_ ) VULKAN_HPP_NOEXCEPT + { + pNext = pNext_; + return *this; + } + + CopyCommandTransformInfoQCOM & + setTransform( VULKAN_HPP_NAMESPACE::SurfaceTransformFlagBitsKHR transform_ ) VULKAN_HPP_NOEXCEPT + { + transform = transform_; + return *this; + } + + operator VkCopyCommandTransformInfoQCOM const &() const VULKAN_HPP_NOEXCEPT + { + return *reinterpret_cast( this ); + } + + operator VkCopyCommandTransformInfoQCOM &() VULKAN_HPP_NOEXCEPT + { + return *reinterpret_cast( this ); + } + +#if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR ) + auto operator<=>( CopyCommandTransformInfoQCOM const & ) const = default; +#else + bool operator==( CopyCommandTransformInfoQCOM const & rhs ) const VULKAN_HPP_NOEXCEPT + { + return ( sType == rhs.sType ) && ( pNext == rhs.pNext ) && ( transform == rhs.transform ); + } + + bool operator!=( CopyCommandTransformInfoQCOM const & rhs ) const VULKAN_HPP_NOEXCEPT + { + return !operator==( rhs ); + } +#endif + + public: + const VULKAN_HPP_NAMESPACE::StructureType sType = StructureType::eCopyCommandTransformInfoQCOM; + const void * pNext = {}; + VULKAN_HPP_NAMESPACE::SurfaceTransformFlagBitsKHR transform = + VULKAN_HPP_NAMESPACE::SurfaceTransformFlagBitsKHR::eIdentity; + }; + static_assert( sizeof( CopyCommandTransformInfoQCOM ) == sizeof( VkCopyCommandTransformInfoQCOM ), + "struct and wrapper have different size!" ); + static_assert( std::is_standard_layout::value, + "struct wrapper is not a standard layout!" ); + + template <> + struct CppType + { + using Type = CopyCommandTransformInfoQCOM; + }; + class DescriptorSet { public: @@ -106969,6 +107058,22 @@ namespace VULKAN_HPP_NAMESPACE value = true }; }; + template <> + struct StructExtends + { + enum + { + value = true + }; + }; + template <> + struct StructExtends + { + enum + { + value = true + }; + }; #ifdef VK_USE_PLATFORM_WIN32_KHR template <> struct StructExtends