MCPcopy Create free account
hub / github.com/PacktPublishing/3D-Graphics-Rendering-Cookbook / copyBufferToVolume

Function copyBufferToVolume

shared/UtilsVulkan.cpp:1998–2019  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1996}
1997
1998void copyBufferToVolume(VulkanRenderDevice& vkDev, VkBuffer buffer, VkImage image, uint32_t width, uint32_t height, uint32_t depth)
1999{
2000 VkCommandBuffer commandBuffer = beginSingleTimeCommands(vkDev);
2001
2002 const VkBufferImageCopy region = {
2003 .bufferOffset = 0,
2004 .bufferRowLength = 0,
2005 .bufferImageHeight = 0,
2006 .imageSubresource = VkImageSubresourceLayers {
2007 .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
2008 .mipLevel = 0,
2009 .baseArrayLayer = 0,
2010 .layerCount = 1
2011 },
2012 .imageOffset = VkOffset3D {.x = 0, .y = 0, .z = 0 },
2013 .imageExtent = VkExtent3D {.width = width, .height = height, .depth = depth }
2014 };
2015
2016 vkCmdCopyBufferToImage(commandBuffer, buffer, image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &region);
2017
2018 endSingleTimeCommands(vkDev, commandBuffer);
2019}
2020
2021void copyImageToBuffer(VulkanRenderDevice& vkDev, VkImage image, VkBuffer buffer, uint32_t width, uint32_t height, uint32_t layerCount)
2022{

Callers 1

updateTextureVolumeFunction · 0.85

Calls 2

beginSingleTimeCommandsFunction · 0.85
endSingleTimeCommandsFunction · 0.85

Tested by

no test coverage detected