summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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,