m_vertices[quadNdx * 6 + vertexNdx].position.z() = DepthTest::quadDepths[quadNdx];
// Load vertices into vertex buffer
-
- const VkMappedMemoryRange flushRange =
- {
- VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, // VkStructureType sType;
- DE_NULL, // const void* pNext;
- m_vertexBufferAlloc->getMemory(), // VkDeviceMemory mem;
- m_vertexBufferAlloc->getOffset(), // VkDeviceSize offset;
- vertexBufferParams.size // VkDeviceSize size;
- };
-
- void* bufferPtr;
- VK_CHECK(vk.mapMemory(vkDevice, m_vertexBufferAlloc->getMemory(), m_vertexBufferAlloc->getOffset(), vertexBufferParams.size, 0, &bufferPtr));
- deMemcpy(bufferPtr, m_vertices.data(), m_vertices.size() * sizeof(Vertex4RGBA));
- vk.flushMappedMemoryRanges(vkDevice, 1, &flushRange);
- VK_CHECK(vk.unmapMemory(vkDevice, m_vertexBufferAlloc->getMemory()));
+ deMemcpy(m_vertexBufferAlloc->getHostPtr(), m_vertices.data(), m_vertices.size() * sizeof(Vertex4RGBA));
+ flushMappedMemoryRange(vk, vkDevice, m_vertexBufferAlloc->getMemory(), m_vertexBufferAlloc->getOffset(), vertexBufferParams.size);
}
// Create command pool
VK_CHECK(vk.queueSubmit(queue, 1, &cmdBuffer.get(), *fence));
VK_CHECK(vk.waitForFences(device, 1, &fence.get(), 0, ~(0ull) /* infinity */));
-
- // Map and read buffer data
-
- const VkMappedMemoryRange memoryRange =
- {
- VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, // VkStructureType sType;
- DE_NULL, // const void* pNext;
- bufferAlloc->getMemory(), // VkDeviceMemory mem;
- bufferAlloc->getOffset(), // VkDeviceSize offset;
- pixelDataSize // VkDeviceSize size;
- };
-
- void* bufferPtr;
- VK_CHECK(vk.mapMemory(device, bufferAlloc->getMemory(), bufferAlloc->getOffset(), pixelDataSize, 0, &bufferPtr));
- VK_CHECK(vk.invalidateMappedMemoryRanges(device, 1, &memoryRange));
- tcu::copy(*resultLevel, tcu::ConstPixelBufferAccess(resultLevel->getFormat(), resultLevel->getSize(), bufferPtr));
- VK_CHECK(vk.unmapMemory(device, bufferAlloc->getMemory()));
+ // Read buffer data
+ invalidateMappedMemoryRange(vk, device, bufferAlloc->getMemory(), bufferAlloc->getOffset(), pixelDataSize);
+ tcu::copy(*resultLevel, tcu::ConstPixelBufferAccess(resultLevel->getFormat(), resultLevel->getSize(), bufferAlloc->getHostPtr()));
return resultLevel;
}