From ad26540e4f6166aee1fa626f91194a9f464a8d17 Mon Sep 17 00:00:00 2001 From: saschawillems Date: Fri, 28 Oct 2016 19:57:59 +0200 Subject: [PATCH] Method to copy data to mapped buffer --- base/vulkanbuffer.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/base/vulkanbuffer.hpp b/base/vulkanbuffer.hpp index 7148b9be..f255828a 100644 --- a/base/vulkanbuffer.hpp +++ b/base/vulkanbuffer.hpp @@ -89,6 +89,19 @@ namespace vk descriptor.range = size; } + /** + * Copies the specified data to the mapped buffer + * + * @param data Pointer to the data to copy + * @param size Size of the data to copy in machine units + * + */ + void copyTo(void* data, VkDeviceSize size) + { + assert(mapped); + memcpy(mapped, data, size); + } + /** * Flush a memory range of the buffer to make it visible to the device *