Celeb Glow
updates | March 07, 2026

What exactly are compute shaders? [closed]

What are compute shaders?

Refined Question:

I need to be able to write a shader knowing whether it will be processed GPU side or if I need to do it CPU side. For instance I would like to create tiles of floats (post-render) but pre-render they are stored as 8bit ints.

Would a compute shader allow me to do this? Or do I not understand it correctly..

Previous Question:

I've watched a few videos that discuss the various types of shaders and they mentioned compute shaders but I was left with more questions than answers and am finding myself in need of knowing if they are capable of: Specifically computing data without rendering it? Or are they meant to take data, compute and and then render it?

Also can a compute shader be a multi-use shader where it computers specific data (floats) and then renders the data out?

I am trying to write an occlusion system where I tile it like in a octets/potree/trees/ (grids of powers of 2). and I would prefer to keep the data small in say 8 bit or 16bit information and have the compute shader compute it on the fly (however it is a billion or more points- does this make sense to do if even possible?).

1 Answer

What are compute shaders?

Shaders are really just programs that are compiled to run on a GPU.
Or another way of putting it is that GPUs are special CPUs that are designed to run "Shaders".

A shader takes inputs (from the GPU memory) and computes outputs (to the GPU memory). For example, a vertex shader takes the vertices of a 3D model and runs a program to manipulate each vertex of the model into a new vertex.

Rendering 3D scenes is not the only way to utilize a GPU for its processing power though. When you run "Compute Shaders" you are doing essentially the same thing as any other rendering shader would do:

  1. Upload some data. (i.e. Textures, meshes, a data set)
  2. Run a program to process the data.
  3. Get the output of the program.*

* Rendering shaders don't need their output copied back to the system memory, the outputs just keep going through the pipeline until it goes to the display.

Also can a compute shader be a multi-use shader where it computers specific data (floats) and then renders the data out?

When using a GPU Compute API such as CUDA or OpenCL, you are generally copying the output of your program back to system memory so that you can do something with the results of your computation.
However, those results are usually already sitting in the GPU memory in a contiguous block. This is pretty much the same thing as a texture in GPU memory, so it absolutely possible to use the output of your compute shader as a "Texture" for a fragment shader and render those results to the screen too.