summaryrefslogtreecommitdiff
path: root/thirdparty/vulkan/registry/common_codegen.py
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-07-29 20:44:14 +0200
committerGitHub <noreply@github.com>2020-02-11 11:57:40 +0100
commit6289e7d1479f6e7c9e55890c8c66d2e5e0a1481a (patch)
tree8223d907b1aa8184295240a7b6f63023da05c02f /thirdparty/vulkan/registry/common_codegen.py
parent6ecedd1e6ca7d8b10b13a3dab19074fd51b17bcf (diff)
parentb456bfad5cee3922f55621bf7c133cc67337636a (diff)
Merge pull request #29993 from bruvzg/vulkan
Initial Vulkan support for macOS (MoltenVK) and Windows
Diffstat (limited to 'thirdparty/vulkan/registry/common_codegen.py')
-rwxr-xr-xthirdparty/vulkan/registry/common_codegen.py73
1 files changed, 73 insertions, 0 deletions
diff --git a/thirdparty/vulkan/registry/common_codegen.py b/thirdparty/vulkan/registry/common_codegen.py
new file mode 100755
index 0000000000..895453262d
--- /dev/null
+++ b/thirdparty/vulkan/registry/common_codegen.py
@@ -0,0 +1,73 @@
+#!/usr/bin/python3 -i
+#
+# Copyright (c) 2015-2017, 2019 The Khronos Group Inc.
+# Copyright (c) 2015-2017, 2019 Valve Corporation
+# Copyright (c) 2015-2017, 2019 LunarG, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Author: Mark Lobodzinski <mark@lunarg.com>
+
+import os,re,sys,string
+import xml.etree.ElementTree as etree
+from generator import *
+from collections import namedtuple
+
+# Copyright text prefixing all headers (list of strings).
+prefixStrings = [
+ '/*',
+ '** Copyright (c) 2015-2017, 2019 The Khronos Group Inc.',
+ '** Copyright (c) 2015-2017, 2019 Valve Corporation',
+ '** Copyright (c) 2015-2017, 2019 LunarG, Inc.',
+ '** Copyright (c) 2015-2017, 2019 Google Inc.',
+ '**',
+ '** Licensed under the Apache License, Version 2.0 (the "License");',
+ '** you may not use this file except in compliance with the License.',
+ '** You may obtain a copy of the License at',
+ '**',
+ '** http://www.apache.org/licenses/LICENSE-2.0',
+ '**',
+ '** Unless required by applicable law or agreed to in writing, software',
+ '** distributed under the License is distributed on an "AS IS" BASIS,',
+ '** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.',
+ '** See the License for the specific language governing permissions and',
+ '** limitations under the License.',
+ '*/',
+ ''
+]
+
+
+platform_dict = {
+ 'android' : 'VK_USE_PLATFORM_ANDROID_KHR',
+ 'fuchsia' : 'VK_USE_PLATFORM_FUCHSIA',
+ 'ggp': 'VK_USE_PLATFORM_GGP',
+ 'ios' : 'VK_USE_PLATFORM_IOS_MVK',
+ 'macos' : 'VK_USE_PLATFORM_MACOS_MVK',
+ 'metal' : 'VK_USE_PLATFORM_METAL_EXT',
+ 'vi' : 'VK_USE_PLATFORM_VI_NN',
+ 'wayland' : 'VK_USE_PLATFORM_WAYLAND_KHR',
+ 'win32' : 'VK_USE_PLATFORM_WIN32_KHR',
+ 'xcb' : 'VK_USE_PLATFORM_XCB_KHR',
+ 'xlib' : 'VK_USE_PLATFORM_XLIB_KHR',
+ 'xlib_xrandr' : 'VK_USE_PLATFORM_XLIB_XRANDR_EXT',
+}
+
+#
+# Return appropriate feature protect string from 'platform' tag on feature
+def GetFeatureProtect(interface):
+ """Get platform protection string"""
+ platform = interface.get('platform')
+ protect = None
+ if platform is not None:
+ protect = platform_dict[platform]
+ return protect