From 0060ae151f85730872287b21285cb9262b02bf82 Mon Sep 17 00:00:00 2001 From: Petros Bantolas Date: Tue, 17 May 2016 15:42:29 +0100 Subject: [PATCH] Fix textoverlay demo to use correct allocation size. textoverlay was previously using a custom allocationSize for the font texture. Changed that to use vkGetImageMemoryRequirements. --- textoverlay/textoverlay.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/textoverlay/textoverlay.cpp b/textoverlay/textoverlay.cpp index 8d9ddee2..6074b08c 100644 --- a/textoverlay/textoverlay.cpp +++ b/textoverlay/textoverlay.cpp @@ -219,7 +219,8 @@ public: VK_CHECK_RESULT(vkCreateImage(device, &imageInfo, nullptr, &image)); - allocInfo.allocationSize = STB_FONT_WIDTH * STB_NUM_CHARS; + vkGetImageMemoryRequirements(device, image, &memReqs); + allocInfo.allocationSize = memReqs.size; getMemoryType(memReqs.memoryTypeBits, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, &allocInfo.memoryTypeIndex); VK_CHECK_RESULT(vkAllocateMemory(device, &allocInfo, nullptr, &imageMemory));