diff options
author | 2020-07-05 22:52:04 -0700 | |
---|---|---|
committer | 2020-07-07 16:55:52 -0700 | |
commit | e1f35011c42fe3f93cfe68c5916a746a92c20557 (patch) | |
tree | 73de251d6e6d51a66fddf0441771ee8e3b285910 /vulkan/libvulkan/driver.cpp | |
parent | a55624ba5ae108daf326b03e1fe68165206b883a (diff) |
libvulkan: fix support for promoted VK_KHR_external_* extensions
This change intercepts below entry points:
vkGetPhysicalDeviceExternalBufferProperties
vkGetPhysicalDeviceExternalSemaphoreProperties
vkGetPhysicalDeviceExternalFenceProperties
Bug: 160276146
Test: adb shell cmd gpu vkjson
Test: dEQP-VK.api.external.*
Change-Id: I08e5647fd7ea48c2a0b2e28ef688dee44f85684c
Diffstat (limited to 'vulkan/libvulkan/driver.cpp')
-rw-r--r-- | vulkan/libvulkan/driver.cpp | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/vulkan/libvulkan/driver.cpp b/vulkan/libvulkan/driver.cpp index d2fdf42bd6..535e19063f 100644 --- a/vulkan/libvulkan/driver.cpp +++ b/vulkan/libvulkan/driver.cpp @@ -634,6 +634,9 @@ void CreateInfoWrapper::FilterExtension(const char* name) { break; case ProcHook::KHR_get_physical_device_properties2: case ProcHook::KHR_device_group_creation: + case ProcHook::KHR_external_memory_capabilities: + case ProcHook::KHR_external_semaphore_capabilities: + case ProcHook::KHR_external_fence_capabilities: case ProcHook::EXTENSION_UNKNOWN: // Extensions we don't need to do anything about at this level break; @@ -691,6 +694,9 @@ void CreateInfoWrapper::FilterExtension(const char* name) { case ProcHook::KHR_android_surface: case ProcHook::KHR_get_physical_device_properties2: case ProcHook::KHR_device_group_creation: + case ProcHook::KHR_external_memory_capabilities: + case ProcHook::KHR_external_semaphore_capabilities: + case ProcHook::KHR_external_fence_capabilities: case ProcHook::KHR_get_surface_capabilities2: case ProcHook::KHR_surface: case ProcHook::EXT_debug_report: @@ -1484,5 +1490,81 @@ void GetPhysicalDeviceSparseImageFormatProperties2( physicalDevice, pFormatInfo, pPropertyCount, pProperties); } +void GetPhysicalDeviceExternalBufferProperties( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo, + VkExternalBufferProperties* pExternalBufferProperties) { + ATRACE_CALL(); + + const auto& driver = GetData(physicalDevice).driver; + + if (driver.GetPhysicalDeviceExternalBufferProperties) { + driver.GetPhysicalDeviceExternalBufferProperties( + physicalDevice, pExternalBufferInfo, pExternalBufferProperties); + return; + } + + if (driver.GetPhysicalDeviceExternalBufferPropertiesKHR) { + driver.GetPhysicalDeviceExternalBufferPropertiesKHR( + physicalDevice, pExternalBufferInfo, pExternalBufferProperties); + return; + } + + memset(&pExternalBufferProperties->externalMemoryProperties, 0, + sizeof(VkExternalMemoryProperties)); +} + +void GetPhysicalDeviceExternalSemaphoreProperties( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo, + VkExternalSemaphoreProperties* pExternalSemaphoreProperties) { + ATRACE_CALL(); + + const auto& driver = GetData(physicalDevice).driver; + + if (driver.GetPhysicalDeviceExternalSemaphoreProperties) { + driver.GetPhysicalDeviceExternalSemaphoreProperties( + physicalDevice, pExternalSemaphoreInfo, + pExternalSemaphoreProperties); + return; + } + + if (driver.GetPhysicalDeviceExternalSemaphorePropertiesKHR) { + driver.GetPhysicalDeviceExternalSemaphorePropertiesKHR( + physicalDevice, pExternalSemaphoreInfo, + pExternalSemaphoreProperties); + return; + } + + pExternalSemaphoreProperties->exportFromImportedHandleTypes = 0; + pExternalSemaphoreProperties->compatibleHandleTypes = 0; + pExternalSemaphoreProperties->externalSemaphoreFeatures = 0; +} + +void GetPhysicalDeviceExternalFenceProperties( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo, + VkExternalFenceProperties* pExternalFenceProperties) { + ATRACE_CALL(); + + const auto& driver = GetData(physicalDevice).driver; + + if (driver.GetPhysicalDeviceExternalFenceProperties) { + driver.GetPhysicalDeviceExternalFenceProperties( + physicalDevice, pExternalFenceInfo, pExternalFenceProperties); + return; + } + + if (driver.GetPhysicalDeviceExternalFencePropertiesKHR) { + driver.GetPhysicalDeviceExternalFencePropertiesKHR( + physicalDevice, pExternalFenceInfo, pExternalFenceProperties); + return; + } + + pExternalFenceProperties->exportFromImportedHandleTypes = 0; + pExternalFenceProperties->compatibleHandleTypes = 0; + pExternalFenceProperties->externalFenceFeatures = 0; +} + } // namespace driver } // namespace vulkan |