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

Method copyBufferToImage

code/24_texture_image.cpp:834–855  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

832 }
833
834 void copyBufferToImage(VkBuffer buffer, VkImage image, uint32_t width, uint32_t height) {
835 VkCommandBuffer commandBuffer = beginSingleTimeCommands();
836
837 VkBufferImageCopy region{};
838 region.bufferOffset = 0;
839 region.bufferRowLength = 0;
840 region.bufferImageHeight = 0;
841 region.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
842 region.imageSubresource.mipLevel = 0;
843 region.imageSubresource.baseArrayLayer = 0;
844 region.imageSubresource.layerCount = 1;
845 region.imageOffset = {0, 0, 0};
846 region.imageExtent = {
847 width,
848 height,
849 1
850 };
851
852 vkCmdCopyBufferToImage(commandBuffer, buffer, image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &region);
853
854 endSingleTimeCommands(commandBuffer);
855 }
856
857 void createVertexBuffer() {
858 VkDeviceSize bufferSize = sizeof(vertices[0]) * vertices.size();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected