Improve handling of disabled extensions.

This commit is contained in:
asuessenbach 2021-10-06 14:00:40 +02:00
parent 511437e473
commit fadacdf87b

View File

@ -12107,6 +12107,23 @@ void VulkanHppGenerator::readExtensionsExtension( tinyxml2::XMLElement const * e
{
int line = element->GetLineNum();
std::map<std::string, std::string> attributes = getAttributes( element );
std::vector<tinyxml2::XMLElement const *> children = getChildElements( element );
auto it = attributes.find( "supported" );
check( it != attributes.end(), line, "Missing attribute <supported> for extension!" );
if ( it->second == "disabled" )
{
checkElements( line, children, {}, { "require" } );
// kick out all the disabled stuff we've read before !!
for ( auto const & child : children )
{
assert( child->Value() == std::string( "require" ) );
readExtensionsExtensionDisabledRequire( child );
}
}
else
{
checkAttributes( line,
attributes,
{ { "name", {} }, { "number", {} }, { "supported", { "disabled", "enabled", "vulkan" } } },
@ -12123,7 +12140,6 @@ void VulkanHppGenerator::readExtensionsExtension( tinyxml2::XMLElement const * e
{ "sortorder", { "1" } },
{ "specialuse", { "cadsupport", "d3demulation", "debugging", "devtools", "glemulation" } },
{ "type", { "device", "instance" } } } );
std::vector<tinyxml2::XMLElement const *> children = getChildElements( element );
checkElements( line, children, { { "require", false } } );
std::string deprecatedBy, name, number, obsoletedBy, platform, promotedTo, supported;
@ -12186,20 +12202,10 @@ void VulkanHppGenerator::readExtensionsExtension( tinyxml2::XMLElement const * e
else if ( attribute.first == "supported" )
{
supported = attribute.second;
assert( supported != "disabled" );
}
}
if ( supported == "disabled" )
{
// kick out all the disabled stuff we've read before !!
for ( auto const & child : children )
{
assert( child->Value() == std::string( "require" ) );
readExtensionsExtensionDisabledRequire( child );
}
}
else
{
auto pitb = m_extensions.insert(
std::make_pair( name, ExtensionData( line, deprecatedBy, number, obsoletedBy, platform, promotedTo ) ) );
check( pitb.second, line, "already encountered extension <" + name + ">" );
@ -17045,8 +17051,8 @@ extern "C" __declspec( dllimport ) FARPROC __stdcall GetProcAddress( HINSTANCE h
tinyxml2::XMLError error = doc.LoadFile( filename.c_str() );
if ( error != tinyxml2::XML_SUCCESS )
{
std::cout << "VulkanHppGenerator: failed to load file " << filename << " with error <" << toString( error )
<< ">" << std::endl;
std::cout << "VulkanHppGenerator: failed to load file " << filename << " with error <" << toString( error ) << ">"
<< std::endl;
return -1;
}