tu: Generate entrypoints for each gen

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21931>
This commit is contained in:
Danylo Piliaiev 2023-03-09 19:57:51 +01:00 committed by Marge Bot
parent 3db70be04b
commit b30f2bf790
3 changed files with 34 additions and 1 deletions

View File

@ -4,10 +4,13 @@
tu_entrypoints = custom_target(
'tu_entrypoints',
input : [vk_entrypoints_gen, vk_api_xml],
output : ['tu_entrypoints.h', 'tu_entrypoints.c'],
output : ['tu_entrypoints.h', 'tu_entrypoints.cc'],
command : [
prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
'--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'tu',
'--include', 'adreno_common.xml.h',
'--tmpl-prefix', 'tu', '--tmpl-param', 'chip CHIP',
'--tmpl-variants', '<A6XX>', '<A7XX>',
],
depend_files : vk_entrypoints_gen_depend_files,
)

View File

@ -121,6 +121,25 @@
#define TU_FROM_HANDLE(__tu_type, __name, __handle) \
VK_FROM_HANDLE(__tu_type, __name, __handle)
#define ACT_0(ACTION)
#define ACT_1(ACTION, X) ACTION(X)
#define ACT_2(ACTION, X, ...) ACTION(X) ACT_1(ACTION, __VA_ARGS__)
#define ACT_3(ACTION, X, ...) ACTION(X) ACT_2(ACTION, __VA_ARGS__)
#define ACT_4(ACTION, X, ...) ACTION(X) ACT_3(ACTION, __VA_ARGS__)
#define ACT_5(ACTION, X, ...) ACTION(X) ACT_4(ACTION, __VA_ARGS__)
#define ACT_6(ACTION, X, ...) ACTION(X) ACT_5(ACTION, __VA_ARGS__)
#define GET_ACT_MACRO(_0, _1, _2, _3, _4, _5, _6, NAME, ...) NAME
/* Do the action for the each vararg. It could be macro, function call, etc. */
#define ACTION_FOR_EACH(action, ...) \
GET_ACT_MACRO(_0, __VA_ARGS__, ACT_6, ACT_5, ACT_4, ACT_3, ACT_2, ACT_1, ACT_0) \
(action, __VA_ARGS__)
#define TU_GPU_GENS A6XX, A7XX
#define TU_GENX(entrypoint) \
ACTION_FOR_EACH(entrypoint ## _GENS, TU_GPU_GENS)
/* vk object types */
struct tu_buffer;
struct tu_buffer_view;

View File

@ -2127,6 +2127,17 @@ tu_CreateDevice(VkPhysicalDevice physicalDevice,
struct vk_device_dispatch_table dispatch_table;
vk_device_dispatch_table_from_entrypoints(
&dispatch_table, &tu_device_entrypoints, true);
switch (fd_dev_gen(&physical_device->dev_id)) {
case 6:
vk_device_dispatch_table_from_entrypoints(
&dispatch_table, &tu_device_entrypoints_a6xx, false);
break;
case 7:
vk_device_dispatch_table_from_entrypoints(
&dispatch_table, &tu_device_entrypoints_a7xx, false);
}
vk_device_dispatch_table_from_entrypoints(
&dispatch_table, &wsi_device_entrypoints, false);