tools/spec: Don't construct Feature directly from XML
This commit is contained in:
parent
c3d51883cb
commit
6e813ecc5e
@ -524,18 +524,9 @@ class Require(object):
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
class Feature(Type):
|
||||
def __init__(self, root):
|
||||
assert root.tag == 'feature'
|
||||
|
||||
name = root.attrib['name']
|
||||
def __init__(self, name: str, requires: List[Require] = []):
|
||||
super().__init__(name)
|
||||
|
||||
self.requires = []
|
||||
for node in root:
|
||||
if 'require' == node.tag:
|
||||
self.requires.append(Require(node))
|
||||
else:
|
||||
raise RuntimeError("Unhandled feature node")
|
||||
self.requires = requires
|
||||
|
||||
def define(self, reg: Registry):
|
||||
return "#define %s" % self.name
|
||||
@ -701,7 +692,14 @@ def parse_feature(reg: Registry, root):
|
||||
name = root.attrib['name']
|
||||
assert name not in reg.features
|
||||
|
||||
reg.features[name] = Feature(root)
|
||||
requires = []
|
||||
for node in root:
|
||||
if 'require' == node.tag:
|
||||
requires.append(Require(node))
|
||||
else:
|
||||
raise RuntimeError("Unhandled feature node")
|
||||
|
||||
reg.features[name] = Feature(name, requires)
|
||||
reg.types[name] = reg.features[name]
|
||||
|
||||
|
||||
@ -915,8 +913,8 @@ def main():
|
||||
reg.types['VK_NULL_HANDLE'] = AliasValue("VK_NULL_HANDLE", "nullptr")
|
||||
|
||||
# Request serialisation of all features
|
||||
features = [Feature(n) for n in root.findall('./feature')]
|
||||
features = dict((f.name,f) for f in features)
|
||||
#features = [Feature(n) for n in root.findall('./feature')]
|
||||
#features = dict((f.name,f) for f in features)
|
||||
|
||||
#reg.extensions['VK_KHR_surface'].apply(reg, platform='xcb')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user