MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Hpp / readExtension

Method readExtension

generator/VulkanHppGenerator.cpp:13421–13605  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13419}
13420
13421void VulkanHppGenerator::readExtension( tinyxml2::XMLElement const * element )
13422{
13423 int const line = element->GetLineNum();
13424 std::map<std::string, std::string> attributes = getAttributes( element );
13425 std::vector<tinyxml2::XMLElement const *> children = getChildElements( element );
13426
13427 checkAttributes( line,
13428 attributes,
13429 { { "name", {} }, { "number", {} }, { "supported", { "disabled", "vulkan", "vulkanbase", "vulkansc" } } },
13430 { { "author", {} },
13431 { "comment", {} },
13432 { "contact", {} },
13433 { "depends", {} },
13434 { "deprecatedby", {} },
13435 { "nofeatures", { "true" } },
13436 { "obsoletedby", {} },
13437 { "platform", {} },
13438 { "promotedto", {} },
13439 { "provisional", { "true" } },
13440 { "ratified", { "vulkan", "vulkansc" } },
13441 { "sortorder", { "1" } },
13442 { "specialuse", { "cadsupport", "d3demulation", "debugging", "devtools", "glemulation" } },
13443 { "type", { "device", "instance" } } } );
13444 checkElements( line, children, { { "require", MultipleAllowed::Yes } }, { { "deprecate", MultipleAllowed::Yes }, { "remove", MultipleAllowed::No } } );
13445
13446 // some special handling for two extensions
13447 std::string name = attributes.find( "name" )->second;
13448 if ( ( name == "VK_EXT_fragment_density_map_offset" ) || ( name == "VK_KHR_swapchain_mutable_format" ) )
13449 {
13450 auto dependsIt = attributes.find( "depends" );
13451 assert( dependsIt != attributes.end() );
13452 std::string depends = dependsIt->second;
13453 assert(
13454 ( name == "VK_EXT_fragment_density_map_offset" )
13455 ? ( depends ==
13456 "(VK_KHR_get_physical_device_properties2,VK_VERSION_1_1)+VK_EXT_fragment_density_map+(VK_KHR_create_renderpass2,VK_VERSION_1_2)+(VK_VERSION_1_3,VK_KHR_dynamic_rendering)" )
13457 : ( depends == "VK_KHR_swapchain+(VK_KHR_maintenance2,VK_VERSION_1_1)+(VK_KHR_image_format_list,VK_VERSION_1_2)" ) );
13458 dependsIt->second =
13459 ( name == "VK_EXT_fragment_density_map_offset" )
13460 ? "VK_EXT_fragment_density_map+(((VK_KHR_get_physical_device_properties2,VK_VERSION_1_1)+VK_KHR_create_renderpass2,VK_VERSION_1_2)+VK_KHR_dynamic_rendering,VK_VERSION_1_3)"
13461 : "VK_KHR_swapchain+((VK_KHR_maintenance2,VK_VERSION_1_1)+VK_KHR_image_format_list,VK_VERSION_1_2)";
13462 }
13463
13464 ExtensionData extensionData{ .xmlLine = line };
13465 for ( auto const & attribute : attributes )
13466 {
13467 if ( attribute.first == "depends" )
13468 {
13469 Parser parser( attribute.second );
13470 std::vector<std::vector<std::string>> dependencies = vectorize( normalize( parser.parse() ) );
13471 for ( auto & dep : dependencies )
13472 {
13473 auto featureIt = std::ranges::find_if( dep, []( std::string const & d ) { return d.starts_with( "VK_VERSION" ); } );
13474 if ( featureIt == dep.end() )
13475 {
13476 dep.insert( dep.begin(), "VK_VERSION_1_0" );
13477 }
13478 else if ( featureIt != dep.begin() )

Callers

nothing calls this directly

Calls 11

getAttributesFunction · 0.85
getChildElementsFunction · 0.85
checkAttributesFunction · 0.85
checkElementsFunction · 0.85
vectorizeFunction · 0.85
normalizeFunction · 0.85
checkForErrorFunction · 0.85
isNumberFunction · 0.85
tokenizeFunction · 0.85
containsByNameFunction · 0.85
parseMethod · 0.80

Tested by

no test coverage detected