diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index df43a97..12f133a 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -1023,7 +1023,16 @@ void VulkanHppGenerator::appendEnum( std::string & str, std::pair::iterator enumIt ) { int line = element->GetLineNum(); - checkAttributes( line, attributes, { { "name", {} } }, { { "bitpos", {} }, { "comment", {} }, { "value", {} } } ); + checkAttributes( + line, + attributes, + { { "name", {} } }, + { { "bitpos", {} }, { "comment", {} }, { "protect", { "VK_ENABLE_BETA_EXTENSIONS" } }, { "value", {} } } ); checkElements( line, getChildElements( element ), {} ); - std::string alias, bitpos, name, value; + std::string alias, bitpos, name, protect, value; for ( auto const & attribute : attributes ) { if ( attribute.first == "bitpos" ) @@ -12729,6 +12740,10 @@ void VulkanHppGenerator::readEnum( tinyxml2::XMLElement const * el { name = attribute.second; } + else if ( attribute.first == "protect" ) + { + protect = attribute.second; + } else if ( attribute.first == "value" ) { value = attribute.second; @@ -12741,7 +12756,7 @@ void VulkanHppGenerator::readEnum( tinyxml2::XMLElement const * el "encountered enum value <" + name + "> that does not begin with expected prefix <" + prefix + ">" ); check( bitpos.empty() ^ value.empty(), line, "invalid set of attributes for enum <" + name + ">" ); - enumIt->second.addEnumValue( line, name, !bitpos.empty(), "" ); + enumIt->second.addEnumValue( line, name, protect, !bitpos.empty(), "" ); } void VulkanHppGenerator::readEnumAlias( tinyxml2::XMLElement const * element, @@ -13685,7 +13700,7 @@ void VulkanHppGenerator::readRequireEnum( tinyxml2::XMLElement const * line, "exactly one out of bitpos = <" + bitpos + ">, offset = <" + offset + ">, and value = <" + value + "> are supposed to be empty" ); - enumIt->second.addEnumValue( element->GetLineNum(), name, !bitpos.empty(), extension ); + enumIt->second.addEnumValue( element->GetLineNum(), name, "", !bitpos.empty(), extension ); } else if ( value.empty() ) { diff --git a/VulkanHppGenerator.hpp b/VulkanHppGenerator.hpp index 62c44d0..e51d1f5 100644 --- a/VulkanHppGenerator.hpp +++ b/VulkanHppGenerator.hpp @@ -138,12 +138,17 @@ private: struct EnumValueData { - EnumValueData( int line, std::string const & name_, std::string const & extension_, bool singleBit_ ) - : name( name_ ), extension( extension_ ), singleBit( singleBit_ ), xmlLine( line ) + EnumValueData( int line, + std::string const & name_, + std::string const & protect_, + std::string const & extension_, + bool singleBit_ ) + : name( name_ ), extension( extension_ ), protect( protect_ ), singleBit( singleBit_ ), xmlLine( line ) {} std::string name; std::string extension; + std::string protect; bool singleBit; int xmlLine; }; @@ -152,7 +157,11 @@ private: { EnumData( int line ) : xmlLine( line ) {} void addEnumAlias( int line, std::string const & name, std::string const & alias ); - void addEnumValue( int line, std::string const & valueName, bool bitpos, std::string const & extension ); + void addEnumValue( int line, + std::string const & valueName, + std::string const & protect, + bool bitpos, + std::string const & extension ); std::string alias; // alias for this enum std::map aliases; // aliases for the values