aboutsummaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/anv_extensions.py
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-09-22 07:36:39 -0700
committerJason Ekstrand <[email protected]>2018-03-07 12:13:47 -0800
commit05fc377f2e927c65efa67897c6bb35ff65bcd1e8 (patch)
tree36e0c33b72a89a3c0f279b54ce806b1302e90ebd /src/intel/vulkan/anv_extensions.py
parent8efa173ed2d42dd817462eaa1ab3a4746458e551 (diff)
anv/extensions: Add support for multiple API versions
Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_extensions.py')
-rw-r--r--src/intel/vulkan/anv_extensions.py37
1 files changed, 29 insertions, 8 deletions
diff --git a/src/intel/vulkan/anv_extensions.py b/src/intel/vulkan/anv_extensions.py
index 5a36708a0a1..b402b0c9cb3 100644
--- a/src/intel/vulkan/anv_extensions.py
+++ b/src/intel/vulkan/anv_extensions.py
@@ -29,18 +29,34 @@ import copy
import re
import xml.etree.cElementTree as et
-MAX_API_VERSION = '1.0.57'
+def _bool_to_c_expr(b):
+ if b is True:
+ return 'true';
+ elif b is False:
+ return 'false';
+ else:
+ return b;
class Extension:
def __init__(self, name, ext_version, enable):
self.name = name
self.ext_version = int(ext_version)
- if enable is True:
- self.enable = 'true';
- elif enable is False:
- self.enable = 'false';
- else:
- self.enable = enable;
+ self.enable = _bool_to_c_expr(enable)
+
+class ApiVersion:
+ def __init__(self, max_patch_version, enable):
+ self.max_patch_version = max_patch_version
+ self.enable = _bool_to_c_expr(enable)
+
+# 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
+# available.
+API_VERSIONS = [
+ ApiVersion('1.0.57', True),
+]
+
+MAX_API_VERSION = None # Computed later
# On Android, we disable all surface and swapchain extensions. Android's Vulkan
# loader implements VK_KHR_surface and VK_KHR_swapchain, and applications
@@ -132,4 +148,9 @@ class VkVersion:
return self.__int_ver().__cmp__(other.__int_ver())
-MAX_API_VERSION = VkVersion(MAX_API_VERSION)
+
+MAX_API_VERSION = VkVersion('0.0.0')
+for version in API_VERSIONS:
+ version.max_patch_version = VkVersion(version.max_patch_version)
+ assert version.max_patch_version > MAX_API_VERSION
+ MAX_API_VERSION = version.max_patch_version