tools/spec: add some comments to the main function
This commit is contained in:
parent
7a5742bb57
commit
fa2eed7e03
@ -903,19 +903,20 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
src = open(args.src, 'r')
|
# Get a copy of the specification XML
|
||||||
|
with open(args.src, 'r') as src:
|
||||||
tree = ET.parse(src)
|
tree = ET.parse(src)
|
||||||
root = tree.getroot()
|
root = tree.getroot()
|
||||||
|
|
||||||
|
# Find a parser for each of the nodes in the XML
|
||||||
reg = registry()
|
reg = registry()
|
||||||
|
|
||||||
types = {}
|
|
||||||
|
|
||||||
for node in root:
|
for node in root:
|
||||||
target = "parse_%s" % node.tag
|
target = "parse_%s" % node.tag
|
||||||
globals()[target](reg, node)
|
globals()[target](reg, node)
|
||||||
|
|
||||||
|
# Override some requested system types so that they fit more naturally in
|
||||||
|
# our environment. eg, use appropriate C++ types, or cruft library
|
||||||
|
# wrappers.
|
||||||
reg.types['windows.h'].name = 'cruft/util/win32/windows.hpp'
|
reg.types['windows.h'].name = 'cruft/util/win32/windows.hpp'
|
||||||
reg.types['void*'] = placeholder('void*')
|
reg.types['void*'] = placeholder('void*')
|
||||||
reg.types['nullptr'] = placeholder('nullptr')
|
reg.types['nullptr'] = placeholder('nullptr')
|
||||||
@ -924,13 +925,18 @@ if __name__ == '__main__':
|
|||||||
reg.types['VK_DEFINE_HANDLE'] = aliastype("VK_DEFINE_HANDLE", "void*")
|
reg.types['VK_DEFINE_HANDLE'] = aliastype("VK_DEFINE_HANDLE", "void*")
|
||||||
reg.types['VK_NULL_HANDLE'] = aliasvalue("VK_NULL_HANDLE", "nullptr");
|
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 = [feature(n) for n in root.findall('./feature')]
|
||||||
features = dict((f.name,f) for f in features)
|
features = dict((f.name,f) for f in features)
|
||||||
|
|
||||||
#reg.extensions['VK_KHR_surface'].apply(reg, platform='xcb')
|
#reg.extensions['VK_KHR_surface'].apply(reg, platform='xcb')
|
||||||
|
|
||||||
|
# Request a minimal set of extensions that will almost certainly be
|
||||||
|
# required for all applications.
|
||||||
extensions = ["VK_KHR_swapchain", "VK_EXT_debug_report", "VK_KHR_external_memory"]
|
extensions = ["VK_KHR_swapchain", "VK_EXT_debug_report", "VK_KHR_external_memory"]
|
||||||
q = reg.serialise(args.platform)
|
q = reg.serialise(args.platform)
|
||||||
|
|
||||||
|
# Finally write out the header, icd, and dispatch code.
|
||||||
write_header(args.dst, q)
|
write_header(args.dst, q)
|
||||||
write_icd(args.icd, q)
|
write_icd(args.icd, q)
|
||||||
write_dispatch(args.dispatch, q)
|
write_dispatch(args.dispatch, q)
|
||||||
|
Loading…
Reference in New Issue
Block a user