Replace hardcode functions in templates

Make dawn_proc.c and dawn_thread_dispatch_proc.cpp flexible

BUG=dawn:1201

Change-Id: Ifca73b33d6aed70b2dda3cf181a4650380f0a2fb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/72065
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Junwei Fu <junwei.fu@intel.com>
diff --git a/generator/dawn_json_generator.py b/generator/dawn_json_generator.py
index 6d21eb8..fd95ccc 100644
--- a/generator/dawn_json_generator.py
+++ b/generator/dawn_json_generator.py
@@ -757,8 +757,8 @@
         RENDER_PARAMS_BASE = make_base_render_params(metadata)
 
         api = metadata.api.lower()
+        prefix = metadata.proc_table_prefix.lower()
         if 'dawn_headers' in targets:
-            prefix = metadata.proc_table_prefix.lower()
             renders.append(
                 FileRender('api.h', 'src/include/dawn/' + api + '.h',
                            [RENDER_PARAMS_BASE, params_dawn]))
@@ -779,11 +779,11 @@
 
         if 'dawn_proc' in targets:
             renders.append(
-                FileRender('dawn_proc.c', 'src/dawn/dawn_proc.c',
+                FileRender('dawn_proc.c', 'src/dawn/' + prefix + '_proc.c',
                            [RENDER_PARAMS_BASE, params_dawn]))
             renders.append(
                 FileRender('dawn_thread_dispatch_proc.cpp',
-                           'src/dawn/dawn_thread_dispatch_proc.cpp',
+                           'src/dawn/' + prefix + '_thread_dispatch_proc.cpp',
                            [RENDER_PARAMS_BASE, params_dawn]))
 
         if 'webgpu_dawn_native_proc' in targets: