diff options
| author | Mark Young <marky@lunarg.com> | 2016-12-02 15:02:52 -0700 |
|---|---|---|
| committer | Mark Young <marky@lunarg.com> | 2016-12-02 16:40:28 -0700 |
| commit | d632edb84aea1bf041cf60ab4cf9d52eb6fb447c (patch) | |
| tree | 34ca72815831ade73caf0bc1ff90c2d62ee92d64 | |
| parent | bd2da189dccf8652632197876713d72ad0ecf3f2 (diff) | |
| download | usermoji-d632edb84aea1bf041cf60ab4cf9d52eb6fb447c.tar.xz | |
loader: Modify debug_marker terminators
Modify the 2 debug marker terminators we use so that they don't call
into the ICD unless the ICD commands exist.
Change-Id: I72a96475f21d0fca572f3c5e6f5676782a8a4bf3
| -rw-r--r-- | loader/extensions.c | 92 |
1 files changed, 49 insertions, 43 deletions
diff --git a/loader/extensions.c b/loader/extensions.c index 0a9f918b..5503df52 100644 --- a/loader/extensions.c +++ b/loader/extensions.c @@ -51,30 +51,33 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_DebugMarkerSetObjectTagEXT( struct loader_device *dev; struct loader_icd_term *icd_term = loader_get_icd_and_device(device, &dev, &icd_index); - // If this is a physical device, we have to replace it with the proper one - // for the next call. - if (pTagInfo->objectType == - VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) { - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)(uintptr_t)pTagInfo->object; - pTagInfo->object = (uint64_t)(uintptr_t)phys_dev_term->phys_dev; - - // If this is a KHR_surface, and the ICD has created its own, we have to - // replace it with the proper one for the next call. - } else if (pTagInfo->objectType == - VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT) { - if (NULL != icd_term && NULL != icd_term->CreateSwapchainKHR) { - VkIcdSurface *icd_surface = - (VkIcdSurface *)(uintptr_t)pTagInfo->object; - if (NULL != icd_surface->real_icd_surfaces) { - pTagInfo->object = - (uint64_t)icd_surface->real_icd_surfaces[icd_index]; + if (NULL != icd_term && NULL != icd_term->DebugMarkerSetObjectTagEXT) { + // If this is a physical device, we have to replace it with the proper + // one for the next call. + if (pTagInfo->objectType == + VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) { + struct loader_physical_device_term *phys_dev_term = + (struct loader_physical_device_term *)(uintptr_t) + pTagInfo->object; + pTagInfo->object = (uint64_t)(uintptr_t)phys_dev_term->phys_dev; + + // If this is a KHR_surface, and the ICD has created its own, we + // have to replace it with the proper one for the next call. + } else if (pTagInfo->objectType == + VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT) { + if (NULL != icd_term && NULL != icd_term->CreateSwapchainKHR) { + VkIcdSurface *icd_surface = + (VkIcdSurface *)(uintptr_t)pTagInfo->object; + if (NULL != icd_surface->real_icd_surfaces) { + pTagInfo->object = + (uint64_t)icd_surface->real_icd_surfaces[icd_index]; + } } } + return icd_term->DebugMarkerSetObjectTagEXT(device, pTagInfo); + } else { + return VK_SUCCESS; } - assert(icd_term != NULL && icd_term->DebugMarkerSetObjectTagEXT && - "loader: null DebugMarkerSetObjectTagEXT ICD pointer"); - return icd_term->DebugMarkerSetObjectTagEXT(device, pTagInfo); } VKAPI_ATTR VkResult VKAPI_CALL vkDebugMarkerSetObjectNameEXT( @@ -97,31 +100,34 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_DebugMarkerSetObjectNameEXT( struct loader_device *dev; struct loader_icd_term *icd_term = loader_get_icd_and_device(device, &dev, &icd_index); - // If this is a physical device, we have to replace it with the proper one - // for the next call. - if (pNameInfo->objectType == - VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) { - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)(uintptr_t)pNameInfo->object; - pNameInfo->object = (uint64_t)(uintptr_t)phys_dev_term->phys_dev; - - // If this is a KHR_surface, and the ICD has created its own, we have to - // replace it with the proper one for the next call. - } else if (pNameInfo->objectType == - VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT) { - if (NULL != icd_term && NULL != icd_term->CreateSwapchainKHR) { - VkIcdSurface *icd_surface = - (VkIcdSurface *)(uintptr_t)pNameInfo->object; - if (NULL != icd_surface->real_icd_surfaces) { - pNameInfo->object = - (uint64_t)( - uintptr_t)icd_surface->real_icd_surfaces[icd_index]; + if (NULL != icd_term && NULL != icd_term->DebugMarkerSetObjectNameEXT) { + // If this is a physical device, we have to replace it with the proper + // one for the next call. + if (pNameInfo->objectType == + VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) { + struct loader_physical_device_term *phys_dev_term = + (struct loader_physical_device_term *)(uintptr_t) + pNameInfo->object; + pNameInfo->object = (uint64_t)(uintptr_t)phys_dev_term->phys_dev; + + // If this is a KHR_surface, and the ICD has created its own, we + // have to replace it with the proper one for the next call. + } else if (pNameInfo->objectType == + VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT) { + if (NULL != icd_term && NULL != icd_term->CreateSwapchainKHR) { + VkIcdSurface *icd_surface = + (VkIcdSurface *)(uintptr_t)pNameInfo->object; + if (NULL != icd_surface->real_icd_surfaces) { + pNameInfo->object = + (uint64_t)( + uintptr_t)icd_surface->real_icd_surfaces[icd_index]; + } } } + return icd_term->DebugMarkerSetObjectNameEXT(device, pNameInfo); + } else { + return VK_SUCCESS; } - assert(icd_term != NULL && icd_term->DebugMarkerSetObjectNameEXT && - "loader: null DebugMarkerSetObjectNameEXT ICD pointer"); - return icd_term->DebugMarkerSetObjectNameEXT(device, pNameInfo); } // Definitions for the VK_NV_external_memory_capabilities extension |
