anv: Move the physical device dispatch table to anv_instance

We don't actually have genX versions of any physical device level
commands so we don't need the trampoline versions and we don't need to
have a separate table per physical device.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3461>
This commit is contained in:
Jason Ekstrand
2020-01-17 23:17:48 -06:00
committed by Marge Bot
parent 78ff747408
commit 02044be23f
3 changed files with 27 additions and 43 deletions

View File

@@ -709,16 +709,15 @@ VkResult anv_CreateInstance(
}
}
struct anv_physical_device *pdevice = &instance->physicalDevice;
for (unsigned i = 0; i < ARRAY_SIZE(pdevice->dispatch.entrypoints); i++) {
for (unsigned i = 0; i < ARRAY_SIZE(instance->physical_device_dispatch.entrypoints); i++) {
/* Vulkan requires that entrypoints for extensions which have not been
* enabled must not be advertised.
*/
if (!anv_physical_device_entrypoint_is_enabled(i, instance->app_info.api_version,
&instance->enabled_extensions)) {
pdevice->dispatch.entrypoints[i] = NULL;
instance->physical_device_dispatch.entrypoints[i] = NULL;
} else {
pdevice->dispatch.entrypoints[i] =
instance->physical_device_dispatch.entrypoints[i] =
anv_physical_device_dispatch_table.entrypoints[i];
}
}
@@ -2214,7 +2213,7 @@ PFN_vkVoidFunction anv_GetInstanceProcAddr(
idx = anv_get_physical_device_entrypoint_index(pName);
if (idx >= 0)
return instance->physicalDevice.dispatch.entrypoints[idx];
return instance->physical_device_dispatch.entrypoints[idx];
idx = anv_get_device_entrypoint_index(pName);
if (idx >= 0)
@@ -2276,7 +2275,7 @@ PFN_vkVoidFunction vk_icdGetPhysicalDeviceProcAddr(
if (idx < 0)
return NULL;
return instance->physicalDevice.dispatch.entrypoints[idx];
return instance->physical_device_dispatch.entrypoints[idx];
}

View File

@@ -302,46 +302,31 @@ const struct anv_instance_dispatch_table anv_instance_dispatch_table = {
% endfor
};
% for layer in LAYERS:
% for e in physical_device_entrypoints:
% if e.alias:
<% continue %>
% endif
% if e.guard is not None:
% for e in physical_device_entrypoints:
% if e.alias and e.alias.enabled:
<% continue %>
% endif
% if e.guard is not None:
#ifdef ${e.guard}
% endif
% if layer == 'anv':
${e.return_type} __attribute__ ((weak))
${e.prefixed_name('anv')}(${e.decl_params()})
{
% if e.params[0].type == 'VkPhysicalDevice':
ANV_FROM_HANDLE(anv_physical_device, anv_physical_device, ${e.params[0].name});
return anv_physical_device->dispatch.${e.name}(${e.call_params()});
% else:
assert(!"Unhandled device child trampoline case: ${e.params[0].type}");
% endif
}
% else:
${e.return_type} ${e.prefixed_name(layer)}(${e.decl_params()}) __attribute__ ((weak));
% endif
% if e.guard is not None:
% endif
${e.return_type} ${e.prefixed_name('anv')}(${e.decl_params()}) __attribute__ ((weak));
% if e.guard is not None:
#endif // ${e.guard}
% endif
% endfor
const struct anv_physical_device_dispatch_table ${layer}_physical_device_dispatch_table = {
% for e in physical_device_entrypoints:
% if e.guard is not None:
#ifdef ${e.guard}
% endif
.${e.name} = ${e.prefixed_name(layer)},
% if e.guard is not None:
#endif // ${e.guard}
% endif
% endfor
};
% endif
% endfor
const struct anv_physical_device_dispatch_table anv_physical_device_dispatch_table = {
% for e in physical_device_entrypoints:
% if e.guard is not None:
#ifdef ${e.guard}
% endif
.${e.name} = ${e.prefixed_name('anv')},
% if e.guard is not None:
#endif // ${e.guard}
% endif
% endfor
};
% for layer in LAYERS:
% for e in device_entrypoints:

View File

@@ -1014,7 +1014,6 @@ struct anv_physical_device {
bool always_flush_cache;
struct anv_device_extension_table supported_extensions;
struct anv_physical_device_dispatch_table dispatch;
uint32_t eu_total;
uint32_t subslice_total;
@@ -1055,6 +1054,7 @@ struct anv_instance {
struct anv_instance_extension_table enabled_extensions;
struct anv_instance_dispatch_table dispatch;
struct anv_physical_device_dispatch_table physical_device_dispatch;
struct anv_device_dispatch_table device_dispatch;
int physicalDeviceCount;