Possible to read back vertex from GPU?

Started by
3 comments, last by Katie 8 years, 6 months ago

I know you can pass in textures that you will populate on the GPU and readback but is it possible at all to do the same with vertex data?

I'm wondering if there's a way to use GPU tesselation to feed in a mesh, tesselate it as i'd do to render it in a shader, and "read back" the tesselated vertices to avoid having to do this on the CPU side (this is not for real time rendering, i have a software need for heavily tesselated meshes and doing it myself on the CPU is a lot more work than using the GPU and will be much slower, my gut feeling is it's not possible but i thought i'd ask just in case!)

Advertisement

Tessellation happens before the Geometry Shader, so I'm pretty sure you can use the Stream-Out stage to write your tessellated mesh to a buffer and read that back to the CPU.

current project: Roa

Thanks this gives me a pointer to some place to start looking!

Steam out is the most compatible way. But on modern GPUs you can also use UAVs to store the output.

If you're doing this in OpenGL, the magic phrase to search for is "transform feedback". This is a reasonably simple way of having the primitive vertex data written to a buffer that you can then just map and read by the CPU.

I've never used it with tessellation (although I understand it should work fine) -- we used it for generating data to use in picking points out of a cloud. It's relatively easy to set up and conveniently takes the same inputs as a rendering pass.

This topic is closed to new replies.

Advertisement