diff options
author | Jason Ekstrand <[email protected]> | 2020-01-17 23:17:48 -0600 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-01-20 22:08:52 +0000 |
commit | 02044be23f179959872158dbf2a470ed49df774c (patch) | |
tree | e3758d86d2c657de79f414ce829cb19d6ecb8ade | |
parent | 78ff747408379387f72fca802f3065915e496f4c (diff) |
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 <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3461>
-rw-r--r-- | src/intel/vulkan/anv_device.c | 11 | ||||
-rw-r--r-- | src/intel/vulkan/anv_entrypoints_gen.py | 51 | ||||
-rw-r--r-- | src/intel/vulkan/anv_private.h | 2 |
3 files changed, 24 insertions, 40 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 880d8d9844c..6d7c7ad3c97 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -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]; } diff --git a/src/intel/vulkan/anv_entrypoints_gen.py b/src/intel/vulkan/anv_entrypoints_gen.py index 6b90786577d..b524897a0f6 100644 --- a/src/intel/vulkan/anv_entrypoints_gen.py +++ b/src/intel/vulkan/anv_entrypoints_gen.py @@ -302,45 +302,30 @@ 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 + % 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: +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(layer)}, - % if e.guard is not None: + % endif + .${e.name} = ${e.prefixed_name('anv')}, + % if e.guard is not None: #endif // ${e.guard} - % endif - % endfor - }; + % endif % endfor +}; % for layer in LAYERS: diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index afc1b14953e..838f27dc45f 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -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; |