Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 98867e3

Browse files
authored
Merge pull request #49 from AdenFlorian/patch-4
Fixing memory allocation properties for textureImageMemory
2 parents 3c3b417 + 9bdd7db commit 98867e3

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

06_Texture_mapping/00_Images.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ vkGetImageMemoryRequirements(device, textureImage, &memRequirements);
306306
VkMemoryAllocateInfo allocInfo = {};
307307
allocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
308308
allocInfo.allocationSize = memRequirements.size;
309-
allocInfo.memoryTypeIndex = findMemoryType(memRequirements.memoryTypeBits, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT);
309+
allocInfo.memoryTypeIndex = findMemoryType(memRequirements.memoryTypeBits, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
310310

311311
if (vkAllocateMemory(device, &allocInfo, nullptr, &textureImageMemory) != VK_SUCCESS) {
312312
throw std::runtime_error("failed to allocate image memory!");
@@ -318,9 +318,7 @@ vkBindImageMemory(device, textureImage, textureImageMemory, 0);
318318
Allocating memory for an image works in exactly the same way as allocating
319319
memory for a buffer. Use `vkGetImageMemoryRequirements` instead of
320320
`vkGetBufferMemoryRequirements`, and use `vkBindImageMemory` instead of
321-
`vkBindBufferMemory`. Remember that we need the memory to be host visible to be
322-
able to use `vkMapMemory`, so you should specify that property when looking for
323-
the right memory type.
321+
`vkBindBufferMemory`.
324322
325323
This function is already getting quite large and there'll be a need to create
326324
more images in later chapters, so we should abstract image creation into a

0 commit comments

Comments
 (0)