From: Mike Schuchardt Date: Tue, 17 Oct 2017 15:54:23 +0000 (-0600) Subject: layers: Add VK_KHR_external_semaphore_fd functions X-Git-Tag: upstream/1.1.92~716 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7018e6c4b72d42be5b6f231bbcab22f859a0749c;p=platform%2Fupstream%2FVulkan-Tools.git layers: Add VK_KHR_external_semaphore_fd functions Add entry points and wire up to existing validation in place for VK_KHR_external_semaphore_win32 Change-Id: I82da27d6a68c7b4eea3f01b4dd4fa0ce38d97f0b --- diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 117742a..90ca8a4 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -9011,6 +9011,22 @@ ImportSemaphoreWin32HandleKHR(VkDevice device, const VkImportSemaphoreWin32Handl } #endif +VKAPI_ATTR VkResult VKAPI_CALL ImportSemaphoreFdKHR(VkDevice device, const VkImportSemaphoreFdInfoKHR *pImportSemaphoreFdInfo) { + VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; + layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); + bool skip = PreCallValidateImportSemaphore(dev_data, pImportSemaphoreFdInfo->semaphore, "vkImportSemaphoreFdKHR"); + + if (!skip) { + result = dev_data->dispatch_table.ImportSemaphoreFdKHR(device, pImportSemaphoreFdInfo); + } + + if (result == VK_SUCCESS) { + PostCallRecordImportSemaphore(dev_data, pImportSemaphoreFdInfo->semaphore, pImportSemaphoreFdInfo->handleType, + pImportSemaphoreFdInfo->flags); + } + return result; +} + static void PostCallRecordGetSemaphore(layer_data *dev_data, VkSemaphore semaphore, VkExternalSemaphoreHandleTypeFlagBitsKHR handle_type) { SEMAPHORE_NODE *sema_node = GetSemaphoreNode(dev_data, semaphore); @@ -9034,6 +9050,16 @@ VKAPI_ATTR VkResult VKAPI_CALL GetSemaphoreWin32HandleKHR(VkDevice device, } #endif +VKAPI_ATTR VkResult VKAPI_CALL GetSemaphoreFdKHR(VkDevice device, const VkSemaphoreGetFdInfoKHR *pGetFdInfo, int *pFd) { + layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); + VkResult result = dev_data->dispatch_table.GetSemaphoreFdKHR(device, pGetFdInfo, pFd); + + if (result == VK_SUCCESS) { + PostCallRecordGetSemaphore(dev_data, pGetFdInfo->semaphore, pGetFdInfo->handleType); + } + return result; +} + VKAPI_ATTR VkResult VKAPI_CALL CreateEvent(VkDevice device, const VkEventCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkEvent *pEvent) { layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); @@ -10952,6 +10978,8 @@ static const std::unordered_map name_to_funcptr_map = { {"vkGetPhysicalDeviceDisplayPlanePropertiesKHR", (void*)GetPhysicalDeviceDisplayPlanePropertiesKHR}, {"GetDisplayPlaneSupportedDisplaysKHR", (void*)GetDisplayPlaneSupportedDisplaysKHR}, {"GetDisplayPlaneCapabilitiesKHR", (void*)GetDisplayPlaneCapabilitiesKHR}, + {"vkImportSemaphoreFdKHR", (void*)ImportSemaphoreFdKHR}, + {"vkGetSemaphoreFdKHR", (void*)GetSemaphoreFdKHR}, }; VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetDeviceProcAddr(VkDevice device, const char *funcName) {