Add missing flushes for basic draws
authorGary Sweet <gsweet@broadcom.com>
Thu, 16 Mar 2017 13:17:39 +0000 (13:17 +0000)
committerPyry Haulos <phaulos@google.com>
Thu, 16 Mar 2017 20:25:25 +0000 (16:25 -0400)
Buffers were being mapped and written, but not flushed
before use. This affected the basic draw tests when running
with a non-coherent heap.

Affects:

dEQP-VK.draw.basic_draw.*

Components: Vulkan

VK-GL-CTS issue: 210

Change-Id: Ib0f9b77a3b0cd4488b9dc4cee6ebd6de4840262c

external/vulkancts/modules/vulkan/draw/vktBasicDrawTests.cpp

index db93794..5b05662 100644 (file)
@@ -786,6 +786,8 @@ tcu::TestStatus DrawTestInstance<DrawIndexedParams>::iterate (void)
 
        deMemcpy(indexAlloc->getHostPtr(), &(m_data.indexes[0]), bufferSize);
 
+       vk::flushMappedMemoryRange(m_vk, vkDevice, indexAlloc->getMemory(), indexAlloc->getOffset(), bufferSize);
+
        m_vk.cmdBindIndexBuffer(*m_cmdBuffer, *indexBuffer, 0u, m_data.indexType);
        m_vk.cmdDrawIndexed(*m_cmdBuffer, m_data.params.indexCount, m_data.params.instanceCount, m_data.params.firstIndex, m_data.params.vertexOffset, m_data.params.firstInstance);
        m_vk.cmdEndRenderPass(*m_cmdBuffer);
@@ -911,6 +913,8 @@ tcu::TestStatus DrawTestInstance<DrawIndirectParams>::iterate (void)
                VK_CHECK(vk.bindBufferMemory(vkDevice, *indirectBuffer, indirectAlloc->getMemory(), indirectAlloc->getOffset()));
 
                deMemcpy(indirectAlloc->getHostPtr(), &(m_data.commands[0]), (size_t)indirectInfoSize);
+
+               vk::flushMappedMemoryRange(m_vk, vkDevice, indirectAlloc->getMemory(), indirectAlloc->getOffset(), indirectInfoSize);
        }
 
        // If multiDrawIndirect not supported execute single calls
@@ -1074,6 +1078,8 @@ tcu::TestStatus DrawTestInstance<DrawIndexedIndirectParams>::iterate (void)
                VK_CHECK(vk.bindBufferMemory(vkDevice, *indirectBuffer, indirectAlloc->getMemory(), indirectAlloc->getOffset()));
 
                deMemcpy(indirectAlloc->getHostPtr(), &(m_data.commands[0]), (size_t)indirectInfoSize);
+
+               vk::flushMappedMemoryRange(m_vk, vkDevice, indirectAlloc->getMemory(), indirectAlloc->getOffset(), indirectInfoSize);
        }
 
        const deUint32  bufferSize = (deUint32)(m_data.indexes.size() * sizeof(deUint32));
@@ -1101,6 +1107,8 @@ tcu::TestStatus DrawTestInstance<DrawIndexedIndirectParams>::iterate (void)
 
        deMemcpy(indexAlloc->getHostPtr(), &(m_data.indexes[0]), bufferSize);
 
+       vk::flushMappedMemoryRange(m_vk, vkDevice, indexAlloc->getMemory(), indexAlloc->getOffset(), bufferSize);
+
        m_vk.cmdBindIndexBuffer(*m_cmdBuffer, *indexBuffer, 0u, m_data.indexType);
 
        // If multiDrawIndirect not supported execute single calls