diff options
| author | Artem Kharytoniuk <artem@lunarg.com> | 2023-05-05 23:12:12 +0200 |
|---|---|---|
| committer | Artem <121836235+artem-lunarg@users.noreply.github.com> | 2023-05-06 02:23:38 +0200 |
| commit | fec27a3f6e3bae96a8f3e784d6d643afb41989d6 (patch) | |
| tree | b1d824efe72605141ecc8ceb992f6d720997adb1 /icd/generated/mock_icd.cpp | |
| parent | ef785a6fca3b2549eb6001c417eca4e155c07262 (diff) | |
| download | usermoji-fec27a3f6e3bae96a8f3e784d6d643afb41989d6.tar.xz | |
mock: Extend external memory functionality
GetPhysicalDeviceExternalBufferProperties changes:
Previous implementation violated property that handle type is at
least compatible with itself. It's needed to implement testing for
VUID-VkMemoryAllocateInfo-pNext-00639
GetFenceWin32HandleKHR/GetFenceFdKHR changes:
Return not null handles to pass
VUID-VkImportFenceWin32HandleInfoKHR-handle-01462
Diffstat (limited to 'icd/generated/mock_icd.cpp')
| -rw-r--r-- | icd/generated/mock_icd.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/icd/generated/mock_icd.cpp b/icd/generated/mock_icd.cpp index 845ced49..8c193180 100644 --- a/icd/generated/mock_icd.cpp +++ b/icd/generated/mock_icd.cpp @@ -2020,10 +2020,19 @@ static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceExternalBufferProperties( const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo, VkExternalBufferProperties* pExternalBufferProperties) { - // Hard-code support for all handle types and features - pExternalBufferProperties->externalMemoryProperties.externalMemoryFeatures = 0x7; - pExternalBufferProperties->externalMemoryProperties.exportFromImportedHandleTypes = 0x1FF; - pExternalBufferProperties->externalMemoryProperties.compatibleHandleTypes = 0x1FF; + constexpr VkExternalMemoryHandleTypeFlags supported_flags = 0x1FF; + if (pExternalBufferInfo->handleType & supported_flags) { + pExternalBufferProperties->externalMemoryProperties.externalMemoryFeatures = 0x7; + pExternalBufferProperties->externalMemoryProperties.exportFromImportedHandleTypes = supported_flags; + pExternalBufferProperties->externalMemoryProperties.compatibleHandleTypes = supported_flags; + } else { + pExternalBufferProperties->externalMemoryProperties.externalMemoryFeatures = 0; + pExternalBufferProperties->externalMemoryProperties.exportFromImportedHandleTypes = 0; + // According to spec, handle type is always compatible with itself. Even if export/import + // not supported, it's important to properly implement self-compatibility property since + // application's control flow can rely on this. + pExternalBufferProperties->externalMemoryProperties.compatibleHandleTypes = pExternalBufferInfo->handleType; + } } static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceExternalFenceProperties( @@ -3504,7 +3513,7 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetFenceWin32HandleKHR( const VkFenceGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle) { -//Not a CREATE or DESTROY function + *pHandle = (HANDLE)0x12345678; return VK_SUCCESS; } #endif /* VK_USE_PLATFORM_WIN32_KHR */ @@ -3523,7 +3532,7 @@ static VKAPI_ATTR VkResult VKAPI_CALL GetFenceFdKHR( const VkFenceGetFdInfoKHR* pGetFdInfo, int* pFd) { -//Not a CREATE or DESTROY function + *pFd = 0x42; return VK_SUCCESS; } |
