Chapter 10. Using Compute Shaders

In this chapter, we will cover the following recipes:

  • Implementing a particle simulation with the compute shader
  • Using the compute shader for cloth simulation
  • Implementing an edge detection filter with the compute shader
  • Creating a fractal texture using the compute shader

Introduction

Compute shaders were introduced into OpenGL with Version 4.3. A compute shader is a shader stage that can be used for arbitrary computation. It provides the ability to leverage the GPU and its inherent parallelism for general computing tasks that might have previously been implemented in serial on the CPU. The compute shader is most useful for tasks that are not directly related to rendering, such as physical simulation.

Note

Although APIs ...

Get OpenGL – Build high performance graphics now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.