From 9d48003e29961be9a0c49fde7e539605de31e3d2 Mon Sep 17 00:00:00 2001 From: James Fitzpatrick Date: Wed, 8 Dec 2021 12:17:29 +0000 Subject: [PATCH] Fix requirements tests for multiplane images The memory requirements tests for multiplane images would previously assume that bits were not sparsely set in memoryTypeBits. This could lead to the tests assuming that an implementation was returning a lazily allocated memory type for an image without transient attachment set. Affects: dEQP-VK.memory.requirements.*multiplane_image* Components: Vulkan VK-GL-CTS issue: 3405 Change-Id: Ic1e56d7412ac413da907059c79b3f7064b3c664b --- .../modules/vulkan/memory/vktMemoryRequirementsTests.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/external/vulkancts/modules/vulkan/memory/vktMemoryRequirementsTests.cpp b/external/vulkancts/modules/vulkan/memory/vktMemoryRequirementsTests.cpp index 4010f52..6d35e68 100644 --- a/external/vulkancts/modules/vulkan/memory/vktMemoryRequirementsTests.cpp +++ b/external/vulkancts/modules/vulkan/memory/vktMemoryRequirementsTests.cpp @@ -1657,13 +1657,15 @@ tcu::TestStatus testMultiplaneImages (Context& context, ImageTestParams params) if (result.check(requirements.memoryRequirements.memoryTypeBits != 0, "No supported memory types")) { - bool hasHostVisibleType = false; + typedef std::vector::const_iterator IndexIterator; + const std::vector usedMemoryTypeIndices = bitsToIndices(requirements.memoryRequirements.memoryTypeBits); + bool hasHostVisibleType = false; - for (deUint32 memoryTypeIndex = 0; (0x1u << memoryTypeIndex) <= requirements.memoryRequirements.memoryTypeBits; memoryTypeIndex++) + for (IndexIterator memoryTypeNdx = usedMemoryTypeIndices.begin(); memoryTypeNdx != usedMemoryTypeIndices.end(); ++memoryTypeNdx) { - if (result.check(memoryTypeIndex < memoryProperties.memoryTypeCount, "Unknown memory type bits set in memory requirements")) + if (result.check(*memoryTypeNdx < memoryProperties.memoryTypeCount, "Unknown memory type bits set in memory requirements")) { - const VkMemoryPropertyFlags propertyFlags (memoryProperties.memoryTypes[memoryTypeIndex].propertyFlags); + const VkMemoryPropertyFlags propertyFlags (memoryProperties.memoryTypes[*memoryTypeNdx].propertyFlags); if (propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) hasHostVisibleType = true; -- 2.7.4