Shader structured buffers inquiry

I’ve been trying to move my project’s calculations from CPU to GPU and have been reading and experimenting about different buffers for transporting data between the two. I’m not sure I fully understand the concept so was wondering if anyone could tell me/point me in the right direction with this.

I’ve got several meshes (with vertices procedurally generated on CPU) that use the same material with the same shader. I also have some compute shaders that I would like the vertices of those meshes to pass through without having to pass the data through CPU (so I wanted to do material shader vertices → compute shader → back to material shader, so it would be all GPU).
I’ve been trying to set up structured buffers for this, but I only manage to get one of the meshes to work with this - I originally thought that each mesh has it’s own instantiated version of material and separate version of structured buffer that I defined in shader, is it not the case? If not, what would be a typical workflow in Unity for dealing with such things?

I know the question is a bit vague, but I want to learn a bit more about the theory instead of fixing my code per se, so if you have any links that would help me understand the pipeline it would be awesome.

EDIT: Eh, of course I find the problem right after I post the question. It wasn’t the case of Material not being instantiated, but ComputeShader. I had to instantiate it from prefab for each mesh. Anyway, links/some knowledge on the subject is still welcome.

Hey @Shrimpey , I don’t know if this is still something that you are looking for, but I was trying to do something similar on my own. Specifically, I was trying to change the vertices of meshes using compute shaders.

Recently I found out that the Mesh class got two new functions that are pertinent to this subject: GetVertexNativeBufferPtr and GetNativeIndexBufferPtr. These buffers store vertex and index data respectively.

I’m currently looking into a way to pass these buffers to a compute shader, will try and keep this answer updated.