summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoe Hao Cheng <haochengho12907@gmail.com>2021-05-27 22:12:57 +0800
committerMarge Bot <eric+marge@anholt.net>2021-05-30 01:57:49 +0000
commit17d7b0bb8f00e3fd251c535c63d3253a2611e52b (patch)
treea2ba7b7450281572afdf2af97fa4ba9e4283cbf1
parentc9baccb516b70469ec8dc3c64af423d35617cf04 (diff)
vulkan/util: generate vk_dispatch_table that combines all dispatch tables
Zink uses this, as it doesn't need to differentiate all the entrypoints. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11045>
-rw-r--r--src/vulkan/util/vk_dispatch_table_gen.py40
1 files changed, 34 insertions, 6 deletions
diff --git a/src/vulkan/util/vk_dispatch_table_gen.py b/src/vulkan/util/vk_dispatch_table_gen.py
index 7b566ba0f00..0966bc50fd6 100644
--- a/src/vulkan/util/vk_dispatch_table_gen.py
+++ b/src/vulkan/util/vk_dispatch_table_gen.py
@@ -67,8 +67,7 @@ TEMPLATE_H = Template(COPYRIGHT + """\
extern "C" {
#endif
-<%def name="dispatch_table(type, entrypoints)">
-struct vk_${type}_dispatch_table {
+<%def name="dispatch_table(entrypoints)">
% for e in entrypoints:
% if e.alias:
<% continue %>
@@ -101,8 +100,9 @@ struct vk_${type}_dispatch_table {
#endif
% endif
% endfor
-};
+</%def>
+<%def name="entrypoint_table(type, entrypoints)">
struct vk_${type}_entrypoint_table {
% for e in entrypoints:
% if e.guard is not None:
@@ -118,9 +118,37 @@ struct vk_${type}_entrypoint_table {
};
</%def>
-${dispatch_table('instance', instance_entrypoints)}
-${dispatch_table('physical_device', physical_device_entrypoints)}
-${dispatch_table('device', device_entrypoints)}
+struct vk_instance_dispatch_table {
+ ${dispatch_table(instance_entrypoints)}
+};
+
+struct vk_physical_device_dispatch_table {
+ ${dispatch_table(physical_device_entrypoints)}
+};
+
+struct vk_device_dispatch_table {
+ ${dispatch_table(device_entrypoints)}
+};
+
+struct vk_dispatch_table {
+ union {
+ struct {
+ struct vk_instance_dispatch_table instance;
+ struct vk_physical_device_dispatch_table physical_device;
+ struct vk_device_dispatch_table device;
+ };
+
+ struct {
+ ${dispatch_table(instance_entrypoints)}
+ ${dispatch_table(physical_device_entrypoints)}
+ ${dispatch_table(device_entrypoints)}
+ };
+ };
+};
+
+${entrypoint_table('instance', instance_entrypoints)}
+${entrypoint_table('physical_device', physical_device_entrypoints)}
+${entrypoint_table('device', device_entrypoints)}
void
vk_instance_dispatch_table_load(struct vk_instance_dispatch_table *table,