SHA256
1
0
forked from pool/Mesa
Mesa/u_intel_anv-make-scripts-python-2-3-compat.patch

139 lines
4.7 KiB
Diff

Index: mesa-18.1.0-rc1/src/intel/vulkan/anv_extensions.py
===================================================================
--- mesa-18.1.0-rc1.orig/src/intel/vulkan/anv_extensions.py
+++ mesa-18.1.0-rc1/src/intel/vulkan/anv_extensions.py
@@ -29,13 +29,15 @@ import copy
import re
import xml.etree.cElementTree as et
+
def _bool_to_c_expr(b):
if b is True:
- return 'true';
+ return 'true'
elif b is False:
- return 'false';
+ return 'false'
else:
- return b;
+ return b
+
class Extension:
def __init__(self, name, ext_version, enable):
@@ -43,11 +45,13 @@ class Extension:
self.ext_version = int(ext_version)
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
@@ -60,7 +64,7 @@ API_VERSIONS = [
ApiVersion('1.1.0', 'device->has_syncobj_wait'),
]
-MAX_API_VERSION = None # Computed later
+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
@@ -113,6 +117,7 @@ EXTENSIONS = [
'device->has_context_priority'),
]
+
class VkVersion:
def __init__(self, string):
split = string.split('.')
@@ -146,14 +151,59 @@ class VkVersion:
patch = self.patch if self.patch is not None else 0
return (self.major << 22) | (self.minor << 12) | patch
- def __cmp__(self, other):
+ def __eq__(self, other):
+ # If only one of them has a patch version, "ignore" it by making
+ # other's patch version match self.
+ if (self.patch is None) != (other.patch is None):
+ other = copy.copy(other)
+ other.patch = self.patch
+
+ return self.__int_ver() == other.__int_ver()
+
+ def __ne__(self, other):
+ # If only one of them has a patch version, "ignore" it by making
+ # other's patch version match self.
+ if (self.patch is None) != (other.patch is None):
+ other = copy.copy(other)
+ other.patch = self.patch
+
+ return self.__int_ver() != other.__int_ver()
+
+ def __lt__(self, other):
+ # If only one of them has a patch version, "ignore" it by making
+ # other's patch version match self.
+ if (self.patch is None) != (other.patch is None):
+ other = copy.copy(other)
+ other.patch = self.patch
+
+ return self.__int_ver() < other.__int_ver()
+
+ def __le__(self, other):
+ # If only one of them has a patch version, "ignore" it by making
+ # other's patch version match self.
+ if (self.patch is None) != (other.patch is None):
+ other = copy.copy(other)
+ other.patch = self.patch
+
+ return self.__int_ver() <= other.__int_ver()
+
+ def __ge__(self, other):
+ # If only one of them has a patch version, "ignore" it by making
+ # other's patch version match self.
+ if (self.patch is None) != (other.patch is None):
+ other = copy.copy(other)
+ other.patch = self.patch
+
+ return self.__int_ver() >= other.__int_ver()
+
+ def __gt__(self, other):
# If only one of them has a patch version, "ignore" it by making
# other's patch version match self.
if (self.patch is None) != (other.patch is None):
other = copy.copy(other)
other.patch = self.patch
- return self.__int_ver().__cmp__(other.__int_ver())
+ return self.__int_ver() > other.__int_ver()
MAX_API_VERSION = VkVersion('0.0.0')
Index: mesa-18.1.0-rc1/src/intel/vulkan/anv_entrypoints_gen.py
===================================================================
--- mesa-18.1.0-rc1.orig/src/intel/vulkan/anv_entrypoints_gen.py
+++ mesa-18.1.0-rc1/src/intel/vulkan/anv_entrypoints_gen.py
@@ -145,7 +145,7 @@ static const struct string_map_entry str
/* Hash table stats:
* size ${len(strmap.sorted_strings)} entries
* collisions entries:
-% for i in xrange(10):
+% for i in range(10):
* ${i}${'+' if i == 9 else ' '} ${strmap.collisions[i]}
% endfor
*/
@@ -507,7 +507,7 @@ def get_entrypoints(doc, entrypoints_to_
assert e.core_version is None
e.extensions.append(ext)
- return [e for e in entrypoints.itervalues() if e.enabled]
+ return [e for e in entrypoints.values() if e.enabled]
def get_entrypoints_defines(doc):