From d184cf64c5bd05792007a8213fe51f1ce096eee5 Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Wed, 20 Nov 2024 17:39:41 +0100 Subject: [PATCH] Use correct size for index data copy Fixes #1167 --- examples/trianglevulkan13/trianglevulkan13.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/trianglevulkan13/trianglevulkan13.cpp b/examples/trianglevulkan13/trianglevulkan13.cpp index 1cfa6bbd..a6c9eb17 100644 --- a/examples/trianglevulkan13/trianglevulkan13.cpp +++ b/examples/trianglevulkan13/trianglevulkan13.cpp @@ -246,7 +246,7 @@ public: uint8_t* data{ nullptr }; VK_CHECK_RESULT(vkMapMemory(device, stagingBuffer.memory, 0, memAlloc.allocationSize, 0, (void**)&data)); memcpy(data, vertices.data(), vertexBufferSize); - memcpy(((char*)data) + vertexBufferSize, indices.data(), vertexBufferSize); + memcpy(((char*)data) + vertexBufferSize, indices.data(), indexBufferSize); // Create a device local buffer to which the (host local) vertex data will be copied and which will be used for rendering VkBufferCreateInfo vertexbufferCI{ VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };