r/GraphicsProgramming 5d ago

Question Any good compute shaders optimization guides?

Hi,

for the past 2-3 years I have developed a 3d sculpting app that is almost entirely compute shader based acting on a mesh (dynamic topology + brush actions). The mesh is essentially a vertex buffer (position color normal) and an index buffer (triangle indices). I do stuff like adjacency tables and topology changes and neighborhood / local brush operations.

I am using Unity with HLSL compute shaders.

I would like to know if there are guides you recommend regarding optimization (books or websites with code samples ideally but videos can be ok too)

I have successfully brought some optimizations in this final phase of development, with better compute buffer allocation management (lazy allocation on expand, trim when needed), reducing reads and write to UAVs, struct optimization, some experiment with cache friendly layouts, caching of some data between frames (that was the biggest win).

I would like to go deeper, but I lack a structured understanding to know where to look and what is worth digging in beyond better algorithms / caching from frame to frame.

Thank you in advance for your recs

8 Upvotes

4 comments sorted by

View all comments

5

u/Alarming-Ad4082 5d ago

Just buy any book about Cuda or parallel processing. What is true for CUDA optimisation is true for any compute shaders optimisation, especially as majority of GPU in the installed base are from Nvidia

Exemple of books:

Programming Massively Parallel Processors: A Hands-on Approach

CUDA programming by Shane Cook

1

u/etdeagle 4d ago

Makes sense thank you i will check it out