aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorArtem Kharytoniuk <artem@lunarg.com>2023-05-05 23:12:12 +0200
committerArtem <121836235+artem-lunarg@users.noreply.github.com>2023-05-06 02:23:38 +0200
commitfec27a3f6e3bae96a8f3e784d6d643afb41989d6 (patch)
treeb1d824efe72605141ecc8ceb992f6d720997adb1 /scripts
parentef785a6fca3b2549eb6001c417eca4e155c07262 (diff)
downloadusermoji-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 'scripts')
-rw-r--r--scripts/mock_icd_generator.py25
1 files changed, 21 insertions, 4 deletions
diff --git a/scripts/mock_icd_generator.py b/scripts/mock_icd_generator.py
index 0a0e8adc..22b7d1ff 100644
--- a/scripts/mock_icd_generator.py
+++ b/scripts/mock_icd_generator.py
@@ -1016,10 +1016,19 @@ CUSTOM_C_INTERCEPTS = {
GetPhysicalDeviceExternalFenceProperties(physicalDevice, pExternalFenceInfo, pExternalFenceProperties);
''',
'vkGetPhysicalDeviceExternalBufferProperties':'''
- // 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;
+ }
''',
'vkGetPhysicalDeviceExternalBufferPropertiesKHR':'''
GetPhysicalDeviceExternalBufferProperties(physicalDevice, pExternalBufferInfo, pExternalBufferProperties);
@@ -1210,6 +1219,14 @@ CUSTOM_C_INTERCEPTS = {
}
return VK_SUCCESS;
''',
+'vkGetFenceWin32HandleKHR': '''
+ *pHandle = (HANDLE)0x12345678;
+ return VK_SUCCESS;
+''',
+'vkGetFenceFdKHR': '''
+ *pFd = 0x42;
+ return VK_SUCCESS;
+''',
'vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR': '''
if (!pCounters) {
*pCounterCount = 3;