aboutsummaryrefslogtreecommitdiff
path: root/layers/core_validation.cpp
diff options
context:
space:
mode:
authorMike Schuchardt <mikes@lunarg.com>2017-10-17 09:54:23 -0600
committerMike Schuchardt <mikes@lunarg.com>2017-10-18 09:03:01 -0600
commit7018e6c4b72d42be5b6f231bbcab22f859a0749c (patch)
tree021c884e396525a7f51ba89598cda05a287fb211 /layers/core_validation.cpp
parent8e742fc8adb7740ee9e89ea426a3720a36f2f74a (diff)
downloadusermoji-7018e6c4b72d42be5b6f231bbcab22f859a0749c.tar.xz
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
Diffstat (limited to 'layers/core_validation.cpp')
-rw-r--r--layers/core_validation.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index 117742aa..90ca8a4e 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<std::string, void*> 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) {