I wish to render an image with my vulkan program and save it to local path. What's a good way to do this or has anyone done it before? Thanks!
1 Answer
This is done in a very similar way of copying images to the gpu: (here some pseudo code:
Create dest image in mappable memory so it can be read back later.
Transition source image to transfer read access.
Transition the dest image to transfer write access.
vkCmdBlit src to dest
Transition dest image to a access memory read/general layout
Transition src image back to original access/layout (assuming it will be used again)
memory map the dest image for reading back to the cpu
copy dest image to cpu memory
clean up
Use VkImageMemoryBarrier(2) for the transitions.
I am sure there are some good samples on how to do this out there.
-
2$\begingroup$ E.g. github.com/SaschaWillems/Vulkan/blob/master/examples/… $\endgroup$ Jul 7, 2022 at 1:34