MCPcopy Create free account
hub / github.com/Overv/VulkanTutorial / copyBufferToImage

Method copyBufferToImage

code/30_multisampling.cpp:1115–1136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1113 }
1114
1115 void copyBufferToImage(VkBuffer buffer, VkImage image, uint32_t width, uint32_t height) {
1116 VkCommandBuffer commandBuffer = beginSingleTimeCommands();
1117
1118 VkBufferImageCopy region{};
1119 region.bufferOffset = 0;
1120 region.bufferRowLength = 0;
1121 region.bufferImageHeight = 0;
1122 region.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
1123 region.imageSubresource.mipLevel = 0;
1124 region.imageSubresource.baseArrayLayer = 0;
1125 region.imageSubresource.layerCount = 1;
1126 region.imageOffset = {0, 0, 0};
1127 region.imageExtent = {
1128 width,
1129 height,
1130 1
1131 };
1132
1133 vkCmdCopyBufferToImage(commandBuffer, buffer, image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &region);
1134
1135 endSingleTimeCommands(commandBuffer);
1136 }
1137
1138 void loadModel() {
1139 tinyobj::attrib_t attrib;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected