How can I render from a buffer that exists and was created on on the GPU?

How can I render from a buffer that exists and was created on on the GPU?

I'm looking for a unity API or function call to allow me to do the following ...
I wrote some really complex functions that are compute shaders. These compute shaders  manage a huge compute buffer containing voxel information. I then take portions of (or the entire) voxel buffer in another compute shader and produce a vertex buffer. All of this is done on the GPU with only compute shader calls from the CPU.
Now I want to render that vertex buffer but I must be looking in the wrong place because I can't find any information on how this is done within unity despite there being other examples on how to do this using raw DX or openGL approaches.
Can anyone point me in the right direction to determine how I can render using a specified shader a buffer already in graphics RAM (and ideally give it some textures too)? 


Answer 1:

Unity has 2 static functions on the graphics class to allow you to do this.
It does however avoid the CPU altogether (desired result)

void OnRenderImage()

Answer 2:

Sounds like you want to Render to a Texture.
After you do a render pass to that texture using your shaders, you can attach that texture to a quad and render it with the main camera.

Answer 3:

If you have vertex and triangle data in your buffer you can use :


to get back those infos in Vertex and triangle arrays, then with Graphics.GL library, rebuild a mesh and actualise the normals and assign any material you want.

Well only in the case that your buffer is Read Write enabled.


It’s not only Unity which prevents you to use data directly from the GPU Buffers by the CPU, it is the whole principle of Accelerated graphics. That said you should be able to read data in your compute shader Try to see on the side of registers, if you can specify a registeer for your buffer (which you can) you have probably a way of reading from this register in a classic shader?