Mesa (master): anv: replace hard-coded platform list with vk.xml parse
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sat Jun 29 21:39:30 UTC 2019
Module: Mesa
Branch: master
Commit: 38305e6c94ea31e0f775cbc693fea267023e3bc4
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=38305e6c94ea31e0f775cbc693fea267023e3bc4
Author: Eric Engestrom <eric.engestrom at intel.com>
Date: Sat Jun 29 13:58:59 2019 +0100
anv: replace hard-coded platform list with vk.xml parse
Signed-off-by: Eric Engestrom <eric.engestrom at intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
---
src/intel/vulkan/anv_extensions_gen.py | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/intel/vulkan/anv_extensions_gen.py b/src/intel/vulkan/anv_extensions_gen.py
index a140c267452..66ab93a316e 100644
--- a/src/intel/vulkan/anv_extensions_gen.py
+++ b/src/intel/vulkan/anv_extensions_gen.py
@@ -31,6 +31,8 @@ from mako.template import Template
from anv_extensions import *
+platform_defines = []
+
def _init_exts_from_xml(xml):
""" Walk the Vulkan XML and fill out extra extension information. """
@@ -40,6 +42,9 @@ def _init_exts_from_xml(xml):
for ext in EXTENSIONS:
ext_name_map[ext.name] = ext
+ for platform in xml.findall('./platforms/platform'):
+ platform_defines.append(platform.attrib['protect'])
+
for ext_elem in xml.findall('.extensions/extension'):
ext_name = ext_elem.attrib['name']
if ext_name not in ext_name_map:
@@ -103,12 +108,12 @@ _TEMPLATE_C = Template(COPYRIGHT + """
#include "vk_util.h"
/* Convert the VK_USE_PLATFORM_* defines to booleans */
-%for platform in ['ANDROID_KHR', 'WAYLAND_KHR', 'XCB_KHR', 'XLIB_KHR', 'DISPLAY_KHR', 'XLIB_XRANDR_EXT']:
-#ifdef VK_USE_PLATFORM_${platform}
-# undef VK_USE_PLATFORM_${platform}
-# define VK_USE_PLATFORM_${platform} true
+%for platform_define in platform_defines:
+#ifdef ${platform_define}
+# undef ${platform_define}
+# define ${platform_define} true
#else
-# define VK_USE_PLATFORM_${platform} false
+# define ${platform_define} false
#endif
%endfor
@@ -204,6 +209,7 @@ if __name__ == '__main__':
'MAX_API_VERSION': MAX_API_VERSION,
'instance_extensions': [e for e in EXTENSIONS if e.type == 'instance'],
'device_extensions': [e for e in EXTENSIONS if e.type == 'device'],
+ 'platform_defines': platform_defines,
}
if args.out_h:
More information about the mesa-commit
mailing list