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

Method copyBufferToImage

code/25_sampler.cpp:873–894  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

871 }
872
873 void copyBufferToImage(VkBuffer buffer, VkImage image, uint32_t width, uint32_t height) {
874 VkCommandBuffer commandBuffer = beginSingleTimeCommands();
875
876 VkBufferImageCopy region{};
877 region.bufferOffset = 0;
878 region.bufferRowLength = 0;
879 region.bufferImageHeight = 0;
880 region.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
881 region.imageSubresource.mipLevel = 0;
882 region.imageSubresource.baseArrayLayer = 0;
883 region.imageSubresource.layerCount = 1;
884 region.imageOffset = {0, 0, 0};
885 region.imageExtent = {
886 width,
887 height,
888 1
889 };
890
891 vkCmdCopyBufferToImage(commandBuffer, buffer, image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &region);
892
893 endSingleTimeCommands(commandBuffer);
894 }
895
896 void createVertexBuffer() {
897 VkDeviceSize bufferSize = sizeof(vertices[0]) * vertices.size();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected