anv: Pull the patch version from the XML

For years, I've maintained that I like to bump this number manually
because it gives me a point at which to say, "I've looked at most of the
issues and I think we're up to date."  The reality, however, is that I
just bump it every few months and don't really do any thorough checking.
We may as well just bump it on header updates.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Tested-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8792>
This commit is contained in:
Jason Ekstrand 2021-01-30 10:04:00 -06:00 committed by Marge Bot
parent cf54fc768e
commit c7a045ed63
2 changed files with 18 additions and 4 deletions

View file

@ -32,8 +32,6 @@ sys.path.append(VULKAN_UTIL)
from vk_extensions import *
API_PATCH_VERSION = 145
# Supported API versions. Each one is the maximum patch version for the given
# version. Version come in increasing order and each version is available if
# it's provided "enable" condition is true and all previous versions are
@ -204,6 +202,5 @@ for i in range(len(EXTENSIONS) - 1):
MAX_API_VERSION = VkVersion('0.0.0')
for version in API_VERSIONS:
version.version = VkVersion(version.version)
version.version.patch = API_PATCH_VERSION
assert version.version > MAX_API_VERSION
MAX_API_VERSION = version.version

View file

@ -25,7 +25,9 @@ COPYRIGHT = """\
"""
import os.path
import re
import sys
import xml.etree.ElementTree as et
from anv_extensions import *
@ -34,6 +36,18 @@ sys.path.append(VULKAN_UTIL)
from vk_extensions_gen import *
def get_xml_patch_version(xml_file):
xml = et.parse(xml_file)
for d in xml.findall('.types/type'):
if d.get('category', None) != 'define':
continue
name = d.find('.name')
if name.text != 'VK_HEADER_VERSION':
continue;
return name.tail.strip()
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--out-c', help='Output C file.')
@ -49,5 +63,8 @@ if __name__ == '__main__':
"perf/gen_perf.h"
]
gen_extensions('anv', args.xml_files, API_VERSIONS, MAX_API_VERSION,
max_version = MAX_API_VERSION
max_version.patch = int(get_xml_patch_version(args.xml_files[0]))
gen_extensions('anv', args.xml_files, API_VERSIONS, max_version,
EXTENSIONS, args.out_c, args.out_h, includes)