diff options
author | Jason Ekstrand <jason.ekstrand@intel.com> | 2021-01-23 11:47:35 -0600 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2021-02-01 18:54:24 +0000 |
commit | 1cf035a96bb28b6e76af50bb0039810c9f172cb2 (patch) | |
tree | f7f0965b91447aed632e204f6da652f8060a2c06 /src/vulkan/overlay-layer | |
parent | 74617eea4601a0d5e851d1a36bb67d9ddf529673 (diff) |
vulkan-overlay-layer: Use the new dispatch tables
This lets us drop the dispatch tables in enum_to_str and replace them
with the new, better versions.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8676>
Diffstat (limited to 'src/vulkan/overlay-layer')
-rw-r--r-- | src/vulkan/overlay-layer/overlay.cpp | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/vulkan/overlay-layer/overlay.cpp b/src/vulkan/overlay-layer/overlay.cpp index 2b071482ecf..6500c477b53 100644 --- a/src/vulkan/overlay-layer/overlay.cpp +++ b/src/vulkan/overlay-layer/overlay.cpp @@ -43,11 +43,13 @@ #include "util/simple_mtx.h" #include "vk_enum_to_str.h" +#include "vk_dispatch_table.h" #include "vk_util.h" /* Mapped from VkInstace/VkPhysicalDevice */ struct instance_data { struct vk_instance_dispatch_table vtable; + struct vk_physical_device_dispatch_table pd_vtable; VkInstance instance; struct overlay_params params; @@ -419,14 +421,14 @@ static void device_map_queues(struct device_data *data, struct instance_data *instance_data = data->instance; uint32_t n_family_props; - instance_data->vtable.GetPhysicalDeviceQueueFamilyProperties(data->physical_device, - &n_family_props, - NULL); + instance_data->pd_vtable.GetPhysicalDeviceQueueFamilyProperties(data->physical_device, + &n_family_props, + NULL); VkQueueFamilyProperties *family_props = (VkQueueFamilyProperties *)malloc(sizeof(VkQueueFamilyProperties) * n_family_props); - instance_data->vtable.GetPhysicalDeviceQueueFamilyProperties(data->physical_device, - &n_family_props, - family_props); + instance_data->pd_vtable.GetPhysicalDeviceQueueFamilyProperties(data->physical_device, + &n_family_props, + family_props); uint32_t queue_index = 0; for (uint32_t i = 0; i < pCreateInfo->queueCreateInfoCount; i++) { @@ -1007,7 +1009,7 @@ static uint32_t vk_memory_type(struct device_data *data, uint32_t type_bits) { VkPhysicalDeviceMemoryProperties prop; - data->instance->vtable.GetPhysicalDeviceMemoryProperties(data->physical_device, &prop); + data->instance->pd_vtable.GetPhysicalDeviceMemoryProperties(data->physical_device, &prop); for (uint32_t i = 0; i < prop.memoryTypeCount; i++) if ((prop.memoryTypes[i].propertyFlags & properties) == properties && type_bits & (1<<i)) return i; @@ -2499,10 +2501,11 @@ static VkResult overlay_CreateDevice( struct device_data *device_data = new_device_data(*pDevice, instance_data); device_data->physical_device = physicalDevice; - vk_load_device_commands(*pDevice, fpGetDeviceProcAddr, &device_data->vtable); + vk_device_dispatch_table_load(&device_data->vtable, + fpGetDeviceProcAddr, *pDevice); - instance_data->vtable.GetPhysicalDeviceProperties(device_data->physical_device, - &device_data->properties); + instance_data->pd_vtable.GetPhysicalDeviceProperties(device_data->physical_device, + &device_data->properties); VkLayerDeviceCreateInfo *load_data_info = get_device_chain_info(pCreateInfo, VK_LOADER_DATA_CALLBACK); @@ -2547,9 +2550,12 @@ static VkResult overlay_CreateInstance( if (result != VK_SUCCESS) return result; struct instance_data *instance_data = new_instance_data(*pInstance); - vk_load_instance_commands(instance_data->instance, - fpGetInstanceProcAddr, - &instance_data->vtable); + vk_instance_dispatch_table_load(&instance_data->vtable, + fpGetInstanceProcAddr, + instance_data->instance); + vk_physical_device_dispatch_table_load(&instance_data->pd_vtable, + fpGetInstanceProcAddr, + instance_data->instance); instance_data_map_physical_devices(instance_data, true); parse_overlay_env(&instance_data->params, getenv("VK_LAYER_MESA_OVERLAY_CONFIG")); |