vulkan/dispatch_table: add an uncompacted version of the table
this is a bandaid fix that allows users (zink) to actually call the functions intended to be called. the real fix would be to figure out which extensions are enabled on the device and then only GPA the functions associated with those extensions that's too hard though so I'm slapping some flex tape on it cc: mesa-stable Acked-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27834>
This commit is contained in:

committed by
Marge Bot

parent
185d420b27
commit
5d91db9666
@@ -152,6 +152,62 @@ ${entrypoint_table('instance', instance_entrypoints)}
|
||||
${entrypoint_table('physical_device', physical_device_entrypoints)}
|
||||
${entrypoint_table('device', device_entrypoints)}
|
||||
|
||||
<%def name="uncompacted_dispatch_table(entrypoints)">
|
||||
% for e in entrypoints:
|
||||
% if e.alias:
|
||||
<% continue %>
|
||||
% endif
|
||||
% if e.guard is not None:
|
||||
#ifdef ${e.guard}
|
||||
% endif
|
||||
PFN_vk${e.name} ${e.name};
|
||||
% if e.aliases:
|
||||
% for a in e.aliases:
|
||||
PFN_vk${a.name} ${a.name};
|
||||
% endfor
|
||||
% endif
|
||||
% if e.guard is not None:
|
||||
#else
|
||||
PFN_vkVoidFunction ${e.name};
|
||||
% if e.aliases:
|
||||
% for a in e.aliases:
|
||||
PFN_vkVoidFunction ${a.name};
|
||||
% endfor
|
||||
% endif
|
||||
#endif
|
||||
% endif
|
||||
% endfor
|
||||
</%def>
|
||||
|
||||
|
||||
struct vk_instance_uncompacted_dispatch_table {
|
||||
${uncompacted_dispatch_table(instance_entrypoints)}
|
||||
};
|
||||
|
||||
struct vk_physical_device_uncompacted_dispatch_table {
|
||||
${uncompacted_dispatch_table(physical_device_entrypoints)}
|
||||
};
|
||||
|
||||
struct vk_device_uncompacted_dispatch_table {
|
||||
${uncompacted_dispatch_table(device_entrypoints)}
|
||||
};
|
||||
|
||||
struct vk_uncompacted_dispatch_table {
|
||||
union {
|
||||
struct {
|
||||
struct vk_instance_uncompacted_dispatch_table instance;
|
||||
struct vk_physical_device_uncompacted_dispatch_table physical_device;
|
||||
struct vk_device_uncompacted_dispatch_table device;
|
||||
};
|
||||
|
||||
struct {
|
||||
${uncompacted_dispatch_table(instance_entrypoints)}
|
||||
${uncompacted_dispatch_table(physical_device_entrypoints)}
|
||||
${uncompacted_dispatch_table(device_entrypoints)}
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
void
|
||||
vk_instance_dispatch_table_load(struct vk_instance_dispatch_table *table,
|
||||
PFN_vkGetInstanceProcAddr gpa,
|
||||
@@ -165,6 +221,19 @@ vk_device_dispatch_table_load(struct vk_device_dispatch_table *table,
|
||||
PFN_vkGetDeviceProcAddr gpa,
|
||||
VkDevice device);
|
||||
|
||||
void
|
||||
vk_instance_uncompacted_dispatch_table_load(struct vk_instance_uncompacted_dispatch_table *table,
|
||||
PFN_vkGetInstanceProcAddr gpa,
|
||||
VkInstance instance);
|
||||
void
|
||||
vk_physical_device_uncompacted_dispatch_table_load(struct vk_physical_device_uncompacted_dispatch_table *table,
|
||||
PFN_vkGetInstanceProcAddr gpa,
|
||||
VkInstance instance);
|
||||
void
|
||||
vk_device_uncompacted_dispatch_table_load(struct vk_device_uncompacted_dispatch_table *table,
|
||||
PFN_vkGetDeviceProcAddr gpa,
|
||||
VkDevice device);
|
||||
|
||||
void vk_instance_dispatch_table_from_entrypoints(
|
||||
struct vk_instance_dispatch_table *dispatch_table,
|
||||
const struct vk_instance_entrypoint_table *entrypoint_table,
|
||||
@@ -267,6 +336,46 @@ ${load_dispatch_table('physical_device', 'VkInstance', 'GetInstanceProcAddr',
|
||||
${load_dispatch_table('device', 'VkDevice', 'GetDeviceProcAddr',
|
||||
device_entrypoints)}
|
||||
|
||||
<%def name="load_uncompacted_dispatch_table(type, VkType, ProcAddr, entrypoints)">
|
||||
void
|
||||
vk_${type}_uncompacted_dispatch_table_load(struct vk_${type}_uncompacted_dispatch_table *table,
|
||||
PFN_vk${ProcAddr} gpa,
|
||||
${VkType} obj)
|
||||
{
|
||||
% if type != 'physical_device':
|
||||
table->${ProcAddr} = gpa;
|
||||
% endif
|
||||
% for e in entrypoints:
|
||||
% if e.alias or e.name == '${ProcAddr}':
|
||||
<% continue %>
|
||||
% endif
|
||||
% if e.guard is not None:
|
||||
#ifdef ${e.guard}
|
||||
% endif
|
||||
table->${e.name} = (PFN_vk${e.name}) gpa(obj, "vk${e.name}");
|
||||
% for a in e.aliases:
|
||||
table->${a.name} = (PFN_vk${a.name}) gpa(obj, "vk${a.name}");
|
||||
if (table->${e.name} && !table->${a.name})
|
||||
table->${a.name} = (PFN_vk${a.name}) table->${e.name};
|
||||
if (!table->${e.name})
|
||||
table->${e.name} = (PFN_vk${e.name}) table->${a.name};
|
||||
% endfor
|
||||
% if e.guard is not None:
|
||||
#endif
|
||||
% endif
|
||||
% endfor
|
||||
}
|
||||
</%def>
|
||||
|
||||
${load_uncompacted_dispatch_table('instance', 'VkInstance', 'GetInstanceProcAddr',
|
||||
instance_entrypoints)}
|
||||
|
||||
${load_uncompacted_dispatch_table('physical_device', 'VkInstance', 'GetInstanceProcAddr',
|
||||
physical_device_entrypoints)}
|
||||
|
||||
${load_uncompacted_dispatch_table('device', 'VkDevice', 'GetDeviceProcAddr',
|
||||
device_entrypoints)}
|
||||
|
||||
|
||||
struct string_map_entry {
|
||||
uint32_t name;
|
||||
|
Reference in New Issue
Block a user