diff options
author | Jason Ekstrand <[email protected]> | 2017-09-20 12:38:12 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2018-03-07 12:13:47 -0800 |
commit | 54b3493fc078a89bf9c3abc64721e37348a41018 (patch) | |
tree | f85cb5e60943e19490540f90cb7c0a38e60b8ec6 /src/intel | |
parent | d91da06df5bd4be3a55d6e0870fd8a5bdc4a4a55 (diff) |
anv/entrypoints_gen: Allow the string map to grow
Reviewed-by: Lionel Landwerlin <[email protected]>
Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
Diffstat (limited to 'src/intel')
-rw-r--r-- | src/intel/vulkan/anv_entrypoints_gen.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/intel/vulkan/anv_entrypoints_gen.py b/src/intel/vulkan/anv_entrypoints_gen.py index aa47711d8b6..4a910aed63e 100644 --- a/src/intel/vulkan/anv_entrypoints_gen.py +++ b/src/intel/vulkan/anv_entrypoints_gen.py @@ -24,6 +24,7 @@ import argparse import functools +import math import os import xml.etree.cElementTree as et @@ -334,9 +335,7 @@ anv_lookup_entrypoint(const struct gen_device_info *devinfo, const char *name) return anv_resolve_entrypoint(devinfo, idx); }""", output_encoding='utf-8') -HASH_SIZE = 256 U32_MASK = 2**32 - 1 -HASH_MASK = HASH_SIZE - 1 PRIME_FACTOR = 5024183 PRIME_STEP = 19 @@ -354,6 +353,9 @@ class StringIntMapEntry(object): self.offset = None +def round_to_pow2(x): + return 2**int(math.ceil(math.log(x, 2))) + class StringIntMap(object): def __init__(self): self.baked = False @@ -374,8 +376,8 @@ class StringIntMap(object): offset += len(entry.string) + 1 # Save off some values that we'll need in C - self.hash_size = HASH_SIZE - self.hash_mask = HASH_SIZE - 1 + self.hash_size = round_to_pow2(len(self.strings) * 1.25) + self.hash_mask = self.hash_size - 1 self.prime_factor = PRIME_FACTOR self.prime_step = PRIME_STEP |