|
120 | 120 | #endif |
121 | 121 | % else: |
122 | 122 | table->${cmd.name[2:]} = (PFN_${cmd.name}) gpa(instance, "${cmd.name}"); |
| 123 | + % for alias in cmd.aliases: |
| 124 | + if (table->${cmd.name[2:]} == NULL) |
| 125 | + table->${cmd.name[2:]} = (PFN_${cmd.name}) gpa(instance, "${alias}"); |
| 126 | + % endfor |
123 | 127 | % endif |
124 | 128 | % endif |
125 | 129 | %endfor |
|
139 | 143 | #endif |
140 | 144 | % else: |
141 | 145 | table->${cmd.name[2:]} = (PFN_${cmd.name}) gpa(device, "${cmd.name}"); |
| 146 | + % for alias in cmd.aliases: |
| 147 | + if (table->${cmd.name[2:]} == NULL) |
| 148 | + table->${cmd.name[2:]} = (PFN_${cmd.name}) gpa(instance, "${alias}"); |
| 149 | + % endfor |
142 | 150 | % endif |
143 | 151 | % endif |
144 | 152 | %endfor |
@@ -320,6 +328,7 @@ def __init__(self, name, device_entrypoint=False): |
320 | 328 | self.name = name |
321 | 329 | self.device_entrypoint = device_entrypoint |
322 | 330 | self.extension = None |
| 331 | + self.aliases = [] |
323 | 332 |
|
324 | 333 |
|
325 | 334 | class VkChainStruct(object): |
@@ -362,11 +371,22 @@ def parse_xml(cmd_factory, enum_factory, ext_factory, struct_factory, filename): |
362 | 371 | if name is not None and "ANDROID" in name.text: |
363 | 372 | continue |
364 | 373 | first_arg = command.find('./param/type') |
365 | | - # Some commands are alias KHR -> nonKHR, ignore those |
| 374 | + # Some commands are alias KHR -> nonKHR, process those later. |
366 | 375 | if name is not None: |
367 | 376 | cmd_factory(name.text, |
368 | 377 | device_entrypoint=(first_arg.text in ('VkDevice', 'VkCommandBuffer', 'VkQueue'))) |
369 | 378 |
|
| 379 | + ALLOWED_COMMAND_ALIASES = [ |
| 380 | + ] |
| 381 | + for command in xml.findall('./commands/command'): |
| 382 | + if 'alias' not in command.attrib: |
| 383 | + continue |
| 384 | + alias = command.attrib['alias'] |
| 385 | + name = command.attrib['name'] |
| 386 | + if name not in ALLOWED_COMMAND_ALIASES: |
| 387 | + continue |
| 388 | + cmd_factory.get(alias).aliases.append(name) |
| 389 | + |
370 | 390 | for struct_type in xml.findall('./types/type[@category="struct"]'): |
371 | 391 | name = struct_type.attrib['name'] |
372 | 392 | if name is not None and "ANDROID" in name: |
|
0 commit comments