summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-01-16 17:20:33 -0800
committerJason Ekstrand <[email protected]>2018-01-23 00:15:40 -0800
commit93e789a2668ebc4eda8ffa0a6a6fda6465f4e215 (patch)
tree431c49a73a3039d248af01d9e3e6d34d6eb72192
parent2f493121aea99c9949302a62b4bec962417161b1 (diff)
anv/entrypoints: Parse entrypoints before extensions/features
Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
-rw-r--r--src/intel/vulkan/anv_entrypoints_gen.py32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/intel/vulkan/anv_entrypoints_gen.py b/src/intel/vulkan/anv_entrypoints_gen.py
index 8999df90694..ccbc2ffb5e5 100644
--- a/src/intel/vulkan/anv_entrypoints_gen.py
+++ b/src/intel/vulkan/anv_entrypoints_gen.py
@@ -27,6 +27,7 @@ import functools
import os
import xml.etree.cElementTree as et
+from collections import OrderedDict
from mako.template import Template
from anv_extensions import *
@@ -276,6 +277,7 @@ class Entrypoint(object):
self.return_type = return_type
self.params = ', '.join(params)
self.guard = guard
+ self.enabled = False
self.num = None
def prefixed_name(self, prefix):
@@ -287,7 +289,16 @@ class Entrypoint(object):
def get_entrypoints(doc, entrypoints_to_defines, start_index):
"""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()
for feature in doc.findall('./feature'):
@@ -296,7 +307,8 @@ def get_entrypoints(doc, entrypoints_to_defines, start_index):
continue
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)
for extension in doc.findall('.extensions/extension'):
@@ -307,20 +319,10 @@ def get_entrypoints(doc, entrypoints_to_defines, start_index):
continue
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):