Added test on existence of ObjectType enum value corresponding to handle type in extensions. (#477)

This commit is contained in:
Andreas Süßenbach 2020-01-10 10:18:55 +01:00 committed by Markus Tavenrath
parent 8d62969b4d
commit 979af1b46e

View File

@ -3806,10 +3806,23 @@ void VulkanHppGenerator::readExtensionRequireType(tinyxml2::XMLElement const* el
checkElements(getChildElements(element), {});
// add the protect-string to the appropriate type: enum, flag, handle, scalar, or struct
std::string name = attributes.find("name")->second;
auto handleIt = m_handles.find(name);
if (handleIt != m_handles.end())
{
assert(beginsWith(name, "Vk"));
auto objectTypeIt = m_enums.find("VkObjectType");
assert(objectTypeIt != m_enums.end());
std::string objectTypeName = "e" + stripPrefix(handleIt->first, "Vk");
if (std::find_if(objectTypeIt->second.values.begin(), objectTypeIt->second.values.end(), [objectTypeName](EnumValueData const& evd) {return evd.vkValue == objectTypeName; }) == objectTypeIt->second.values.end())
{
throw std::runtime_error("Spec error on line " + std::to_string(element->GetLineNum()) + ": missing entry in VkObjectType enum for handle <" + name + ">.");
}
}
if (!platform.empty())
{
std::string name = attributes.find("name")->second;
auto bmit = m_bitmasks.find(name);
if (bmit != m_bitmasks.end())
{