summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-09-20 09:41:50 -0700
committerJason Ekstrand <[email protected]>2018-03-07 12:13:47 -0800
commitd91da06df5bd4be3a55d6e0870fd8a5bdc4a4a55 (patch)
tree206f0810b35e0aab2f4a34a7c5977dd0f5dafbca
parenta4ca4c99ba8d594a58c862503b0f9f52c0e6e4b7 (diff)
anv/entrypoints_gen: A bit of refactoring
Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
-rw-r--r--src/intel/vulkan/anv_entrypoints_gen.py22
1 files changed, 7 insertions, 15 deletions
diff --git a/src/intel/vulkan/anv_entrypoints_gen.py b/src/intel/vulkan/anv_entrypoints_gen.py
index dc0f0e968ca..aa47711d8b6 100644
--- a/src/intel/vulkan/anv_entrypoints_gen.py
+++ b/src/intel/vulkan/anv_entrypoints_gen.py
@@ -480,20 +480,6 @@ def get_entrypoints_defines(doc):
return entrypoints_to_defines
-def gen_code(entrypoints):
- """Generate the C code."""
-
- strmap = StringIntMap()
- for e in entrypoints:
- strmap.add_string(e.name, e.num)
- strmap.bake()
-
- return TEMPLATE_C.render(entrypoints=entrypoints,
- LAYERS=LAYERS,
- strmap=strmap,
- filename=os.path.basename(__file__))
-
-
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--outdir', help='Where to write the files.',
@@ -524,8 +510,11 @@ def main():
EntrypointParam('VkImage', 'pImage', 'VkImage* pImage')
]))
+ strmap = StringIntMap()
for num, e in enumerate(entrypoints):
+ strmap.add_string(e.name, num)
e.num = num
+ strmap.bake()
# For outputting entrypoints.h we generate a anv_EntryPoint() prototype
# per entry point.
@@ -535,7 +524,10 @@ def main():
LAYERS=LAYERS,
filename=os.path.basename(__file__)))
with open(os.path.join(args.outdir, 'anv_entrypoints.c'), 'wb') as f:
- f.write(gen_code(entrypoints))
+ f.write(TEMPLATE_C.render(entrypoints=entrypoints,
+ LAYERS=LAYERS,
+ strmap=strmap,
+ filename=os.path.basename(__file__)))
except Exception:
# In the even there's an error this imports some helpers from mako
# to print a useful stack trace and prints it, then exits with