Improve comparison of VkPhysicalDeviceMemoryProperties
authorChia-I Wu <olv@google.com>
Sat, 28 May 2022 00:47:42 +0000 (17:47 -0700)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Thu, 2 Jun 2022 19:05:16 +0000 (19:05 +0000)
VkMemoryType should be fine, but VkMemoryHeap normally has a 4-byte
padding which can be garbage.  Compare individual members rather than
doing deMemCmp.

VK-GL-CTS Issue: 3590

Affects: dEQP-VK.api.info.get_physical_device_properties2.memory_properties

Components: Vulkan
Change-Id: I49e276ee15d10ca40f11c7a5fd3fb50b84ff1de3

external/vulkancts/modules/vulkan/api/vktApiFeatureInfo.cpp

index 5271a7e..d3fa9c2 100644 (file)
@@ -4545,12 +4545,18 @@ tcu::TestStatus deviceMemoryProperties2 (Context& context)
                TCU_FAIL("Mismatch between memoryTypeCount reported by vkGetPhysicalDeviceMemoryProperties and vkGetPhysicalDeviceMemoryProperties2");
        if (coreProperties.memoryHeapCount != extProperties.memoryProperties.memoryHeapCount)
                TCU_FAIL("Mismatch between memoryHeapCount reported by vkGetPhysicalDeviceMemoryProperties and vkGetPhysicalDeviceMemoryProperties2");
-       for (deUint32 i = 0; i < coreProperties.memoryTypeCount; i++)
-               if (deMemCmp(&coreProperties.memoryTypes[i], &extProperties.memoryProperties.memoryTypes[i], sizeof(VkMemoryType)) != 0)
+       for (deUint32 i = 0; i < coreProperties.memoryTypeCount; i++) {
+               const VkMemoryType *coreType = &coreProperties.memoryTypes[i];
+               const VkMemoryType *extType = &extProperties.memoryProperties.memoryTypes[i];
+               if (coreType->propertyFlags != extType->propertyFlags || coreType->heapIndex != extType->heapIndex)
                        TCU_FAIL("Mismatch between memoryTypes reported by vkGetPhysicalDeviceMemoryProperties and vkGetPhysicalDeviceMemoryProperties2");
-       for (deUint32 i = 0; i < coreProperties.memoryHeapCount; i++)
-               if (deMemCmp(&coreProperties.memoryHeaps[i], &extProperties.memoryProperties.memoryHeaps[i], sizeof(VkMemoryHeap)) != 0)
+       }
+       for (deUint32 i = 0; i < coreProperties.memoryHeapCount; i++) {
+               const VkMemoryHeap *coreHeap = &coreProperties.memoryHeaps[i];
+               const VkMemoryHeap *extHeap = &extProperties.memoryProperties.memoryHeaps[i];
+               if (coreHeap->size != extHeap->size || coreHeap->flags != extHeap->flags)
                        TCU_FAIL("Mismatch between memoryHeaps reported by vkGetPhysicalDeviceMemoryProperties and vkGetPhysicalDeviceMemoryProperties2");
+       }
 
        log << TestLog::Message << extProperties << TestLog::EndMessage;