vulkano icon indicating copy to clipboard operation
vulkano copied to clipboard

How to read from CpuBufferPool/CpuBufferPoolChunk

Open Lukazoid opened this issue 7 years ago • 2 comments

I am currently using a compute shader to write to a buffer, I was previously using a CpuAccessibleBuffer but from the documentation this may be removed from Vulkano in future so I am moving to using a CpuBufferPool.

I have a problem though, I cannot see any API methods which would allow me to read the data back out of the CpuBufferPoolChunk.

The documentation implies that reading from the CpuBufferPool on the CPU should be possible:

if a buffer is under constant access by the GPU but you need to read its content on the CPU from time to time, it may be a good idea to use a DeviceLocalBuffer as the main buffer and a CpuBufferPool for when you need to read it. Then whenever you need to read the main buffer, ask the GPU to copy from the device-local buffer to the CPU buffer pool, and read the CPU buffer pool instead.

Lukazoid avatar Oct 15 '17 19:10 Lukazoid

That's unfortunately not implemented yet, because it's not trivial.

tomaka avatar Oct 16 '17 06:10 tomaka

Hi, any update on this question? I'm learning rust and vulkan and am trying to do exactly what the doc suggests: copy a DeviceLocalBuffer to a CpuBufferPool and download this one to the CPU to check my data. But I'm not sure how to do it. All examples seem to be doing the opposite: allocate data in a CpuBufferPool by copying a cpu array and copy it to the device and use it there.

nabajour avatar Jul 14 '21 17:07 nabajour