From: Igor Ostrowski Date: Tue, 25 Sep 2018 12:02:06 +0000 (+0200) Subject: Check for compatible memory type in VK_EXT_external_memory_host tests X-Git-Tag: upstream/1.3.5~2472 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a93356a8eefac76ec56f8385323672e7ec709702;p=platform%2Fupstream%2FVK-GL-CTS.git Check for compatible memory type in VK_EXT_external_memory_host tests Affects: dEQP-VK.memory.external_memory_host.* Components: Vulkan VK-GL-CTS issue: 1372 Change-Id: I37a3058acd6f838de259ded01032f7793012566b --- diff --git a/external/vulkancts/modules/vulkan/memory/vktMemoryExternalMemoryHostTests.cpp b/external/vulkancts/modules/vulkan/memory/vktMemoryExternalMemoryHostTests.cpp index 67c0482fb..d8f2b37da 100644 --- a/external/vulkancts/modules/vulkan/memory/vktMemoryExternalMemoryHostTests.cpp +++ b/external/vulkancts/modules/vulkan/memory/vktMemoryExternalMemoryHostTests.cpp @@ -78,6 +78,7 @@ protected: deUint32 getHostPointerMemoryTypeBits (void* hostPointer); Move allocateMemoryFromHostPointer (deUint32 memoryTypeIndex); void logMemoryTypeIndexPropertyFlags (deUint32 index); + bool findCompatibleMemoryTypeIndexToTest (deUint32 resourceMemoryTypeBits, deUint32 hostPointerMemoryTypeBits, deUint32* outMemoryTypeIndexToTest); bool findMemoryTypeIndexToTest (deUint32 hostPointerMemoryTypeBits, deUint32* outMemoryTypeIndexToTest); const InstanceInterface& m_vki; @@ -245,11 +246,11 @@ void ExternalMemoryHostBaseTestInstance::logMemoryTypeIndexPropertyFlags (deUint m_log << tcu::TestLog::Message << getMemoryPropertyFlagsStr(m_memoryProps.memoryTypes[index].propertyFlags) << tcu::TestLog::EndMessage; } -bool ExternalMemoryHostBaseTestInstance::findMemoryTypeIndexToTest (deUint32 hostPointerMemoryTypeBits, deUint32* outMemoryTypeIndexToTest) +bool ExternalMemoryHostBaseTestInstance::findCompatibleMemoryTypeIndexToTest (deUint32 resourceMemoryTypeBits, deUint32 hostPointerMemoryTypeBits, deUint32* outMemoryTypeIndexToTest) { for (deUint32 bitMaskPosition = 0; bitMaskPosition < VK_MAX_MEMORY_TYPES; bitMaskPosition++) { - if (isBitSet(hostPointerMemoryTypeBits, bitMaskPosition)) + if (isBitSet(resourceMemoryTypeBits & hostPointerMemoryTypeBits, bitMaskPosition)) { logMemoryTypeIndexPropertyFlags(bitMaskPosition); *outMemoryTypeIndexToTest = bitMaskPosition; @@ -259,6 +260,11 @@ bool ExternalMemoryHostBaseTestInstance::findMemoryTypeIndexToTest (deUint32 hos return false; } +bool ExternalMemoryHostBaseTestInstance::findMemoryTypeIndexToTest (deUint32 hostPointerMemoryTypeBits, deUint32* outMemoryTypeIndexToTest) +{ + return findCompatibleMemoryTypeIndexToTest(~0u, hostPointerMemoryTypeBits, outMemoryTypeIndexToTest); +} + tcu::TestStatus ExternalMemoryHostBaseTestInstance::iterate (void) { deUint32 hostPointerMemoryTypeBits; @@ -340,10 +346,10 @@ tcu::TestStatus ExternalMemoryHostRenderImageTestInstance::iterate () //find the usable memory type index hostPointerMemoryTypeBits = getHostPointerMemoryTypeBits(m_hostMemoryAlloc); - if (findMemoryTypeIndexToTest(hostPointerMemoryTypeBits, &memoryTypeIndexToTest)) - m_deviceMemoryAllocatedFromHostPointer = allocateMemoryFromHostPointer(memoryTypeIndexToTest); + if (findCompatibleMemoryTypeIndexToTest(imageMemoryRequirements.memoryTypeBits, hostPointerMemoryTypeBits, &memoryTypeIndexToTest)) + m_deviceMemoryAllocatedFromHostPointer = allocateMemoryFromHostPointer(memoryTypeIndexToTest); else - return tcu::TestStatus::fail("Fail"); + TCU_THROW(NotSupportedError, "Compatible memory type not found"); VK_CHECK(m_vkd.bindImageMemory(m_device, *m_image, *m_deviceMemoryAllocatedFromHostPointer, (m_testParams.m_useOffset ? imageMemoryRequirements.alignment : 0))); @@ -793,10 +799,10 @@ tcu::TestStatus ExternalMemoryHostSynchronizationTestInstance::iterate () //find the usable memory type index hostPointerMemoryTypeBits = getHostPointerMemoryTypeBits(m_hostMemoryAlloc); - if (findMemoryTypeIndexToTest(hostPointerMemoryTypeBits, &memoryTypeIndexToTest)) + if (findCompatibleMemoryTypeIndexToTest(bufferMemoryRequirements.memoryTypeBits, hostPointerMemoryTypeBits, &memoryTypeIndexToTest)) m_deviceMemoryAllocatedFromHostPointer = allocateMemoryFromHostPointer(memoryTypeIndexToTest); else - return tcu::TestStatus::fail("Fail"); + TCU_THROW(NotSupportedError, "Compatible memory type not found"); VK_CHECK(m_vkd.bindBufferMemory(m_device, *m_dataBuffer, *m_deviceMemoryAllocatedFromHostPointer, 0));