@@ -306,7 +306,7 @@ vkGetImageMemoryRequirements(device, stagingImage, &memRequirements);
306306VkMemoryAllocateInfo allocInfo = {};
307307allocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
308308allocInfo.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
311311if (vkAllocateMemory(device, &allocInfo, nullptr, &textureImageMemory) != VK_SUCCESS) {
312312 throw std::runtime_error("failed to allocate image memory!");
@@ -318,9 +318,7 @@ vkBindImageMemory(device, stagingImage, textureImageMemory, 0);
318318Allocating memory for an image works in exactly the same way as allocating
319319memory 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
325323This function is already getting quite large and there'll be a need to create
326324more images in later chapters, so we should abstract image creation into a
@@ -721,4 +719,4 @@ the graphics pipeline. We'll work on that in the next chapter.
721719
722720[ C++ code] ( /code/texture_image.cpp ) /
723721[ Vertex shader] ( /code/shader_ubo.vert ) /
724- [ Fragment shader] ( /code/shader_ubo.frag )
722+ [ Fragment shader] ( /code/shader_ubo.frag )
0 commit comments