Skip to main content
← GPUs Lesson 5 / 6

Give Each Worker a Rule

Writing down a million colors is slow. Instead, hand every worker the same rule and let each one work out its own color from where it sits — its (x, y) seat.

Pick the rule

120
The rule
brightness = 1 − distance to center
…and every pixel also gets blue = 120.

No pixel was told its color — the rule plus its seat decided it. (Real shaders do more, but "one rule per pixel" is the heart of it.)

Every worker runs the rule at once

Three workers, same rule, different seats

(x=0, y=0)
(x=5, y=5)
(x=11, y=11)

One short rule paints every pixel — each worker just plugs in its own (x, y). That's how a GPU colors a million dots from a tiny program.