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

Method copyBufferToImage

code/28_model_loading.cpp:971–992  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

969 }
970
971 void copyBufferToImage(VkBuffer buffer, VkImage image, uint32_t width, uint32_t height) {
972 VkCommandBuffer commandBuffer = beginSingleTimeCommands();
973
974 VkBufferImageCopy region{};
975 region.bufferOffset = 0;
976 region.bufferRowLength = 0;
977 region.bufferImageHeight = 0;
978 region.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
979 region.imageSubresource.mipLevel = 0;
980 region.imageSubresource.baseArrayLayer = 0;
981 region.imageSubresource.layerCount = 1;
982 region.imageOffset = {0, 0, 0};
983 region.imageExtent = {
984 width,
985 height,
986 1
987 };
988
989 vkCmdCopyBufferToImage(commandBuffer, buffer, image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &region);
990
991 endSingleTimeCommands(commandBuffer);
992 }
993
994 void loadModel() {
995 tinyobj::attrib_t attrib;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected