Browse Source

anv/entrypoints: Parse entrypoints before extensions/features

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
tags/18.0-branchpoint
Jason Ekstrand 7 years ago
parent
commit
93e789a266
1 changed files with 17 additions and 15 deletions
  1. 17
    15
      src/intel/vulkan/anv_entrypoints_gen.py

+ 17
- 15
src/intel/vulkan/anv_entrypoints_gen.py View File

import os import os
import xml.etree.cElementTree as et import xml.etree.cElementTree as et


from collections import OrderedDict
from mako.template import Template from mako.template import Template


from anv_extensions import * from anv_extensions import *
self.return_type = return_type self.return_type = return_type
self.params = ', '.join(params) self.params = ', '.join(params)
self.guard = guard self.guard = guard
self.enabled = False
self.num = None self.num = None


def prefixed_name(self, prefix): def prefixed_name(self, prefix):


def get_entrypoints(doc, entrypoints_to_defines, start_index): def get_entrypoints(doc, entrypoints_to_defines, start_index):
"""Extract the entry points from the registry.""" """Extract the entry points from the registry."""
entrypoints = []
entrypoints = OrderedDict()

for command in doc.findall('./commands/command'):
ret_type = command.find('./proto/type').text
fullname = command.find('./proto/name').text
params = (''.join(p.itertext()) for p in command.findall('./param'))
guard = entrypoints_to_defines.get(fullname)
# They really need to be unique
assert fullname not in entrypoints
entrypoints[fullname] = Entrypoint(fullname, ret_type, params, guard)


enabled_commands = set() enabled_commands = set()
for feature in doc.findall('./feature'): for feature in doc.findall('./feature'):
continue continue


for command in feature.findall('./require/command'): for command in feature.findall('./require/command'):
enabled_commands.add(command.attrib['name'])
e = entrypoints[command.attrib['name']]
e.enabled = True


supported = set(ext.name for ext in EXTENSIONS) supported = set(ext.name for ext in EXTENSIONS)
for extension in doc.findall('.extensions/extension'): for extension in doc.findall('.extensions/extension'):
continue continue


for command in extension.findall('./require/command'): for command in extension.findall('./require/command'):
enabled_commands.add(command.attrib['name'])

for command in doc.findall('./commands/command'):
ret_type = command.find('./proto/type').text
fullname = command.find('./proto/name').text

if fullname not in enabled_commands:
continue

params = (''.join(p.itertext()) for p in command.findall('./param'))
guard = entrypoints_to_defines.get(fullname)
entrypoints.append(Entrypoint(fullname, ret_type, params, guard))
e = entrypoints[command.attrib['name']]
e.enabled = True


return entrypoints
return [e for e in entrypoints.itervalues() if e.enabled]




def get_entrypoints_defines(doc): def get_entrypoints_defines(doc):

Loading…
Cancel
Save