From: ziga-lunarg Date: Fri, 14 Oct 2022 22:53:12 +0000 (+0200) Subject: Fix flush memory range in ssbo corner case tests X-Git-Tag: upstream/1.3.5~2^2^2^2~5^2~5^2~6^2~1^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=01b3c2210fcc79bcb45adfe811f502b3351e5e9d;p=platform%2Fupstream%2FVK-GL-CTS.git Fix flush memory range in ssbo corner case tests The size in VKMappedMemoryRange used in vkFlushMappedMemoryRanges must either be a multiple of VkPhysicalDeviceLimits::nonCoherentAtomSize or offset + size must be equal to the size of memory Components: Vulkan VK-GL-CTS issue: 4044 Affected tests: dEQP-VK.ssbo.corner_case.* Change-Id: I9ea2ee1e055b55ec39988a6ec0539cd3219937f4 --- diff --git a/external/vulkancts/modules/vulkan/ssbo/vktSSBOCornerCase.cpp b/external/vulkancts/modules/vulkan/ssbo/vktSSBOCornerCase.cpp index bd7f75371..f1bcd0037 100644 --- a/external/vulkancts/modules/vulkan/ssbo/vktSSBOCornerCase.cpp +++ b/external/vulkancts/modules/vulkan/ssbo/vktSSBOCornerCase.cpp @@ -113,13 +113,17 @@ struct Buffer Buffer (void) : buffer(0), size(0) {} }; -de::MovePtr allocateAndBindMemory (Context &context, vk::VkBuffer buffer, vk::MemoryRequirement memReqs) +de::MovePtr allocateAndBindMemory (Context &context, vk::VkBuffer buffer, vk::MemoryRequirement memReqs, vk::VkDeviceSize* allocationSize = DE_NULL) { const vk::DeviceInterface &vkd = context.getDeviceInterface(); const vk::VkMemoryRequirements bufReqs = vk::getBufferMemoryRequirements(vkd, context.getDevice(), buffer); de::MovePtr memory = context.getDefaultAllocator().allocate(bufReqs, memReqs); vkd.bindBufferMemory(context.getDevice(), buffer, memory->getMemory(), memory->getOffset()); + if (allocationSize) + { + *allocationSize = bufReqs.size; + } return memory; } @@ -176,10 +180,11 @@ tcu::TestStatus SSBOCornerCaseInstance::iterate (void) // Create descriptor set const deUint32 acBufferSize = 4; vk::Move acBuffer (createBuffer(m_context, acBufferSize, vk:: VK_BUFFER_USAGE_STORAGE_BUFFER_BIT)); - de::UniquePtr acBufferAlloc (allocateAndBindMemory(m_context, *acBuffer, vk::MemoryRequirement::HostVisible)); + vk::VkDeviceSize acMemorySize = 0; + de::UniquePtr acBufferAlloc (allocateAndBindMemory(m_context, *acBuffer, vk::MemoryRequirement::HostVisible, &acMemorySize)); deMemset(acBufferAlloc->getHostPtr(), 0, acBufferSize); - flushMappedMemoryRange(vk, device, acBufferAlloc->getMemory(), acBufferAlloc->getOffset(), acBufferSize); + flushMappedMemoryRange(vk, device, acBufferAlloc->getMemory(), acBufferAlloc->getOffset(), acMemorySize); vk::DescriptorSetLayoutBuilder setLayoutBuilder; vk::DescriptorPoolBuilder poolBuilder;