anv/entrypoints: Allow an entrypoint to require multiple extensions

In this case, we say an entrypoint is supported if ANY of the extensions
is supported.  This is because, in the XML, entrypoints don't require
extensions so much as extensions require entrypoints.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
This commit is contained in:
Jason Ekstrand 2018-01-23 19:18:08 -08:00
parent 8e8f167c72
commit 39d9fcea13
1 changed files with 12 additions and 9 deletions

View File

@ -266,14 +266,18 @@ anv_entrypoint_is_enabled(int index, uint32_t core_version,
switch (index) { switch (index) {
% for e in entrypoints: % for e in entrypoints:
case ${e.num}: case ${e.num}:
/* ${e.name} */
% if e.core_version: % if e.core_version:
return ${e.core_version.c_vk_version()} <= core_version; return ${e.core_version.c_vk_version()} <= core_version;
% elif e.extension: % elif e.extensions:
% if e.extension.type == 'instance': % for ext in e.extensions:
return !device && instance->${e.extension.name[3:]}; % if ext.type == 'instance':
% else: if (!device && instance->${ext.name[3:]}) return true;
return !device || device->${e.extension.name[3:]}; % else:
% endif if (!device || device->${ext.name[3:]}) return true;
% endif
% endfor
return false;
% else: % else:
return true; return true;
% endif % endif
@ -404,7 +408,7 @@ class Entrypoint(object):
self.num = None self.num = None
# Extensions which require this entrypoint # Extensions which require this entrypoint
self.core_version = None self.core_version = None
self.extension = None self.extensions = []
def is_device_entrypoint(self): def is_device_entrypoint(self):
return self.params[0].type in ('VkDevice', 'VkCommandBuffer') return self.params[0].type in ('VkDevice', 'VkCommandBuffer')
@ -465,8 +469,7 @@ def get_entrypoints(doc, entrypoints_to_defines, start_index):
e = entrypoints[command.attrib['name']] e = entrypoints[command.attrib['name']]
e.enabled = True e.enabled = True
assert e.core_version is None assert e.core_version is None
assert e.extension is None e.extensions.append(ext)
e.extension = ext
return [e for e in entrypoints.itervalues() if e.enabled] return [e for e in entrypoints.itervalues() if e.enabled]