Update of vk.xml to version 134; resolve warnings

Resolves #535
This commit is contained in:
asuessenbach 2020-03-09 11:23:46 +01:00 committed by Markus Tavenrath
parent cd554ce9e0
commit 87cecae683
4 changed files with 4164 additions and 1759 deletions

@ -1 +1 @@
Subproject commit f63dd5c9d874310c8403f3aef9302b761efedd18 Subproject commit 74556a131735598a5ae7a94ec5500a9d9f908b3a

View File

@ -196,7 +196,7 @@ void checkAttributes(int line, std::map<std::string, std::string> const& attribu
std::vector<std::string> values = tokenize(a.second, ','); std::vector<std::string> values = tokenize(a.second, ',');
for (auto const& v : values) for (auto const& v : values)
{ {
check(optionalIt->second.find(v) != optionalIt->second.end(), line, "unexpected attribute value <" + v + "> in attribute <" + a.first + ">"); warn(optionalIt->second.find(v) != optionalIt->second.end(), line, "unexpected attribute value <" + v + "> in attribute <" + a.first + ">");
} }
} }
} }
@ -4010,21 +4010,33 @@ std::string VulkanHppGenerator::readComment(tinyxml2::XMLElement const* element)
void VulkanHppGenerator::readDefine(tinyxml2::XMLElement const* element, std::map<std::string, std::string> const& attributes) void VulkanHppGenerator::readDefine(tinyxml2::XMLElement const* element, std::map<std::string, std::string> const& attributes)
{ {
int line = element->GetLineNum(); int line = element->GetLineNum();
checkAttributes(line, attributes, { { "category",{ "define" } } }, { { "name",{} } }); checkAttributes(line, attributes, { { "category",{ "define" } } }, { { "name",{} }, { "requires", {} } });
auto nameIt = attributes.find("name"); std::string name;
if (nameIt != attributes.end()) for (auto const& attribute : attributes)
{ {
check(!element->FirstChildElement(), line, "unknown formatting of type category=define name <" + nameIt->second + ">"); if (attribute.first == "name")
check(nameIt->second == "VK_DEFINE_NON_DISPATCHABLE_HANDLE", line, "unknown type category=define name <" + nameIt->second + ">"); {
check(element->LastChild() && element->LastChild()->ToText() && element->LastChild()->ToText()->Value(), line, "unknown formatting of type category=define named <" + nameIt->second + ">"); name = attribute.second;
}
else if (attribute.first == "requires")
{
check(m_defines.find(attribute.second) != m_defines.end(), line, "using undefined requires <" + attribute.second + ">");
}
}
if (!name.empty())
{
check(!element->FirstChildElement(), line, "unknown formatting of type category=define name <" + name + ">");
check(name == "VK_DEFINE_NON_DISPATCHABLE_HANDLE", line, "unknown type category=define name <" + name + ">");
check(element->LastChild() && element->LastChild()->ToText() && element->LastChild()->ToText()->Value(), line, "unknown formatting of type category=define named <" + name + ">");
// filter out the check for the different types of VK_DEFINE_NON_DISPATCHABLE_HANDLE // filter out the check for the different types of VK_DEFINE_NON_DISPATCHABLE_HANDLE
std::string text = element->LastChild()->ToText()->Value(); std::string text = element->LastChild()->ToText()->Value();
size_t start = text.find("#if defined(__LP64__)"); size_t start = text.find("#if defined(__LP64__)");
check(start != std::string::npos, line, "unexpected text in type category=define named <" + nameIt->second + ">"); check(start != std::string::npos, line, "unexpected text in type category=define named <" + name + ">");
size_t end = text.find_first_of("\r\n", start + 1); size_t end = text.find_first_of("\r\n", start + 1);
check(end != std::string::npos, line, "unexpected text in type category=define named <" + nameIt->second + ">"); check(end != std::string::npos, line, "unexpected text in type category=define named <" + name + ">");
m_typesafeCheck = text.substr(start, end - start); m_typesafeCheck = text.substr(start, end - start);
} }
else if (element->GetText()) else if (element->GetText())
@ -4035,15 +4047,15 @@ void VulkanHppGenerator::readDefine(tinyxml2::XMLElement const* element, std::ma
// here are a couple of structs as defines, which really are types! // here are a couple of structs as defines, which really are types!
tinyxml2::XMLElement const* child = element->FirstChildElement(); tinyxml2::XMLElement const* child = element->FirstChildElement();
check(child && (strcmp(child->Value(), "name") == 0) && child->GetText(), line, "unexpected formatting of type category=define"); check(child && (strcmp(child->Value(), "name") == 0) && child->GetText(), line, "unexpected formatting of type category=define");
text = child->GetText(); name = child->GetText();
check(m_types.insert(text).second, line, "type <" + text + "> has already been speficied"); check(m_types.insert(name).second, line, "type <" + name + "> has already been speficied");
} }
else else
{ {
tinyxml2::XMLElement const* child = element->FirstChildElement(); tinyxml2::XMLElement const* child = element->FirstChildElement();
check(child && !child->FirstAttribute() && (strcmp(child->Value(), "name") == 0) && child->GetText(), line, "unknown formatting of type category define"); check(child && !child->FirstAttribute() && (strcmp(child->Value(), "name") == 0) && child->GetText(), line, "unknown formatting of type category define");
text = trim(child->GetText()); name = trim(child->GetText());
if (text == "VK_HEADER_VERSION") if (name == "VK_HEADER_VERSION")
{ {
m_version = trimEnd(element->LastChild()->ToText()->Value()); m_version = trimEnd(element->LastChild()->ToText()->Value());
} }
@ -4051,6 +4063,9 @@ void VulkanHppGenerator::readDefine(tinyxml2::XMLElement const* element, std::ma
warn(!child->NextSiblingElement() || (child->NextSiblingElement() && !child->NextSiblingElement()->FirstAttribute() && (strcmp(child->NextSiblingElement()->Value(), "type") == 0) && !child->NextSiblingElement()->NextSiblingElement()), line, "unknown formatting of type category define"); warn(!child->NextSiblingElement() || (child->NextSiblingElement() && !child->NextSiblingElement()->FirstAttribute() && (strcmp(child->NextSiblingElement()->Value(), "type") == 0) && !child->NextSiblingElement()->NextSiblingElement()), line, "unknown formatting of type category define");
} }
} }
assert(!name.empty());
check(m_defines.insert(name).second, line, "define <" + name + "> has already been specified");
} }
void VulkanHppGenerator::readEnum(tinyxml2::XMLElement const* element, EnumData & enumData, bool bitmask, std::string const& prefix, std::string const& postfix) void VulkanHppGenerator::readEnum(tinyxml2::XMLElement const* element, EnumData & enumData, bool bitmask, std::string const& prefix, std::string const& postfix)
@ -4257,6 +4272,7 @@ void VulkanHppGenerator::readExtension(tinyxml2::XMLElement const* element)
{ "provisional", { "true" } }, { "provisional", { "true" } },
{ "requires",{} }, { "requires",{} },
{ "requiresCore",{} }, { "requiresCore",{} },
{ "specialuse", { "cadsupport", "d3demulation", "debugging", "devtools", "glemulation"} },
{ "type",{ "device", "instance" } } { "type",{ "device", "instance" } }
}); });
std::vector<tinyxml2::XMLElement const*> children = getChildElements(element); std::vector<tinyxml2::XMLElement const*> children = getChildElements(element);

View File

@ -337,6 +337,7 @@ class VulkanHppGenerator
std::map<std::string, BitmaskData> m_bitmasks; std::map<std::string, BitmaskData> m_bitmasks;
std::map<std::string, std::string> m_commandToHandle; std::map<std::string, std::string> m_commandToHandle;
std::set<std::string> m_constants; std::set<std::string> m_constants;
std::set<std::string> m_defines;
std::map<std::string, EnumData> m_enums; std::map<std::string, EnumData> m_enums;
std::set<std::string> m_extendedStructs; // structs which are referenced by the structextends tag std::set<std::string> m_extendedStructs; // structs which are referenced by the structextends tag
std::map<std::string, ExtensionData> m_extensions; std::map<std::string, ExtensionData> m_extensions;

File diff suppressed because it is too large Load Diff