diff options
| author | Chia-I Wu <olv@google.com> | 2016-05-17 07:57:15 +0800 |
|---|---|---|
| committer | Tobin Ehlis <tobine@google.com> | 2016-05-24 06:29:13 -0600 |
| commit | a9b5ac2c9c02a4228da2f0bb1484e64d7e4aaf90 (patch) | |
| tree | 695b405732d832056631055ea3a42bcd0c5b917a | |
| parent | 3a95297e852daec72bd7bad002eeab34eead22c2 (diff) | |
| download | usermoji-a9b5ac2c9c02a4228da2f0bb1484e64d7e4aaf90.tar.xz | |
object_tracker: avoid invalid GIPA call in vkCreateDevice
Save VkInstance in layer_data so that we query vkCreateDevice with a valid
instance.
| -rw-r--r-- | layers/object_tracker.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/layers/object_tracker.h b/layers/object_tracker.h index 623600ae..333775ae 100644 --- a/layers/object_tracker.h +++ b/layers/object_tracker.h @@ -71,6 +71,8 @@ typedef uint64_t (*OBJ_TRACK_GET_OBJECT_COUNT)(VkDevice); typedef uint64_t (*OBJ_TRACK_GET_OBJECTS_OF_TYPE_COUNT)(VkDevice, VkDebugReportObjectTypeEXT); struct layer_data { + VkInstance instance; + debug_report_data *report_data; // TODO: put instance data here std::vector<VkDebugReportCallbackEXT> logging_callback; @@ -617,6 +619,7 @@ VkResult explicit_CreateInstance(const VkInstanceCreateInfo *pCreateInfo, const } layer_data *my_data = get_my_data_ptr(get_dispatch_key(*pInstance), layer_data_map); + my_data->instance = *pInstance; initInstanceTable(*pInstance, fpGetInstanceProcAddr, object_tracker_instance_table_map); VkLayerInstanceDispatchTable *pInstanceTable = get_dispatch_table(object_tracker_instance_table_map, *pInstance); @@ -650,12 +653,13 @@ void explicit_GetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice gpu, uint3 VkResult explicit_CreateDevice(VkPhysicalDevice gpu, const VkDeviceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) { std::lock_guard<std::mutex> lock(global_lock); + layer_data *my_instance_data = get_my_data_ptr(get_dispatch_key(gpu), layer_data_map); VkLayerDeviceCreateInfo *chain_info = get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO); assert(chain_info->u.pLayerInfo); PFN_vkGetInstanceProcAddr fpGetInstanceProcAddr = chain_info->u.pLayerInfo->pfnNextGetInstanceProcAddr; PFN_vkGetDeviceProcAddr fpGetDeviceProcAddr = chain_info->u.pLayerInfo->pfnNextGetDeviceProcAddr; - PFN_vkCreateDevice fpCreateDevice = (PFN_vkCreateDevice)fpGetInstanceProcAddr(NULL, "vkCreateDevice"); + PFN_vkCreateDevice fpCreateDevice = (PFN_vkCreateDevice)fpGetInstanceProcAddr(my_instance_data->instance, "vkCreateDevice"); if (fpCreateDevice == NULL) { return VK_ERROR_INITIALIZATION_FAILED; } @@ -668,7 +672,6 @@ VkResult explicit_CreateDevice(VkPhysicalDevice gpu, const VkDeviceCreateInfo *p return result; } - layer_data *my_instance_data = get_my_data_ptr(get_dispatch_key(gpu), layer_data_map); layer_data *my_device_data = get_my_data_ptr(get_dispatch_key(*pDevice), layer_data_map); my_device_data->report_data = layer_debug_report_create_device(my_instance_data->report_data, *pDevice); |
