Get image memory requirements before allocating image memory (Fixes #172)
This commit is contained in:
parent
de22b91cd4
commit
767a5c4b30
1 changed files with 1 additions and 2 deletions
|
|
@ -206,12 +206,11 @@ public:
|
|||
imageInfo.usage = VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT;
|
||||
imageInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
|
||||
imageInfo.initialLayout = VK_IMAGE_LAYOUT_PREINITIALIZED;
|
||||
|
||||
VK_CHECK_RESULT(vkCreateImage(device, &imageInfo, nullptr, &image));
|
||||
|
||||
vkGetImageMemoryRequirements(device, image, &memReqs);
|
||||
allocInfo.allocationSize = STB_FONT_WIDTH * STB_NUM_CHARS;
|
||||
allocInfo.memoryTypeIndex = getMemoryType(memReqs.memoryTypeBits, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
|
||||
|
||||
VK_CHECK_RESULT(vkAllocateMemory(device, &allocInfo, nullptr, &imageMemory));
|
||||
VK_CHECK_RESULT(vkBindImageMemory(device, image, imageMemory, 0));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue