From: Alexander Galazin Date: Thu, 31 Aug 2017 17:02:20 +0000 (+0200) Subject: Merge vk-gl-cts/vulkan-cts-1.0.1 into vk-gl-cts/vulkan-cts-1.0.2 X-Git-Tag: upstream/0.1.0~9^2~54 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ce6cf0e47017595c0e30a07f6b64ac3294582a98;p=platform%2Fupstream%2FVK-GL-CTS.git Merge vk-gl-cts/vulkan-cts-1.0.1 into vk-gl-cts/vulkan-cts-1.0.2 Change-Id: I5dfa06e462512838179803963ddd04094679aa4f --- ce6cf0e47017595c0e30a07f6b64ac3294582a98 diff --cc external/vulkancts/modules/vulkan/api/vktApiBufferTests.cpp index de73c49,1cebc7d..024e826 --- a/external/vulkancts/modules/vulkan/api/vktApiBufferTests.cpp +++ b/external/vulkancts/modules/vulkan/api/vktApiBufferTests.cpp @@@ -31,10 -30,10 +31,11 @@@ #include "vkPrograms.hpp" #include "vkQueryUtil.hpp" #include "vkRefUtil.hpp" -#include "vkPlatform.hpp" #include "vktTestCase.hpp" + #include "tcuPlatform.hpp" +#include + namespace vkt { namespace api @@@ -300,12 -270,24 +330,24 @@@ tcu::TestStatus BufferTestInstance::buf buffer = createBuffer(vk, vkDevice, &bufferParams); vk.getBufferMemoryRequirements(vkDevice, *buffer, &memReqs); - const deUint32 heapTypeIndex = (deUint32)deCtz32(memReqs.memoryTypeBits); - const VkMemoryType memoryType = memoryProperties.memoryTypes[heapTypeIndex]; - const VkMemoryHeap memoryHeap = memoryProperties.memoryHeaps[memoryType.heapIndex]; - const deUint32 shrinkBits = 4; // number of bits to shift when reducing the size with each iteration + const deUint32 heapTypeIndex = (deUint32)deCtz32(memReqs.memoryTypeBits); + const VkMemoryType memoryType = memoryProperties.memoryTypes[heapTypeIndex]; + const VkMemoryHeap memoryHeap = memoryProperties.memoryHeaps[memoryType.heapIndex]; - const VkDeviceSize maxBufferSize = deAlign64(memoryHeap.size >> 1u, memReqs.alignment); + const deUint32 shrinkBits = 4u; // number of bits to shift when reducing the size with each iteration + // Buffer size - Choose half of the reported heap size for the maximum buffer size, we + // should attempt to test as large a portion as possible. + // + // However on a system where device memory is shared with the system, the maximum size + // should be tested against the platform memory limits as significant portion of the heap + // may already be in use by the operating system and other running processes. + const VkDeviceSize availableBufferSize = getMaxBufferSize(memoryHeap.size, + memReqs.alignment, + getPlatformMemoryLimits(m_context)); + + // For our test buffer size, halve the maximum available size and align - const VkDeviceSize maxBufferSize = alignDeviceSize(availableBufferSize >> 1, memReqs.alignment); ++ const VkDeviceSize maxBufferSize = deAlign64(availableBufferSize >> 1, memReqs.alignment); + size = std::min(size, maxBufferSize); while (*memory == DE_NULL)