Correct Flush(/Invalidate)MappedMemoryRange
authorPiotr Byszewski <piotr.byszewski@mobica.com>
Tue, 17 Mar 2020 15:15:45 +0000 (16:15 +0100)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 24 Apr 2020 09:38:08 +0000 (05:38 -0400)
This change replaces memory mapping calls that used calculated or
constant size with flushAlloc/invalidateAlloc helper functions.
Dedicated memory mapping tests were not affected by this change
same as tests that for memory mapping already used VK_WHOLE_SIZE
and tests that calculated mapping size basing on nonCoherentAtomSize.

Components: Vulkan

VK-GL-CTS issue: 78

Affects:
dEQP-VK.*

Change-Id: Idc20719e0c3a942459290b7c5cbea6ac1d5a2588

31 files changed:
external/vulkancts/modules/vulkan/api/vktApiExternalMemoryTests.cpp
external/vulkancts/modules/vulkan/api/vktApiSmokeTests.cpp
external/vulkancts/modules/vulkan/binding_model/vktBindingBufferDeviceAddressTests.cpp
external/vulkancts/modules/vulkan/binding_model/vktBindingDescriptorCopyTests.cpp
external/vulkancts/modules/vulkan/binding_model/vktBindingDescriptorSetRandomTests.cpp
external/vulkancts/modules/vulkan/descriptor_indexing/vktDescriptorSetsIndexingTests.hpp
external/vulkancts/modules/vulkan/descriptor_indexing/vktDescriptorSetsIndexingTestsUtils.cpp
external/vulkancts/modules/vulkan/draw/vktDrawDiscardRectanglesTests.cpp
external/vulkancts/modules/vulkan/draw/vktDrawShaderLayerTests.cpp
external/vulkancts/modules/vulkan/draw/vktDrawShaderViewportIndexTests.cpp
external/vulkancts/modules/vulkan/geometry/vktGeometryBasicClass.cpp
external/vulkancts/modules/vulkan/geometry/vktGeometryLayeredRenderingTests.cpp
external/vulkancts/modules/vulkan/image/vktImageQualifiersTests.cpp
external/vulkancts/modules/vulkan/memory/vktMemoryExternalMemoryHostTests.cpp
external/vulkancts/modules/vulkan/memory/vktMemoryPipelineBarrierTests.cpp
external/vulkancts/modules/vulkan/memory_model/vktMemoryModelMessagePassing.cpp
external/vulkancts/modules/vulkan/multiview/vktMultiViewRenderTests.cpp
external/vulkancts/modules/vulkan/protected_memory/vktProtectedMemBufferValidator.hpp
external/vulkancts/modules/vulkan/protected_memory/vktProtectedMemImageValidator.cpp
external/vulkancts/modules/vulkan/protected_memory/vktProtectedMemShaderImageAccessTests.cpp
external/vulkancts/modules/vulkan/protected_memory/vktProtectedMemStorageBufferTests.cpp
external/vulkancts/modules/vulkan/protected_memory/vktProtectedMemUtils.cpp
external/vulkancts/modules/vulkan/protected_memory/vktProtectedMemWsiSwapchainTests.cpp
external/vulkancts/modules/vulkan/protected_memory/vktProtectedMemYCbCrConversionTests.cpp
external/vulkancts/modules/vulkan/query_pool/vktQueryPoolPerformanceTests.cpp
external/vulkancts/modules/vulkan/query_pool/vktQueryPoolStatisticsTests.cpp
external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBufferSparseResidency.cpp
external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmGraphicsShaderTestUtil.cpp
external/vulkancts/modules/vulkan/ssbo/vktSSBOLayoutCase.cpp
external/vulkancts/modules/vulkan/transform_feedback/vktTransformFeedbackSimpleTests.cpp
external/vulkancts/modules/vulkan/vktShaderLibrary.cpp

index 2bbded1..c15fff5 100644 (file)
@@ -139,7 +139,7 @@ void writeHostMemory (const vk::DeviceInterface&    vkd,
 
        deMemcpy(ptr, data, size);
 
-       flushMappedMemoryRange(vkd, device, memory, 0, size);
+       flushMappedMemoryRange(vkd, device, memory, 0, VK_WHOLE_SIZE);
 
        vkd.unmapMemory(device, memory);
 }
