What it does
A Compute Shader performs parallel calculations on the GPU outside the ordinary surface-drawing stages. It can process data such as particles or images. Dispatch launches groups of threads to perform that work.
How to use it
Configure inputs, kernel, numthreads and dispatch-group count. Groups are not individual elements, so guard thread IDs against the data bounds.
A concrete example
For one thousand elements processed in groups of sixty-four, sixteen groups create up to 1024 invocations. IDs at or above one thousand must not access the array.
How to check it
- Validate known small inputs before scaling up.
Match element count, type and bounds - Include API/format support, synchronization, CPU readback and buffer lifetime in correctness and performance checks.
Match element count, type and bounds
Limitations
Inspect API support, thread sizes, synchronization, and bounds; GPU execution is not always faster.