Compute pipeline - graphics pipeline interop basic concepts 101

I want to compute data to fill a buffer (using compute shaders (CS)) which will be rendered afterwards by standard graphics pipeline (vertex (VS), fragment shaders (FS)).

How should the buffer be created/allocated on host and how referenced in the CS/VS shaders,
in order to pass first to CS to fill, then later referenced by VS in draw call?

Will it remain in GPU memory the whole time (for both CS dispatch and VS draw steps) and retain its values? Want to avoid passing data back to Host between steps if possible.

For writing to the buffer, the options are a buffer variable backed by a shader storage buffer object (SSBO) or image load/store (this can operate on a buffer by first attaching the buffer to a buffer texture with glTexBuffer or glTextureBuffer).

The same options are available for reading from the buffer, as well as accessing it as a texture, or a uniform variable backed by a uniform buffer object (UBO).

SSBOs are the most flexible option, and should be available in any version which supports compute shaders. SSBOs and compute shaders were both added to core in 4.3, so the only situation where you might have compute shaders but not SSBOs is if you’re using a lower version with ARB_compute_shader extension.

Data which is written by a shader and read by a shader will typically remain in GPU memory.