PipelineCache: track buffer allocation
authoriostrows <igor.ostrowski@intel.com>
Fri, 29 Apr 2016 11:38:52 +0000 (13:38 +0200)
committerPyry Haulos <phaulos@google.com>
Mon, 16 May 2016 22:07:34 +0000 (15:07 -0700)
Bug: 28676376

(cherry picked from commit 653704c5bc0f03512b0b43a84615b6a9138fa057)

Change-Id: Idf9c4a00928aa88c0f67cfc7db4c96c695689809

external/vulkancts/modules/vulkan/pipeline/vktPipelineCacheTests.cpp

index b4f9c3b..07338fa 100644 (file)
@@ -1180,6 +1180,7 @@ protected:
                        void            buildPipeline               (deUint32 ndx);
 protected:
        Move<VkBuffer>              m_inputBuf;
+       de::MovePtr<Allocation>     m_inputBufferAlloc;
        Move<VkShaderModule>        m_computeShaderModule;
 
        Move<VkBuffer>              m_outputBuf[PIPELINE_CACHE_NDX_COUNT];
@@ -1226,17 +1227,16 @@ void ComputeCacheTestInstance::buildBuffers (void)
 
        // Create buffer object, allocate storage, and generate input data
        const VkDeviceSize          size                = sizeof(tcu::Vec4) * 128u;
-       de::MovePtr<Allocation>     bufferAlloc;
-       m_inputBuf = createBufferAndBindMemory(m_context, size, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, &bufferAlloc);
+       m_inputBuf = createBufferAndBindMemory(m_context, size, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, &m_inputBufferAlloc);
 
        // Initialize input buffer
-       tcu::Vec4* pVec = reinterpret_cast<tcu::Vec4*>(bufferAlloc->getHostPtr());
+       tcu::Vec4* pVec = reinterpret_cast<tcu::Vec4*>(m_inputBufferAlloc->getHostPtr());
        for (deUint32 ndx = 0u; ndx < 128u; ndx++)
        {
                for (deUint32 component = 0u; component < 4u; component++)
                        pVec[ndx][component]= (float)(ndx * (component + 1u));
        }
-       flushMappedMemoryRange(vk, vkDevice, bufferAlloc->getMemory(), bufferAlloc->getOffset(), size);
+       flushMappedMemoryRange(vk, vkDevice, m_inputBufferAlloc->getMemory(), m_inputBufferAlloc->getOffset(), size);
 
        // Clear the output buffer
        for (deUint32 ndx = 0; ndx < PIPELINE_CACHE_NDX_COUNT; ndx++)