Summary
In this chapter, we have learnt the basic concepts of compute shaders. As said, they are a complex topic, mainly because of the manual synchronization that must be done to ensure correct results and high performance. We only saw a humble mechanism for that: the glMemoryBarrier
function which blocks execution until certain operations have finished, but there are many others, even inside the shaders (atomic operations and counters, control barriers, and so on).
It's up to you to discover more about compute shader features such as shared memory access for the work items inside a work group or how to use buffers with complex data structures in conjunction with images to create amazing shaders. You can also learn how to perform pure mathematical functions such as Fast Fourier Transformations or LU/SVD decompositions to make mathematical algorithms two orders of magnitude faster than doing it simply in CPU.
To conclude this book, I would encourage you to start writing your own shaders, slowly...