[Mesa-dev] [PATCH v2 9/14] anv: anv-entrypoints_gen.py: rename hash to cal_hash.

Dylan Baker dylan at pnwbakers.com
Thu Feb 23 18:46:22 UTC 2017


hash is reserved name in python, it's the interface to access an
object's hash protocol.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 src/intel/vulkan/anv_entrypoints_gen.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/intel/vulkan/anv_entrypoints_gen.py b/src/intel/vulkan/anv_entrypoints_gen.py
index 5066195..7386b1d 100644
--- a/src/intel/vulkan/anv_entrypoints_gen.py
+++ b/src/intel/vulkan/anv_entrypoints_gen.py
@@ -254,7 +254,8 @@ PRIME_FACTOR = 5024183
 PRIME_STEP = 19
 
 
-def hash(name):
+def cal_hash(name):
+    """Calculate the same hash value that Mesa will calculate in C."""
     h = 0
     for c in name:
         h = (h * PRIME_FACTOR + ord(c)) & U32_MASK
@@ -298,7 +299,7 @@ def get_entrypoints(doc, entrypoints_to_defines):
             guard = entrypoints_to_defines[fullname]
         else:
             guard = None
-        entrypoints.append((type, shortname, params, index, hash(fullname), guard))
+        entrypoints.append((type, shortname, params, index, cal_hash(fullname), guard))
         index += 1
 
     return entrypoints
@@ -367,7 +368,7 @@ def main():
                         'const VkAllocationCallbacks* pAllocator,' +
                         'VkDeviceMemory* pMem,' +
                         'VkImage* pImage', len(entrypoints),
-                        hash('vkCreateDmaBufImageINTEL'), None))
+                        cal_hash('vkCreateDmaBufImageINTEL'), None))
 
     # For outputting entrypoints.h we generate a anv_EntryPoint() prototype
     # per entry point.
-- 
git-series 0.9.0


More information about the mesa-dev mailing list