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

Method copyBufferToImage

code/29_mipmapping.cpp:1065–1086  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1063 }
1064
1065 void copyBufferToImage(VkBuffer buffer, VkImage image, uint32_t width, uint32_t height) {
1066 VkCommandBuffer commandBuffer = beginSingleTimeCommands();
1067
1068 VkBufferImageCopy region{};
1069 region.bufferOffset = 0;
1070 region.bufferRowLength = 0;
1071 region.bufferImageHeight = 0;
1072 region.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
1073 region.imageSubresource.mipLevel = 0;
1074 region.imageSubresource.baseArrayLayer = 0;
1075 region.imageSubresource.layerCount = 1;
1076 region.imageOffset = {0, 0, 0};
1077 region.imageExtent = {
1078 width,
1079 height,
1080 1
1081 };
1082
1083 vkCmdCopyBufferToImage(commandBuffer, buffer, image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &region);
1084
1085 endSingleTimeCommands(commandBuffer);
1086 }
1087
1088 void loadModel() {
1089 tinyobj::attrib_t attrib;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected