Make the prefix of proc table configurable in api.json

Add a metadata to configure the prefix of proc table and Make proc table
flexiable with the prefix and declared functions.

BUG=dawn:1201
Change-Id: Id28e5521506fa5dc8efca90a7883fbd3dd548e8d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71526
Commit-Queue: Junwei Fu <junwei.fu@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
fujunwei
2021-12-05 05:29:44 +00:00
committed by Dawn LUCI CQ
parent 1c7d3efcd0
commit 3a464767a5
7 changed files with 45 additions and 31 deletions

View File

@@ -28,6 +28,7 @@ class Metadata:
self.api = metadata['api']
self.namespace = metadata['namespace']
self.c_prefix = metadata.get('c_prefix', self.namespace.upper())
self.proc_table_prefix = metadata['proc_table_prefix']
self.copyright_year = metadata.get('copyright_year', None)
@@ -759,12 +760,13 @@ class MultiGeneratorFromDawnJSON(Generator):
api_file_name = metadata.api.lower()
if 'dawn_headers' in targets:
prefix = metadata.proc_table_prefix.lower()
renders.append(
FileRender('api.h', 'src/include/dawn/' + api_file_name + '.h',
[RENDER_PARAMS_BASE, params_dawn]))
renders.append(
FileRender('dawn_proc_table.h',
'src/include/dawn/dawn_proc_table.h',
'src/include/dawn/' + prefix + '_proc_table.h',
[RENDER_PARAMS_BASE, params_dawn]))
if 'dawncpp_headers' in targets: