GPU shaders run massively in parallel — individual invocations cannot communicate with or observe each other within a pass
A critical architectural property of GPU shaders: vertex shaders may process hundreds or thousands of vertices simultaneously, and fragment shaders process similarly large pixel counts in parallel. Each invocation sees only its own inputs and outputs — it cannot read data written by another invocation in the same dispatch. This enables GPU performance but imposes a constraint: algorithms requiring in-place iterative mutation within a single pass are unsafe because one invocation may read a value already overwritten by another. Algorithms must be designed so each output depends only on read-only inputs from the current pass.
Examples
In a 32×32 grid, all 1024 compute shader invocations run simultaneously. A shader that reads from and writes to the same buffer in one dispatch can produce corrupt results because invocations racing each other will see inconsistent state.
Assessment
A developer writes a compute shader that reads from and writes to the same buffer in one pass. What bug will appear and why? Name the pattern that fixes it.