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>
This commit is contained in:
@@ -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,
|
||||
|
Reference in New Issue
Block a user