@@ -221,7 +221,7 @@ imageInfo.usage = VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
221221
222222The ` usage ` field has the same semantics as the one during buffer creation. The
223223staging image is going to be copied to the final texture image, so it should be
224- set up as a transfer source.
224+ set up as a transfer source.
225225
226226``` c++
227227imageInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
@@ -266,7 +266,7 @@ allocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
266266allocInfo.allocationSize = memRequirements.size;
267267allocInfo.memoryTypeIndex = findMemoryType(memRequirements.memoryTypeBits, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT);
268268
269- if (vkAllocateMemory(device, &allocInfo, nullptr, & stagingImageMemory) != VK_SUCCESS) {
269+ if (vkAllocateMemory(device, &allocInfo, nullptr, stagingImageMemory.replace() ) != VK_SUCCESS) {
270270 throw std::runtime_error("failed to allocate image memory!");
271271}
272272
@@ -329,7 +329,7 @@ void createImage(uint32_t width, uint32_t height, VkFormat format, VkImageTiling
329329 allocInfo.allocationSize = memRequirements.size;
330330 allocInfo.memoryTypeIndex = findMemoryType(memRequirements.memoryTypeBits, properties);
331331
332- if (vkAllocateMemory(device, &allocInfo, nullptr, & imageMemory) != VK_SUCCESS) {
332+ if (vkAllocateMemory(device, &allocInfo, nullptr, imageMemory.replace() ) != VK_SUCCESS) {
333333 throw std::runtime_error("failed to allocate image memory!");
334334 }
335335
@@ -361,7 +361,7 @@ void createTextureImage() {
361361 vkMapMemory (device, stagingImageMemory, 0, imageSize, 0, &data);
362362 memcpy(data, pixels, (size_t) imageSize);
363363 vkUnmapMemory(device, stagingImageMemory);
364-
364+
365365 stbi_image_free (pixels);
366366}
367367```
@@ -687,4 +687,4 @@ if you need to update the data in an image often.
687687The image now contains the texture, but we still need a way to access it from
688688the graphics pipeline. We'll work on that in the next chapter.
689689
690- [ Full code listing] ( /code/texture_image.cpp )
690+ [ Full code listing] ( /code/texture_image.cpp )
0 commit comments