SpiecsEngine
 
Loading...
Searching...
No Matches

◆ CopyBufferToImage() [1/2]

void Spices::VulkanImage::CopyBufferToImage ( VkBuffer buffer,
VkImage image,
uint32_t width,
uint32_t height ) const

Copy the Buffer's data to this VkImage.

Parameters
[in]bufferThe buffer we want copy from.
[in]imageThe image we want copy to, usually this VkImage Object.
[in]widthThe image's width.
[in]heightThe image's height.

Instance a VkBufferImageCopy.

Use Custom Cmd.

Instance a VkBufferImageCopy.

Use Custom Cmd.

Definition at line 321 of file VulkanImage.cpp.

328 {
330
334 VkBufferImageCopy region{};
335 region.bufferOffset = 0;
336 region.bufferRowLength = 0;
337 region.bufferImageHeight = 0;
338
339 region.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
340 region.imageSubresource.mipLevel = 0;
341 region.imageSubresource.baseArrayLayer = 0;
342 region.imageSubresource.layerCount = m_Layers;
343
344 region.imageOffset = { 0, 0, 0 };
345 region.imageExtent = { width, height, 1 };
346
350 VulkanCommandBuffer::CustomGraphicCmd(m_VulkanState, [&](const VkCommandBuffer& commandBuffer) {
351 vkCmdCopyBufferToImage(
352 commandBuffer,
353 buffer,
354 image,
355 VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
356 1,
357 &region
358 );
359 });
360 }
#define SPICES_PROFILE_ZONE
static void CustomGraphicCmd(VulkanState &vulkanState, T func)
Create a new command buffer and record custom cmd, submit to graphic queue, execute it immediately.
uint32_t m_Layers
Image layer(texture cube: 6).
VulkanState & m_VulkanState
The global VulkanState Referenced from VulkanRenderBackend.

References Spices::VulkanObject::m_VulkanState.