Mesa (main): vulkan/physical_device_features: Stop generating a header

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Oct 4 23:39:12 UTC 2021


Module: Mesa
Branch: main
Commit: 2f55aace9cc341227d59c96ccbcffc24d2e15d9d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2f55aace9cc341227d59c96ccbcffc24d2e15d9d

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Fri Oct  1 12:32:36 2021 -0500

vulkan/physical_device_features: Stop generating a header

It only has one entrypoint and nothing in it is based on code-gen.  We
can put that one entrypoint in vk_physical_device.h instead.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reviewed-by: Tapani Pälli <tapani.palli at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13150>

---

 src/vulkan/util/meson.build                    |  4 +--
 src/vulkan/util/vk_device.c                    |  1 -
 src/vulkan/util/vk_physical_device.h           |  4 +++
 src/vulkan/util/vk_physical_device_features.py | 35 --------------------------
 4 files changed, 6 insertions(+), 38 deletions(-)

diff --git a/src/vulkan/util/meson.build b/src/vulkan/util/meson.build
index 387eb6ed0be..34e53d6a04c 100644
--- a/src/vulkan/util/meson.build
+++ b/src/vulkan/util/meson.build
@@ -143,10 +143,10 @@ vk_cmd_queue = custom_target(
 vk_physical_device_features = custom_target(
   'vk_physical_device_features',
   input : ['vk_physical_device_features.py', vk_api_xml],
-  output : ['vk_physical_device_features.c', 'vk_physical_device_features.h'],
+  output : ['vk_physical_device_features.c'],
   command : [
     prog_python, '@INPUT0@', '--xml', '@INPUT1@',
-    '--out-c', '@OUTPUT0@', '--out-h', '@OUTPUT1@'
+    '--out-c', '@OUTPUT0@'
   ],
   depend_files : vk_physical_device_features_gen_depend_files,
 )
diff --git a/src/vulkan/util/vk_device.c b/src/vulkan/util/vk_device.c
index 4c14c685a4c..9b88f14b12a 100644
--- a/src/vulkan/util/vk_device.c
+++ b/src/vulkan/util/vk_device.c
@@ -26,7 +26,6 @@
 #include "vk_common_entrypoints.h"
 #include "vk_instance.h"
 #include "vk_physical_device.h"
-#include "vk_physical_device_features.h"
 #include "vk_queue.h"
 #include "vk_util.h"
 #include "util/hash_table.h"
diff --git a/src/vulkan/util/vk_physical_device.h b/src/vulkan/util/vk_physical_device.h
index fea39ae9d17..489d2f0b1c0 100644
--- a/src/vulkan/util/vk_physical_device.h
+++ b/src/vulkan/util/vk_physical_device.h
@@ -52,6 +52,10 @@ vk_physical_device_init(struct vk_physical_device *physical_device,
 void
 vk_physical_device_finish(struct vk_physical_device *physical_device);
 
+VkResult
+vk_physical_device_check_device_features(struct vk_physical_device *physical_device,
+                                         const VkDeviceCreateInfo *pCreateInfo);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/vulkan/util/vk_physical_device_features.py b/src/vulkan/util/vk_physical_device_features.py
index 240e12a78f9..6b69390e3d2 100644
--- a/src/vulkan/util/vk_physical_device_features.py
+++ b/src/vulkan/util/vk_physical_device_features.py
@@ -30,37 +30,9 @@ import xml.etree.ElementTree as et
 
 from mako.template import Template
 
-TEMPLATE_H = Template(COPYRIGHT + """\
-/* This file generated from ${filename}, don't edit directly. */
-
-#pragma once
-
-#define VK_PROTOTYPES
-#include <vulkan/vulkan.h>
-#include "vk_physical_device.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-VkResult
-vk_physical_device_check_device_features(struct vk_physical_device *physical_device,
-                                         const VkDeviceCreateInfo *pCreateInfo);
-
-#ifdef __cplusplus
-}
-#endif
-""", output_encoding='utf-8')
-
 TEMPLATE_C = Template(COPYRIGHT + """
 /* This file generated from ${filename}, don't edit directly. */
 
-#include "${header}"
-
-#define VK_PROTOTYPES
-#include <vulkan/vulkan.h>
-
-#include "vk_dispatch_table.h"
 #include "vk_physical_device.h"
 #include "vk_util.h"
 
@@ -222,7 +194,6 @@ def get_features_from_xml(xml_files):
 def main():
     parser = argparse.ArgumentParser()
     parser.add_argument('--out-c', required=True, help='Output C file.')
-    parser.add_argument('--out-h', required=True, help='Output H file.')
     parser.add_argument('--xml',
                         help='Vulkan API XML file.',
                         required=True, action='append', dest='xml_files')
@@ -230,18 +201,12 @@ def main():
 
     features = get_features_from_xml(args.xml_files)
 
-    assert os.path.dirname(args.out_c) == os.path.dirname(args.out_h)
-
     environment = {
-        'header': os.path.basename(args.out_h),
         'filename': os.path.basename(__file__),
         'features': features,
     }
 
     try:
-        with open(args.out_h, 'wb') as f:
-            guard = os.path.basename(args.out_h).replace('.', '_').upper()
-            f.write(TEMPLATE_H.render(guard=guard, **environment))
         with open(args.out_c, 'wb') as f:
             f.write(TEMPLATE_C.render(**environment))
     except Exception:



More information about the mesa-commit mailing list