@@ -152,7 +152,7 @@ void checkHostMemory (const vk::DeviceInterface&    vkd,
 {
        void* const ptr = vk::mapMemory(vkd, device, memory, 0, size, 0);
 
-       invalidateMappedMemoryRange(vkd, device, memory, 0, size);
+       invalidateMappedMemoryRange(vkd, device, memory, 0, VK_WHOLE_SIZE);
 
        if (deMemCmp(ptr, data, size) != 0)
                TCU_FAIL("Memory contents don't match");
index 5c89122..3602448 100644 (file)
@@ -554,17 +554,9 @@ tcu::TestStatus renderTriangleTest (Context& context)
        // Read results, render reference, compare
        {
                const tcu::TextureFormat                        tcuFormat               = vk::mapVkFormat(colorFormat);
-               const VkMappedMemoryRange                       range                   =
-               {
-                       VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,  // sType
-                       DE_NULL,                                                                // pNext
-                       readImageBufferMemory->getMemory(),             // memory
-                       0,                                                                              // offset
-                       imageSizeBytes,                                                 // size
-               };
                const tcu::ConstPixelBufferAccess       resultAccess    (tcuFormat, renderSize.x(), renderSize.y(), 1, readImageBufferMemory->getHostPtr());
 
-               VK_CHECK(vk.invalidateMappedMemoryRanges(vkDevice, 1u, &range));
+               invalidateAlloc(vk, vkDevice, *readImageBufferMemory);
 
                {
                        tcu::TextureLevel       refImage                (tcuFormat, renderSize.x(), renderSize.y());
@@ -1165,17 +1157,9 @@ tcu::TestStatus renderTriangleDummyExtStructTest (Context& context)
        // Read results, render reference, compare
        {
                const tcu::TextureFormat                                        tcuFormat                                                       = vk::mapVkFormat(colorFormat);
-               const VkMappedMemoryRange                                       range                                                           =
-               {
-                       VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,  // sType
-                       &dummyExtStruct,                                                // pNext
-                       readImageBufferMemory->getMemory(),             // memory
-                       0,                                                                              // offset
-                       imageSizeBytes,                                                 // size
-               };
                const tcu::ConstPixelBufferAccess                       resultAccess                                            (tcuFormat, renderSize.x(), renderSize.y(), 1, readImageBufferMemory->getHostPtr());
 
-               VK_CHECK(vk.invalidateMappedMemoryRanges(vkDevice, 1u, &range));
+               invalidateAlloc(vk, vkDevice, *readImageBufferMemory);
 
                {
                        tcu::TextureLevel                                               refImage                                                        (tcuFormat, renderSize.x(), renderSize.y());
@@ -1475,17 +1459,9 @@ tcu::TestStatus renderTriangleUnusedResolveAttachmentTest (Context& context)
        // Read results, render reference, compare
        {
                const tcu::TextureFormat                        tcuFormat               = vk::mapVkFormat(colorFormat);
-               const VkMappedMemoryRange                       range                   =
-               {
-                       VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,  // sType
-                       DE_NULL,                                                                // pNext
-                       readImageBufferMemory->getMemory(),             // memory
-                       0,                                                                              // offset
-                       imageSizeBytes,                                                 // size
-               };
                const tcu::ConstPixelBufferAccess       resultAccess    (tcuFormat, renderSize.x(), renderSize.y(), 1, readImageBufferMemory->getHostPtr());
 
-               VK_CHECK(vk.invalidateMappedMemoryRanges(vkDevice, 1u, &range));
+               invalidateAlloc(vk, vkDevice, *readImageBufferMemory);
 
                {
                        tcu::TextureLevel       refImage                (tcuFormat, renderSize.x(), renderSize.y());
index 19d706b..c89f876 100644 (file)
@@ -1039,7 +1039,7 @@ tcu::TestStatus BufferAddressTestInstance::iterate (void)
                sbtBuffer = de::MovePtr<BufferWithMemory>(new BufferWithMemory(
                        vk, device, allocator, makeBufferCreateInfo(DE_NULL, rayTracingProperties.shaderGroupHandleSize, VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_RAY_TRACING_BIT_NV, 0), MemoryRequirement::HostVisible));
                deUint32 *ptr = (deUint32 *)sbtBuffer->getAllocation().getHostPtr();
-               invalidateMappedMemoryRange(vk, device, sbtBuffer->getAllocation().getMemory(), sbtBuffer->getAllocation().getOffset(), rayTracingProperties.shaderGroupHandleSize);
+               invalidateAlloc(vk, device, sbtBuffer->getAllocation());
 
                vk.getRayTracingShaderGroupHandlesNV(device, *pipeline, 0, 1, rayTracingProperties.shaderGroupHandleSize, ptr);
        }
@@ -1311,7 +1311,7 @@ tcu::TestStatus BufferAddressTestInstance::iterate (void)
        submitCommandsAndWait(vk, device, queue, cmdBuffer.get());
 
        deUint32 *ptr = (deUint32 *)copyBuffer->getAllocation().getHostPtr();
-       invalidateMappedMemoryRange(vk, device, copyBuffer->getAllocation().getMemory(), copyBuffer->getAllocation().getOffset(), DIM*DIM*sizeof(deUint32));
+       invalidateAlloc(vk, device, copyBuffer->getAllocation());
 
        qpTestResult res = QP_TEST_RESULT_PASS;
 
index e9c250b..e1cfa09 100644 (file)
@@ -617,7 +617,7 @@ void BufferDescriptor::init (Context&               context,
                        }
                }
 
-               flushMappedMemoryRange(vk, device, m_buffer->getAllocation().getMemory(), m_buffer->getAllocation().getOffset(), VK_WHOLE_SIZE);
+               flushAlloc(vk, device, m_buffer->getAllocation());
        }
 }
 
@@ -646,9 +646,9 @@ VkWriteDescriptorSet BufferDescriptor::getDescriptorWrite (void)
 void BufferDescriptor::invalidate (Context& context)
 {
        const DeviceInterface&  vk              = context.getDeviceInterface();
-    const VkDevice                     device  = context.getDevice();
+       const VkDevice                  device  = context.getDevice();
 
-       invalidateMappedMemoryRange(vk, device, m_buffer->getAllocation().getMemory(), m_buffer->getAllocation().getOffset(), m_bufferSize);
+       invalidateAlloc(vk, device, m_buffer->getAllocation());
 }
 
 // Returns the buffer data as a vector
@@ -1307,7 +1307,7 @@ void SamplerDescriptor::init (Context&            context,
        DE_UNREF(pipelineType);
 
        const DeviceInterface&  vk              = context.getDeviceInterface();
-    const VkDevice                     device  = context.getDevice();
+       const VkDevice                  device  = context.getDevice();
        const VkFormat                  format  = VK_FORMAT_R32_SFLOAT;
 
        // Create samplers
@@ -1532,12 +1532,12 @@ tcu::TestStatus DescriptorCommands::run (Context& context)
 {
        const InstanceInterface&                                vki                                     = context.getInstanceInterface();
        const DeviceInterface&                                  vk                                      = context.getDeviceInterface();
-    const VkDevice                                                     device                          = context.getDevice();
+       const VkDevice                                                  device                          = context.getDevice();
        const VkQueue                                                   queue                           = context.getUniversalQueue();
        const VkPhysicalDevice                                  physicalDevice          = context.getPhysicalDevice();
        const VkPhysicalDeviceLimits                    limits                          = getPhysicalDeviceProperties(vki, physicalDevice).limits;
        const deUint32                                                  queueFamilyIndex        = context.getUniversalQueueFamilyIndex();
-    Allocator&                                                         allocator                       = context.getDefaultAllocator();
+       Allocator&                                                              allocator                       = context.getDefaultAllocator();
        tcu::TestLog&                                                   log                                     = context.getTestContext().getLog();
        const Unique<VkCommandPool>                             commandPool                     (createCommandPool(vk, device, VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, queueFamilyIndex));
        const Unique<VkCommandBuffer>                   commandBuffer           (allocateCommandBuffer(vk, device, *commandPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY));
index 5f91777..f30cd04 100644 (file)
@@ -1218,7 +1218,7 @@ tcu::TestStatus DescriptorSetRandomTestInstance::iterate (void)
        }
 
        // Flush modified memory.
-       flushMappedMemoryRange(vk, device, buffer->getAllocation().getMemory(), buffer->getAllocation().getOffset(), VK_WHOLE_SIZE);
+       flushAlloc(vk, device, buffer->getAllocation());
 
        // Push constants are used for dynamic indexing. PushConstant[i] = i.
        const VkPushConstantRange                       pushConstRange                  =
@@ -1643,7 +1643,7 @@ tcu::TestStatus DescriptorSetRandomTestInstance::iterate (void)
                        vk, device, allocator, makeBufferCreateInfo(rayTracingProperties.shaderGroupHandleSize, VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_RAY_TRACING_BIT_NV), MemoryRequirement::HostVisible));
 
                deUint32 *ptr = (deUint32 *)sbtBuffer->getAllocation().getHostPtr();
-               invalidateMappedMemoryRange(vk, device, sbtBuffer->getAllocation().getMemory(), sbtBuffer->getAllocation().getOffset(), rayTracingProperties.shaderGroupHandleSize);
+               invalidateAlloc(vk, device, sbtBuffer->getAllocation());
 
                vk.getRayTracingShaderGroupHandlesNV(device, *pipeline, 0, 1, rayTracingProperties.shaderGroupHandleSize, ptr);
        }
@@ -1957,7 +1957,7 @@ tcu::TestStatus DescriptorSetRandomTestInstance::iterate (void)
        submitCommandsAndWait(vk, device, queue, cmdBuffer.get());
 
        deUint32 *ptr = (deUint32 *)copyBuffer->getAllocation().getHostPtr();
-       invalidateMappedMemoryRange(vk, device, copyBuffer->getAllocation().getMemory(), copyBuffer->getAllocation().getOffset(), DIM*DIM*sizeof(deUint32));
+       invalidateAlloc(vk, device, copyBuffer->getAllocation());
 
        qpTestResult res = QP_TEST_RESULT_PASS;
 
index 00709c8..9aa0c14 100644 (file)
@@ -290,8 +290,7 @@ struct PixelBufferAccessBuffer : public UpdatablePixelBufferAccess
        void fillColor (const tcu::Vec4&) const { }
        void invalidate (void) const
        {
-               const VkDeviceSize              bufferSize = calcTexSize(getFormat(), getWidth(), getHeight(), getDepth());
-               vk::invalidateMappedMemoryRange(m_interface, m_device, (*m_allocation)->getMemory(), (*m_allocation)->getOffset(), bufferSize);
+               invalidateAlloc(m_interface, m_device, **m_allocation);
        }
 };
 
index ca7b675..30fb531 100644 (file)
@@ -587,7 +587,7 @@ VkDeviceSize createBufferAndBind    (ut::BufferHandleAllocSp&       output,
 {
        const size_t                            nonCoherentAtomSize     (static_cast<size_t>(ctx.getDeviceProperties().limits.nonCoherentAtomSize));
        const VkDeviceSize                      roundedSize                     (deAlignSize(static_cast<size_t>(desiredSize), nonCoherentAtomSize));
-       Allocator&                  allocator                   (ctx.getDefaultAllocator());
+       Allocator&                                      allocator                       (ctx.getDefaultAllocator());
        VkDevice                                        device                          (ctx.getDevice());
        const DeviceInterface&          interface                       (ctx.getDeviceInterface());
 
index 375ed88..7093662 100644 (file)
@@ -599,7 +599,7 @@ tcu::TestStatus DiscardRectanglesTestInstance::iterate      (void)
        // Verify results
        {
                const Allocation alloc = m_colorBuffer->getBoundMemory();
-               invalidateMappedMemoryRange(vk, device, alloc.getMemory(), 0ull, colorBufferSize);
+               invalidateAlloc(vk, device, alloc);
 
                const tcu::ConstPixelBufferAccess       resultImage             (mapVkFormat(colorFormat), m_renderSize.x(), m_renderSize.y(), 1u, alloc.getHostPtr());
                const tcu::TextureLevel                         referenceImage  = generateReferenceImage(mapVkFormat(colorFormat), m_renderSize, m_params.testMode, m_clearColor,
index ee87595..9c051aa 100644 (file)
@@ -756,7 +756,7 @@ tcu::TestStatus testVertexShader (Context& context, const int numLayers)
        // Verify layers.
        {
                const Allocation alloc = colorBuffer->getBoundMemory();
-               invalidateMappedMemoryRange(vk, device, alloc.getMemory(), 0ull, colorBufferSize);
+               invalidateAlloc(vk, device, alloc);
 
                deUint8* resultMem = reinterpret_cast<deUint8*>(alloc.getHostPtr());
                for (int i = 0; i < numLayers; i++)
@@ -816,7 +816,7 @@ tcu::TestStatus testTessellationShader (Context& context, const int numLayers)
        // Verify layers.
        {
                const Allocation alloc = colorBuffer->getBoundMemory();
-               invalidateMappedMemoryRange(vk, device, alloc.getMemory(), 0ull, colorBufferSize);
+               invalidateAlloc(vk, device, alloc);
 
                deUint8* resultMem = reinterpret_cast<deUint8*>(alloc.getHostPtr());
                for (int i = 0; i < numLayers; i++) {
index 47f9605..a508a07 100644 (file)
@@ -825,7 +825,7 @@ tcu::TestStatus testVertexFragmentShader (Context& context, const int numViewpor
        // Log image
        {
                const Allocation alloc = colorBuffer->getBoundMemory();
-               invalidateMappedMemoryRange(vk, device, alloc.getMemory(), 0ull, colorBufferSize);
+               invalidateAlloc(vk, device, alloc);
 
                const tcu::ConstPixelBufferAccess       resultImage             (mapVkFormat(colorFormat), renderSize.x(), renderSize.y(), 1u, alloc.getHostPtr());
                const tcu::TextureLevel                         referenceImage  = generateReferenceImage(mapVkFormat(colorFormat), renderSize, clearColor, cells, colors);
@@ -886,7 +886,7 @@ tcu::TestStatus testTessellationShader (Context& context, const int numViewports
        // Log image
        {
                const Allocation alloc = colorBuffer->getBoundMemory();
-               invalidateMappedMemoryRange(vk, device, alloc.getMemory(), 0ull, colorBufferSize);
+               invalidateAlloc(vk, device, alloc);
 
                const tcu::ConstPixelBufferAccess       resultImage             (mapVkFormat(colorFormat), renderSize.x(), renderSize.y(), 1u, alloc.getHostPtr());
                const tcu::TextureLevel                         referenceImage  = generateReferenceImage(mapVkFormat(colorFormat), renderSize, clearColor, cells, colors);
index c4444ad..24cb4b3 100644 (file)
@@ -175,7 +175,7 @@ tcu::TestStatus GeometryExpanderRenderTestInstance::iterate (void)
        {
                // Log the result image.
                const Allocation& colorBufferAlloc = colorBuffer.getAllocation();
-               invalidateMappedMemoryRange(vk, device, colorBufferAlloc.getMemory(), colorBufferAlloc.getOffset(), colorBufferSizeBytes);
+               invalidateAlloc(vk, device, colorBufferAlloc);
                const tcu::ConstPixelBufferAccess imagePixelAccess(mapVkFormat(colorFormat), resolution.x(), resolution.y(), 1, colorBufferAlloc.getHostPtr());
 
                if (!compareWithFileImage(m_context, imagePixelAccess, m_name))
index 736378f..eb9f36d 100644 (file)
@@ -1273,7 +1273,7 @@ tcu::TestStatus test (Context& context, const TestParams params)
        endCommandBuffer(vk, *cmdBuffer);
        submitCommandsAndWait(vk, device, queue, *cmdBuffer);
 
-       invalidateMappedMemoryRange(vk, device, colorBufferAlloc->getMemory(), colorBufferAlloc->getOffset(), colorBufferSize);
+       invalidateAlloc(vk, device, *colorBufferAlloc);
 
        if (!verifyResults(context.getTestContext().getLog(), params, colorFormat, colorBufferAlloc->getHostPtr()))
                return tcu::TestStatus::fail("Rendered images are incorrect");
@@ -1538,9 +1538,9 @@ tcu::TestStatus testLayeredReadBack (Context& context, const TestParams params)
        endCommandBuffer(vk, *cmdBuffer);
        submitCommandsAndWait(vk, device, queue, *cmdBuffer);
 
-       invalidateMappedMemoryRange(vk, device, colorBufferAlloc->getMemory(), colorBufferAlloc->getOffset(), colorBufferSize);
-       invalidateMappedMemoryRange(vk, device, depthBufferAlloc->getMemory(), depthBufferAlloc->getOffset(), depthBufferSize);
-       invalidateMappedMemoryRange(vk, device, stencilBufferAlloc->getMemory(), stencilBufferAlloc->getOffset(), stencilBufferSize);
+       invalidateAlloc(vk, device, *colorBufferAlloc);
+       invalidateAlloc(vk, device, *depthBufferAlloc);
+       invalidateAlloc(vk, device, *stencilBufferAlloc);
 
        if (!verifyResults(context.getTestContext().getLog(), params, colorFormat, colorBufferAlloc->getHostPtr()))
                result += " Color";
@@ -1792,7 +1792,7 @@ tcu::TestStatus testSecondaryCmdBuffer (Context& context, const TestParams param
        endCommandBuffer(vk, *cmdBuffer);
        submitCommandsAndWait(vk, device, queue, *cmdBuffer);
 
-       invalidateMappedMemoryRange(vk, device, colorBufferAlloc->getMemory(), colorBufferAlloc->getOffset(), colorBufferSize);
+       invalidateAlloc(vk, device, *colorBufferAlloc);
 
        if (!verifyResults(context.getTestContext().getLog(), params, colorFormat, colorBufferAlloc->getHostPtr()))
                return tcu::TestStatus::fail("Rendered images are incorrect");
index 9968e0e..ae0e02c 100644 (file)
@@ -410,7 +410,7 @@ tcu::TestStatus     MemoryQualifierInstanceBase::iterate (void)
 
        // Retrieve data from buffer to host memory
        const Allocation& allocation = m_buffer->getAllocation();
-       invalidateMappedMemoryRange(deviceInterface, device, allocation.getMemory(), allocation.getOffset(), bufferSizeInBytes);
+       invalidateAlloc(deviceInterface, device, allocation);
 
        const tcu::UVec3 computeGridSize = getShaderGridSize(m_imageType, m_imageSize);
        tcu::ConstPixelBufferAccess resultPixelBuffer(m_format, computeGridSize.x(), computeGridSize.y(), computeGridSize.z(), allocation.getHostPtr());
index 6b5341a..7e03cb2 100644 (file)
@@ -507,7 +507,7 @@ Move<VkBuffer>  ExternalMemoryHostRenderImageTestInstance::createBindMemoryIniti
        void* const                                                     mapPtr                                                  = m_vertexBufferAllocation->getHostPtr();
 
        deMemcpy(mapPtr, triangleData, sizeof(triangleData));
-       flushMappedMemoryRange(m_vkd, m_device, m_vertexBufferAllocation->getMemory(), m_vertexBufferAllocation->getOffset(), sizeof(triangleData));
+       flushAlloc(m_vkd, m_device, *m_vertexBufferAllocation);
 
        return buffer;
 }
index f02681d..4094d85 100644 (file)
@@ -1262,7 +1262,7 @@ public:
                const vk::DeviceInterface&      vkd             = context.getContext().getDeviceInterface();
                const vk::VkDevice                      device  = context.getContext().getDevice();
 
-               vk::invalidateMappedMemoryRange(vkd, device, m_memory, 0, m_size);
+               vk::invalidateMappedMemoryRange(vkd, device, m_memory, 0, VK_WHOLE_SIZE);
        }
 
 private:
@@ -1293,7 +1293,7 @@ public:
                const vk::DeviceInterface&      vkd             = context.getContext().getDeviceInterface();
                const vk::VkDevice                      device  = context.getContext().getDevice();
 
-               vk::flushMappedMemoryRange(vkd, device, m_memory, 0, m_size);
+               vk::flushMappedMemoryRange(vkd, device, m_memory, 0, VK_WHOLE_SIZE);
        }
 
 private:
@@ -2341,7 +2341,7 @@ void BufferCopyToBuffer::verify (VerifyContext& context, size_t commandIndex)
                void* const     ptr             = mapMemory(vkd, device, *m_memory, m_bufferSize);
                bool            isOk    = true;
 
-               vk::invalidateMappedMemoryRange(vkd, device, *m_memory, 0, m_bufferSize);
+               vk::invalidateMappedMemoryRange(vkd, device, *m_memory, 0, VK_WHOLE_SIZE);
 
                {
                        const deUint8* const data = (const deUint8*)ptr;
@@ -2421,7 +2421,7 @@ void BufferCopyFromBuffer::prepare (PrepareContext& context)
                                data[ndx] = rng.getUint8();
                }
 
-               vk::flushMappedMemoryRange(vkd, device, *m_memory, 0, m_bufferSize);
+               vk::flushMappedMemoryRange(vkd, device, *m_memory, 0, VK_WHOLE_SIZE);
                vkd.unmapMemory(device, *m_memory);
        }
 }
@@ -2668,7 +2668,7 @@ void BufferCopyToImage::verify (VerifyContext& context, size_t commandIndex)
        {
                void* const     ptr             = mapMemory(vkd, device, *memory, 4 * m_imageWidth * m_imageHeight);
 
-               vk::invalidateMappedMemoryRange(vkd, device, *memory, 0,  4 * m_imageWidth * m_imageHeight);
+               invalidateMappedMemoryRange(vkd, device, *memory, 0, VK_WHOLE_SIZE);
 
                {
                        const deUint8* const    data = (const deUint8*)ptr;
@@ -2847,7 +2847,7 @@ void BufferCopyFromImage::prepare (PrepareContext& context)
                                        data[ndx] = rng.getUint8();
                        }
 
-                       vk::flushMappedMemoryRange(vkd, device, *memory, 0, 4 * m_imageWidth * m_imageHeight);
+                       vk::flushMappedMemoryRange(vkd, device, *memory, 0, VK_WHOLE_SIZE);
                        vkd.unmapMemory(device, *memory);
                }
 
@@ -3008,7 +3008,7 @@ void ImageCopyToBuffer::verify (VerifyContext& context, size_t commandIndex)
                const ConstPixelBufferAccess    referenceImage  (context.getReferenceImage().getAccess());
                const ConstPixelBufferAccess    resultImage             (TextureFormat(TextureFormat::RGBA, TextureFormat::UNORM_INT8), m_imageWidth, m_imageHeight, 1, ptr);
 
-               vk::invalidateMappedMemoryRange(vkd, device, *m_memory, 0, m_bufferSize);
+               vk::invalidateMappedMemoryRange(vkd, device, *m_memory, 0, VK_WHOLE_SIZE);
 
                if (!tcu::intThresholdCompare(context.getLog(), (de::toString(commandIndex) + ":" + getName()).c_str(), (de::toString(commandIndex) + ":" + getName()).c_str(), referenceImage, resultImage, UVec4(0), tcu::COMPARE_LOG_ON_ERROR))
                        resultCollector.fail(de::toString(commandIndex) + ":" + getName() + " Image comparison failed");
@@ -3072,7 +3072,7 @@ void ImageCopyFromBuffer::prepare (PrepareContext& context)
                                data[ndx] = rng.getUint8();
                }
 
-               vk::flushMappedMemoryRange(vkd, device, *m_memory, 0, m_bufferSize);
+               vk::flushMappedMemoryRange(vkd, device, *m_memory, 0, VK_WHOLE_SIZE);
                vkd.unmapMemory(device, *m_memory);
        }
 }
@@ -3282,7 +3282,7 @@ void ImageCopyFromImage::prepare (PrepareContext& context)
                                        data[ndx] = rng.getUint8();
                        }
 
-                       vk::flushMappedMemoryRange(vkd, device, *memory, 0, 4 * m_imageWidth * m_imageHeight);
+                       vk::flushMappedMemoryRange(vkd, device, *memory, 0, VK_WHOLE_SIZE);
                        vkd.unmapMemory(device, *memory);
                }
 
@@ -3575,7 +3575,7 @@ void ImageCopyToImage::verify (VerifyContext& context, size_t commandIndex)
        {
                void* const     ptr             = mapMemory(vkd, device, *memory, 4 * m_imageWidth * m_imageHeight);
 
-               vk::invalidateMappedMemoryRange(vkd, device, *memory, 0,  4 * m_imageWidth * m_imageHeight);
+               vk::invalidateMappedMemoryRange(vkd, device, *memory, 0, VK_WHOLE_SIZE);
 
                {
                        const deUint8* const                    data            = (const deUint8*)ptr;
@@ -3764,7 +3764,7 @@ void ImageBlitFromImage::prepare (PrepareContext& context)
                                        data[ndx] = rng.getUint8();
                        }
 
-                       vk::flushMappedMemoryRange(vkd, device, *memory, 0, 4 * m_srcImageWidth * m_srcImageHeight);
+                       vk::flushMappedMemoryRange(vkd, device, *memory, 0, VK_WHOLE_SIZE);
                        vkd.unmapMemory(device, *memory);
                }
 
@@ -4119,7 +4119,7 @@ void ImageBlitToImage::verify (VerifyContext& context, size_t commandIndex)
        {
                void* const     ptr             = mapMemory(vkd, device, *memory, 4 * m_dstImageWidth * m_dstImageHeight);
 
-               vk::invalidateMappedMemoryRange(vkd, device, *memory, 0,  4 * m_dstImageWidth * m_dstImageHeight);
+               vk::invalidateMappedMemoryRange(vkd, device, *memory, 0, VK_WHOLE_SIZE);
 
                if (m_scale == BLIT_SCALE_10)
                {
@@ -4515,7 +4515,7 @@ void SubmitRenderPass::verify (VerifyContext& context, size_t commandIndex)
                {
                        void* const     ptr             = mapMemory(vkd, device, *memory, 4 * m_targetWidth * m_targetHeight);
 
-                       vk::invalidateMappedMemoryRange(vkd, device, *memory, 0,  4 * m_targetWidth * m_targetHeight);
+                       vk::invalidateMappedMemoryRange(vkd, device, *memory, 0, VK_WHOLE_SIZE);
 
                        {
                                const deUint8* const                    data            = (const deUint8*)ptr;
index fb1d586..74c6514 100644 (file)
@@ -1602,7 +1602,7 @@ tcu::TestStatus MemoryModelTestInstance::iterate (void)
        tcu::TestLog& log = m_context.getTestContext().getLog();
 
        deUint32 *ptr = (deUint32 *)copyBuffer->getAllocation().getHostPtr();
-       invalidateMappedMemoryRange(vk, device, copyBuffer->getAllocation().getMemory(), copyBuffer->getAllocation().getOffset(), bufferSizes[2]);
+       invalidateAlloc(vk, device, copyBuffer->getAllocation());
        qpTestResult res = QP_TEST_RESULT_PASS;
 
        deUint32 numErrors = 0;
index 09d3c86..e8e5a27 100644 (file)
@@ -582,7 +582,7 @@ void MultiViewRenderTestInstance::createVertexBuffer (void)
 
                VK_CHECK(m_device->bindBufferMemory(*m_logicalDevice, *m_vertexCoordBuffer, m_vertexCoordAlloc->getMemory(), m_vertexCoordAlloc->getOffset()));
                deMemcpy(m_vertexCoordAlloc->getHostPtr(), m_vertexCoord.data(), static_cast<size_t>(dataSize));
-               flushMappedMemoryRange(*m_device, *m_logicalDevice, m_vertexCoordAlloc->getMemory(), m_vertexCoordAlloc->getOffset(), static_cast<size_t>(bufferDataSize));
+               flushAlloc(*m_device, *m_logicalDevice, *m_vertexCoordAlloc);
        }
 
        // Upload vertex colors
@@ -596,7 +596,7 @@ void MultiViewRenderTestInstance::createVertexBuffer (void)
 
                VK_CHECK(m_device->bindBufferMemory(*m_logicalDevice, *m_vertexColorBuffer, m_vertexColorAlloc->getMemory(), m_vertexColorAlloc->getOffset()));
                deMemcpy(m_vertexColorAlloc->getHostPtr(), m_vertexColor.data(), static_cast<size_t>(dataSize));
-               flushMappedMemoryRange(*m_device, *m_logicalDevice, m_vertexColorAlloc->getMemory(), m_vertexColorAlloc->getOffset(), static_cast<size_t>(bufferDataSize));
+               flushAlloc(*m_device, *m_logicalDevice, *m_vertexColorAlloc);
        }
 
        // Upload vertex indices
@@ -614,7 +614,7 @@ void MultiViewRenderTestInstance::createVertexBuffer (void)
                // Init host buffer data
                VK_CHECK(m_device->bindBufferMemory(*m_logicalDevice, *m_vertexIndicesBuffer, m_vertexIndicesAllocation->getMemory(), m_vertexIndicesAllocation->getOffset()));
                deMemcpy(m_vertexIndicesAllocation->getHostPtr(), m_vertexIndices.data(), static_cast<size_t>(dataSize));
-               flushMappedMemoryRange(*m_device, *m_logicalDevice, m_vertexIndicesAllocation->getMemory(), m_vertexIndicesAllocation->getOffset(), static_cast<size_t>(bufferDataSize));
+               flushAlloc(*m_device, *m_logicalDevice, *m_vertexIndicesAllocation);
        }
        else
                DE_ASSERT(m_vertexIndices.empty());
@@ -1048,7 +1048,7 @@ void MultiViewRenderTestInstance::readImage (VkImage image, const tcu::PixelBuff
                VK_CHECK(m_device->bindBufferMemory(*m_logicalDevice, *buffer, bufferAlloc->getMemory(), bufferAlloc->getOffset()));
 
                deMemset(bufferAlloc->getHostPtr(), 0, static_cast<size_t>(pixelDataSize));
-               flushMappedMemoryRange(*m_device, *m_logicalDevice, bufferAlloc->getMemory(), bufferAlloc->getOffset(), pixelDataSize);
+               flushAlloc(*m_device, *m_logicalDevice, *bufferAlloc);
        }
 
        const VkBufferMemoryBarrier     bufferBarrier   =
@@ -1104,7 +1104,7 @@ void MultiViewRenderTestInstance::readImage (VkImage image, const tcu::PixelBuff
        submitCommandsAndWait(*m_device, *m_logicalDevice, m_queue, *m_cmdBuffer);
 
        // Read buffer data
-       invalidateMappedMemoryRange(*m_device, *m_logicalDevice, bufferAlloc->getMemory(), bufferAlloc->getOffset(), pixelDataSize);
+       invalidateAlloc(*m_device, *m_logicalDevice, *bufferAlloc);
        tcu::copy(dst, tcu::ConstPixelBufferAccess(dst.getFormat(), dst.getSize(), bufferAlloc->getHostPtr()));
 }
 
@@ -1668,7 +1668,7 @@ void MultiViewAttachmentsTestInstance::setImageData (VkImage image)
 
        // Write buffer data
        deMemcpy(bufferAlloc->getHostPtr(), data->getLevel(0).getDataPtr(), bufferSize);
-       flushMappedMemoryRange(*m_device, *m_logicalDevice, bufferAlloc->getMemory(), bufferAlloc->getOffset(), bufferSize);
+       flushAlloc(*m_device, *m_logicalDevice, *bufferAlloc);
 
        beginCommandBuffer(*m_device, *m_cmdBuffer);
 
@@ -1915,7 +1915,7 @@ void MultiViewDrawIndirectTestInstance::draw (const deUint32 subpassCount, VkRen
 
                deMemcpy(allocationBuffer->getHostPtr(), drawCommandsDataPtr, static_cast<size_t>(dataSize));
 
-               flushMappedMemoryRange(*m_device, *m_logicalDevice, allocationBuffer->getMemory(), allocationBuffer->getOffset(), static_cast<size_t>(bufferDataSize));
+               flushAlloc(*m_device, *m_logicalDevice, *allocationBuffer);
                indirectBuffers[subpassNdx] = (BufferSP(new Unique<VkBuffer>(indirectBuffer)));
                indirectAllocations[subpassNdx] = (AllocationSP(new UniquePtr<Allocation>(allocationBuffer)));
        }
@@ -2990,7 +2990,7 @@ void MultiViewDepthStencilTestInstance::readImage (VkImage image, const tcu::Pix
                VK_CHECK(m_device->bindBufferMemory(*m_logicalDevice, *buffer, bufferAlloc->getMemory(), bufferAlloc->getOffset()));
 
                deMemset(bufferAlloc->getHostPtr(), 0xCC, static_cast<size_t>(pixelDataSize));
-               flushMappedMemoryRange(*m_device, *m_logicalDevice, bufferAlloc->getMemory(), bufferAlloc->getOffset(), pixelDataSize);
+               flushAlloc(*m_device, *m_logicalDevice, *bufferAlloc);
        }
 
        const VkBufferMemoryBarrier     bufferBarrier   =
@@ -3038,7 +3038,7 @@ void MultiViewDepthStencilTestInstance::readImage (VkImage image, const tcu::Pix
        submitCommandsAndWait(*m_device, *m_logicalDevice, m_queue, *m_cmdBuffer);
 
        // Read buffer data
-       invalidateMappedMemoryRange(*m_device, *m_logicalDevice, bufferAlloc->getMemory(), bufferAlloc->getOffset(), pixelDataSize);
+       invalidateAlloc(*m_device, *m_logicalDevice, *bufferAlloc);
 
        if (m_depthTest)
        {
index e3eaf4a..d9aaddc 100644 (file)
@@ -196,7 +196,7 @@ bool BufferValidator<T>::validateBuffer (ProtectedContext&          ctx,
        // Set the reference uniform data
        {
                deMemcpy(refUniform->getAllocation().getHostPtr(), getReferenceDataSrc(), refDataSize);
-               vk::flushMappedMemoryRange(vk, device, refUniform->getAllocation().getMemory(), refUniform->getAllocation().getOffset(), refDataSize);
+               flushAlloc(vk, device, refUniform->getAllocation());
        }
 
        const deUint32                                                  helperBufferSize        = (deUint32)(2 * sizeof(deUint32));
index aa4dc56..20107fd 100644 (file)
@@ -148,7 +148,7 @@ bool ImageValidator::validateImage (ProtectedContext& ctx, const ValidationData&
        // Set the reference uniform data
        {
                deMemcpy(refUniform->getAllocation().getHostPtr(), &refData, refUniformSize);
-               vk::flushMappedMemoryRange(vk, device, refUniform->getAllocation().getMemory(), refUniform->getAllocation().getOffset(), refUniformSize);
+               flushAlloc(vk, device, refUniform->getAllocation());
        }
 
        const deUint32                                                  helperBufferSize        = (deUint32)(2 * sizeof(deUint32));
index efb4cbf..66dd671 100644 (file)
@@ -989,7 +989,7 @@ tcu::TestStatus ImageAccessTestInstance::executeFragmentTest (void)
 
                deMemcpy(vertexBuffer->getAllocation().getHostPtr(), positions, positionDataSize);
                deMemcpy(reinterpret_cast<deUint8*>(vertexBuffer->getAllocation().getHostPtr()) +  positionDataSize, texCoord.data(), textureCoordDataSize);
-               vk::flushMappedMemoryRange(vk, device, vertexBuffer->getAllocation().getMemory(), vertexBuffer->getAllocation().getOffset(), vertexBufferSize);
+               vk::flushAlloc(vk, device, vertexBuffer->getAllocation());
        }
 
        // Create pipeline
index 6d1980e..2466a3d 100644 (file)
@@ -377,7 +377,7 @@ tcu::TestStatus StorageBufferTestInstance<T>::executeFragmentTest(void)
        // Set the test input uniform data
        {
                deMemcpy(testUniform->getAllocation().getHostPtr(), &m_testInput, testUniformSize);
-               vk::flushMappedMemoryRange(vk, device, testUniform->getAllocation().getMemory(), testUniform->getAllocation().getOffset(), testUniformSize);
+               vk::flushAlloc(vk, device, testUniform->getAllocation());
        }
        const deUint32                                                  testBufferSize          = sizeof(ValidationDataStorage<T>);
        de::MovePtr<vk::BufferWithMemory>               testBuffer                      (makeBuffer(ctx,
@@ -564,7 +564,7 @@ tcu::TestStatus StorageBufferTestInstance<T>::executeComputeTest(void)
        // Set the test input uniform data
        {
                deMemcpy(testUniform->getAllocation().getHostPtr(), &m_testInput, testUniformSize);
-               vk::flushMappedMemoryRange(vk, device, testUniform->getAllocation().getMemory(), testUniform->getAllocation().getOffset(), testUniformSize);
+               vk::flushAlloc(vk, device, testUniform->getAllocation());
        }
 
        const deUint32                                                  testBufferSize          = sizeof(ValidationDataStorage<T>);
index a484925..7ee8499 100644 (file)
@@ -706,7 +706,7 @@ void uploadImage (ProtectedContext& ctx, vk::VkImage image, const tcu::Texture2D
 
                tcu::copy(destAccess, access);
 
-               vk::flushMappedMemoryRange(vk, device, stagingBuffer->getAllocation().getMemory(), stagingBuffer->getAllocation().getOffset(), stagingBufferSize);
+               flushAlloc(vk, device, stagingBuffer->getAllocation());
        }
 
        const vk::VkImageSubresourceRange       subresourceRange        =
index ded17db..50a416c 100644 (file)
@@ -1025,7 +1025,7 @@ TriangleRenderer::TriangleRenderer (ProtectedContext&                             context,
                DE_STATIC_ASSERT(sizeof(vertices) == sizeof(float)*4*3);
 
                deMemcpy(m_vertexBuffer->getAllocation().getHostPtr(), &vertices[0], sizeof(vertices));
-               vk::flushMappedMemoryRange(m_vkd, context.getDevice(), m_vertexBuffer->getAllocation().getMemory(), m_vertexBuffer->getAllocation().getOffset(), sizeof(vertices));
+               flushAlloc(m_vkd, context.getDevice(), m_vertexBuffer->getAllocation());
        }
 }
 
index f5d4bbe..0be46b0 100644 (file)
@@ -357,7 +357,7 @@ void uploadYCbCrImage (ProtectedContext&                                    ctx,
                bufferBarriers.push_back(bufferBarrier);
 
                deMemcpy(buffer->getAllocation().getHostPtr(), imageData.getPlanePtr(planeNdx), imageData.getPlaneSize(planeNdx));
-               flushMappedMemoryRange(vk, device, buffer->getAllocation().getMemory(), buffer->getAllocation().getOffset(), (deUint32)imageData.getPlaneSize(planeNdx));
+               flushAlloc(vk, device, buffer->getAllocation());
                stagingBuffers.push_back(de::SharedPtr<de::MovePtr<vk::BufferWithMemory> >(new de::MovePtr<vk::BufferWithMemory>(buffer.release())));
        }
 
@@ -526,7 +526,7 @@ bool validateImage (ProtectedContext&                                                       ctx,
        // Set the reference uniform data
        {
                deMemcpy(refUniform->getAllocation().getHostPtr(), &refData[0], refUniformSize);
-               vk::flushMappedMemoryRange(vk, device, refUniform->getAllocation().getMemory(), refUniform->getAllocation().getOffset(), refUniformSize);
+               flushAlloc(vk, device, refUniform->getAllocation());
        }
 
        const deUint32                                                          helperBufferSize        = (deUint32)(2 * sizeof(deUint32));
@@ -857,7 +857,7 @@ void renderYCbCrToColor (ProtectedContext&                                                  ctx,
        // Set the reference uniform data
        {
                deMemcpy(refUniform->getAllocation().getHostPtr(), &referenceData[0], refUniformSize);
-               vk::flushMappedMemoryRange(vk, device, refUniform->getAllocation().getMemory(), refUniform->getAllocation().getOffset(), refUniformSize);
+               flushAlloc(vk, device, refUniform->getAllocation());
        }
 
        // Update descriptor set
@@ -902,7 +902,7 @@ void renderYCbCrToColor (ProtectedContext&                                                  ctx,
                                                                  vk::MemoryRequirement::HostVisible);
 
                deMemcpy(vertexBuffer->getAllocation().getHostPtr(), &posCoords[0], bufferSize);
-               vk::flushMappedMemoryRange(vk, device, vertexBuffer->getAllocation().getMemory(), vertexBuffer->getAllocation().getOffset(), bufferSize);
+               flushAlloc(vk, device, vertexBuffer->getAllocation());
        }
 
        const vk::Unique<vk::VkPipeline>                pipeline                        (makeGraphicsPipeline(vk,
index a9b7312..7389651 100644 (file)
@@ -546,7 +546,7 @@ void GraphicQueryTestBase::initStateObjects(void)
                tcu::Vec4 *ptr = reinterpret_cast<tcu::Vec4*>(m_vertexBuffer->getBoundMemory().getHostPtr());
                deMemcpy(ptr, &vertices[0], kBufferSize);
 
-               flushMappedMemoryRange(vkd, device,     m_vertexBuffer->getBoundMemory().getMemory(), m_vertexBuffer->getBoundMemory().getOffset(), VK_WHOLE_SIZE);
+               flushAlloc(vkd, device, m_vertexBuffer->getBoundMemory());
        }
 }
 
@@ -946,7 +946,7 @@ void ComputeQueryTestBase::initStateObjects(void)
        const std::vector<deUint8>      data((size_t)bufferSize, 0u);
        const Allocation&                       allocation = m_buffer->getBoundMemory();
        void*                                           allocationData = allocation.getHostPtr();
-       invalidateMappedMemoryRange(vkd, device, allocation.getMemory(), allocation.getOffset(), bufferSize);
+       invalidateAlloc(vkd, device, allocation);
        deMemcpy(allocationData, &data[0], (size_t)bufferSize);
 
        const VkBufferMemoryBarrier barrier =
index da4cd0e..258f7d2 100644 (file)
@@ -321,7 +321,7 @@ void clearBuffer (const DeviceInterface& vk, const VkDevice device, const de::Sh
        const std::vector<deUint8>      data                    ((size_t)bufferSizeBytes, 0u);
        const Allocation&                       allocation              = buffer->getBoundMemory();
        void*                                           allocationData  = allocation.getHostPtr();
-       invalidateMappedMemoryRange(vk, device, allocation.getMemory(), allocation.getOffset(), bufferSizeBytes);
+       invalidateAlloc(vk, device, allocation);
        deMemcpy(allocationData, &data[0], (size_t)bufferSizeBytes);
 }
 
@@ -552,7 +552,7 @@ tcu::TestStatus ComputeInvocationsTestInstance::executeTest (const VkCommandPool
 
                // Validate the results
                const Allocation& bufferAllocation = buffer->getBoundMemory();
-               invalidateMappedMemoryRange(vk, device, bufferAllocation.getMemory(), bufferAllocation.getOffset(), bufferSizeBytes);
+               invalidateAlloc(vk, device, bufferAllocation);
 
                if (m_parameters[0].resetType == RESET_TYPE_NORMAL)
                {
@@ -608,7 +608,6 @@ protected:
                                                                                                                                         const de::SharedPtr<Buffer>    buffer,
                                                                                                                                         const VkDeviceSize                             bufferSizeBytes);
        virtual tcu::TestStatus checkResult                                                             (const de::SharedPtr<Buffer>    buffer,
-                                                                                                                                        const VkDeviceSize                             bufferSizeBytes,
                                                                                                                                         const VkQueryPool                              queryPool);
 };
 
@@ -728,10 +727,10 @@ tcu::TestStatus ComputeInvocationsSecondaryTestInstance::executeTest (const VkCo
 
        // Wait for completion
        submitCommandsAndWait(vk, device, queue, *primaryCmdBuffer);
-       return checkResult(buffer, bufferSizeBytes, *queryPool);
+       return checkResult(buffer, *queryPool);
 }
 
-tcu::TestStatus ComputeInvocationsSecondaryTestInstance::checkResult (const de::SharedPtr<Buffer> buffer, const VkDeviceSize bufferSizeBytes, const VkQueryPool queryPool)
+tcu::TestStatus ComputeInvocationsSecondaryTestInstance::checkResult (const de::SharedPtr<Buffer> buffer, const VkQueryPool queryPool)
 {
        const DeviceInterface&  vk                                      = m_context.getDeviceInterface();
        const VkDevice                  device                          = m_context.getDevice();
@@ -778,7 +777,7 @@ tcu::TestStatus ComputeInvocationsSecondaryTestInstance::checkResult (const de::
        {
                // Validate the results
                const Allocation&       bufferAllocation        = buffer->getBoundMemory();
-               invalidateMappedMemoryRange(vk, device, bufferAllocation.getMemory(), bufferAllocation.getOffset(), bufferSizeBytes);
+               invalidateAlloc(vk, device, bufferAllocation);
                const deUint32*         bufferPtr                       = static_cast<deUint32*>(bufferAllocation.getHostPtr());
                deUint32                        minSize                         = ~0u;
                for(size_t parametersNdx = 0; parametersNdx < m_parameters.size(); ++parametersNdx)
@@ -936,7 +935,7 @@ tcu::TestStatus ComputeInvocationsSecondaryInheritedTestInstance::executeTest (c
 
        // Wait for completion
        submitCommandsAndWait(vk, device, queue, *primaryCmdBuffer);
-       return checkResult(buffer, bufferSizeBytes, *queryPool);
+       return checkResult(buffer, *queryPool);
 }
 
 class GraphicBasicTestInstance : public StatisticQueryTestInstance
index 587f7fd..8e4f147 100755 (executable)
@@ -285,7 +285,7 @@ tcu::TestStatus BufferSparseResidencyInstance::iterate (void)
 
                deMemcpy(inputBufferAlloc->getHostPtr(), &referenceData[0], m_bufferSize);
 
-               flushMappedMemoryRange(deviceInterface, getDevice(), inputBufferAlloc->getMemory(), inputBufferAlloc->getOffset(), m_bufferSize);
+               flushAlloc(deviceInterface, getDevice(), *inputBufferAlloc);
 
                // Create output buffer
                const VkBufferCreateInfo                outputBufferCreateInfo  = makeBufferCreateInfo(m_bufferSize, VK_BUFFER_USAGE_TRANSFER_DST_BIT);
index 6e18155..ba2975c 100644 (file)
@@ -3472,20 +3472,11 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
 
                                // Copy data to memory.
                                {
-                                       const VkMappedMemoryRange               range                                   =
-                                       {
-                                               VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,                          //      VkStructureType sType;
-                                               DE_NULL,                                                                                        //      const void*             pNext;
-                                               resourceMemory->getMemory(),                                            //      VkDeviceMemory  mem;
-                                               0,                                                                                                      //      VkDeviceSize    offset;
-                                               VK_WHOLE_SIZE,                                                                          //      VkDeviceSize    size;
-                                       };
-
                                        vector<deUint8>                                 resourceBytes;
                                        resource.getBytes(resourceBytes);
 
                                        deMemcpy(resourceMemory->getHostPtr(), &resourceBytes.front(), resourceBytes.size());
-                                       VK_CHECK(vk.flushMappedMemoryRanges(device, 1u, &range));
+                                       flushAlloc(vk, device, *resourceMemory);
                                }
 
                                inResourceMemories.push_back(AllocationSp(resourceMemory.release()));
@@ -3501,20 +3492,11 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
 
                                // Copy data to memory.
                                {
-                                       const VkMappedMemoryRange               range                                   =
-                                       {
-                                               VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,                          //      VkStructureType sType;
-                                               DE_NULL,                                                                                        //      const void*             pNext;
-                                               resourceMemory->getMemory(),                                            //      VkDeviceMemory  mem;
-                                               0,                                                                                                      //      VkDeviceSize    offset;
-                                               VK_WHOLE_SIZE,                                                                          //      VkDeviceSize    size;
-                                       };
-
                                        vector<deUint8>                                 resourceBytes;
                                        resource.getBytes(resourceBytes);
 
                                        deMemcpy(resourceMemory->getHostPtr(), &resourceBytes.front(), resourceBytes.size());
-                                       VK_CHECK(vk.flushMappedMemoryRanges(device, 1u, &range));
+                                       flushAlloc(vk, device, *resourceMemory);
                                }
 
                                Move<VkImage>                                   resourceImage                   = createImageForResource(vk, device, resource, instance.resources.inputFormat, queueFamilyIndex);
@@ -3560,18 +3542,9 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
                        VK_CHECK(vk.bindBufferMemory(device, *resourceBuffer, resourceMemory->getMemory(), resourceMemory->getOffset()));
 
                        // Fill memory with all ones.
-                       const VkMappedMemoryRange               range                                   =
-                       {
-                               VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,                          //      VkStructureType sType;
-                               DE_NULL,                                                                                        //      const void*             pNext;
-                               resourceMemory->getMemory(),                                            //      VkDeviceMemory  mem;
-                               0,                                                                                                      //      VkDeviceSize    offset;
-                               VK_WHOLE_SIZE,                                                                          //      VkDeviceSize    size;
-                       };
-
                        resource.getBytes(resourceBytes);
                        deMemset((deUint8*)resourceMemory->getHostPtr(), 0xff, resourceBytes.size());
-                       VK_CHECK(vk.flushMappedMemoryRanges(device, 1u, &range));
+                       flushAlloc(vk, device, *resourceMemory);
 
                        outResourceMemories.push_back(AllocationSp(resourceMemory.release()));
                        outResourceBuffers.push_back(BufferHandleSp(new BufferHandleUp(resourceBuffer)));
@@ -4399,16 +4372,7 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
 
                deMemcpy(vertexInputMemory->getHostPtr(), data.data(), data.size());
 
-               const VkMappedMemoryRange       range                   =
-               {
-                       VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,  //      VkStructureType sType;
-                       DE_NULL,                                                                //      const void*             pNext;
-                       vertexInputMemory->getMemory(),                 //      VkDeviceMemory  mem;
-                       0,                                                                              //      VkDeviceSize    offset;
-                       VK_WHOLE_SIZE,                                                  //      VkDeviceSize    size;
-               };
-
-               VK_CHECK(vk.flushMappedMemoryRanges(device, 1u, &range));
+               flushAlloc(vk, device, *vertexInputMemory);
        }
 
        // Submit & wait for completion
@@ -4422,35 +4386,11 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
        context.getTestContext().getLog() << TestLog::Image("Result", "Result", pixelBuffer);
 
        if (needInterface)
-       {
-               const VkDeviceSize                      fragOutputImgSize       = (VkDeviceSize)(instance.interfaces.getOutputType().getNumBytes() * renderSize.x() * renderSize.y());
-               const VkMappedMemoryRange       range                           =
-               {
-                       VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,  //      VkStructureType sType;
-                       DE_NULL,                                                                //      const void*             pNext;
-                       fragOutputMemory->getMemory(),                  //      VkDeviceMemory  mem;
-                       0,                                                                              //      VkDeviceSize    offset;
-                       fragOutputImgSize,                                              //      VkDeviceSize    size;
-               };
-
-               VK_CHECK(vk.invalidateMappedMemoryRanges(device, 1u, &range));
-       }
-
-       { // Make sure all output resources are ready.
-               for (deUint32 outputNdx = 0; outputNdx < numOutResources; ++outputNdx)
-               {
-                       const VkMappedMemoryRange       range   =
-                       {
-                               VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,                  //      VkStructureType sType;
-                               DE_NULL,                                                                                //      const void*             pNext;
-                               outResourceMemories[outputNdx]->getMemory(),    //      VkDeviceMemory  mem;
-                               0,                                                                                              //      VkDeviceSize    offset;
-                               VK_WHOLE_SIZE,                                                                  //      VkDeviceSize    size;
-                       };
+               invalidateAlloc(vk, device, *fragOutputMemory);
 
-                       VK_CHECK(vk.invalidateMappedMemoryRanges(device, 1u, &range));
-               }
-       }
+       // Make sure all output resources are ready.
+       for (deUint32 outputNdx = 0; outputNdx < numOutResources; ++outputNdx)
+               invalidateAlloc(vk, device, *outResourceMemories[outputNdx]);
 
        const RGBA threshold(1, 1, 1, 1);
 
index 0137112..702230f 100644 (file)
@@ -2527,7 +2527,7 @@ tcu::TestStatus SSBOLayoutCaseInstance::iterate (void)
                const int refCount = 1;
                int resCount = 0;
 
-               invalidateMappedMemoryRange(vk, device, acBufferAlloc->getMemory(), acBufferAlloc->getOffset(), acBufferSize);
+               invalidateAlloc(vk, device, *acBufferAlloc);
 
                resCount = *((const int*)acBufferAlloc->getHostPtr());
 
@@ -2541,7 +2541,7 @@ tcu::TestStatus SSBOLayoutCaseInstance::iterate (void)
        for (size_t allocNdx = 0; allocNdx < m_uniformAllocs.size(); allocNdx++)
        {
                vk::Allocation *alloc = m_uniformAllocs[allocNdx].get();
-               invalidateMappedMemoryRange(vk, device, alloc->getMemory(), alloc->getOffset(), VK_WHOLE_SIZE);
+               invalidateAlloc(vk, device, *alloc);
        }
 
        // Validate result
index 4ab6328..9d96bcc 100644 (file)
@@ -515,7 +515,7 @@ void TransformFeedbackTestInstance::verifyTransformFeedbackBuffer (const MovePtr
        const DeviceInterface&  vk                      = m_context.getDeviceInterface();
        const VkDevice                  device          = m_context.getDevice();
 
-       invalidateMappedMemoryRange(vk, device, bufAlloc->getMemory(), bufAlloc->getOffset(), VK_WHOLE_SIZE);
+       invalidateAlloc(vk, device, *bufAlloc);
 
        const deUint32                  numPoints       = static_cast<deUint32>(bufBytes / sizeof(deUint32));
        const deUint32*                 tfData          = (deUint32*)bufAlloc->getHostPtr();
@@ -926,7 +926,7 @@ void TransformFeedbackWindingOrderTestInstance::verifyTransformFeedbackBuffer(co
        const DeviceInterface&  vk              = m_context.getDeviceInterface();
        const VkDevice                  device  = m_context.getDevice();
 
-       invalidateMappedMemoryRange(vk, device, bufAlloc->getMemory(), bufAlloc->getOffset(), VK_WHOLE_SIZE);
+       invalidateAlloc(vk, device, *bufAlloc);
 
        const deUint32  numPoints                       = static_cast<deUint32>(bufBytes / sizeof(deUint32));
        const deUint32  vertexPerPrimitive      = m_tParameters.vertexPerPrimitive;
@@ -1008,7 +1008,7 @@ void TransformFeedbackBuiltinTestInstance::verifyTransformFeedbackBuffer (const
        const DeviceInterface&  vk                      = m_context.getDeviceInterface();
        const VkDevice                  device          = m_context.getDevice();
 
-       invalidateMappedMemoryRange(vk, device, bufAlloc->getMemory(), bufAlloc->getOffset(), VK_WHOLE_SIZE);
+       invalidateAlloc(vk, device, *bufAlloc);
 
        const deUint32                  numPoints       = static_cast<deUint32>(bufBytes / sizeof(float));
        const deUint8*                  tfDataBytes     = (deUint8*)bufAlloc->getHostPtr();
@@ -1154,7 +1154,7 @@ void TransformFeedbackMultistreamTestInstance::verifyTransformFeedbackBuffer (co
        const DeviceInterface&  vk                      = m_context.getDeviceInterface();
        const VkDevice                  device          = m_context.getDevice();
 
-       invalidateMappedMemoryRange(vk, device, bufAlloc->getMemory(), bufAlloc->getOffset(), bufBytes);
+       invalidateAlloc(vk, device, *bufAlloc);
 
        const deUint32                  numPoints       = static_cast<deUint32>(bufBytes / sizeof(deUint32));
        const float*                    tfData          = (float*)bufAlloc->getHostPtr();
index 1cc85d2..3aa0571 100644 (file)
@@ -1624,7 +1624,7 @@ TestStatus ShaderCaseInstance::iterate (void)
        {
                const ConstPixelBufferAccess    imgAccess       (TextureFormat(TextureFormat::RGBA, TextureFormat::UNORM_INT8), RENDER_WIDTH, RENDER_HEIGHT, 1, m_readImageMem[0]->getHostPtr());
 
-               invalidateMappedMemoryRange(vkd, device, m_readImageMem[0]->getMemory(), m_readImageMem[0]->getOffset(), (vk::VkDeviceSize)(RENDER_WIDTH*RENDER_HEIGHT*4));
+               invalidateAlloc(vkd, device, *m_readImageMem[0]);
 
                if (!checkResultImage(imgAccess))
                {
@@ -1658,7 +1658,7 @@ TestStatus ShaderCaseInstance::iterate (void)
                                        DE_FATAL("Unknown data type");
                        }
 
-                       invalidateMappedMemoryRange(vkd, device, m_readImageMem[outNdx]->getMemory(), m_readImageMem[outNdx]->getOffset(), (vk::VkDeviceSize)(RENDER_WIDTH * RENDER_HEIGHT * tcu::getPixelSize(vk::mapVkFormat(m_rtFormat))));
+                       invalidateAlloc(vkd, device, *m_readImageMem[outNdx]);
 
                        if (!checkResultImageWithReference(imgAccess, reference))
                        {