Or to put it another way, the user can execute some number of work groups. There is the concept of a work group this is the smallest amount of compute operations that the user can execute. The space that compute shaders operate within is abstract.
Similarly, if a compute shader is to actually compute anything, it must explicitly write to an image or shader storage block. Therefore, if a compute shader wants to take some values as input, it is up to the shader itself to fetch that data, via texture access, arbitrary image load, shader storage blocks, or other forms of interface. The built-in inputs only define where in the "space" of execution a particular compute shader invocation is.
Most important of all, compute shaders have no user-defined inputs and no outputs at all. The number of compute shader executions is defined by the function used to execute the compute operation. The "space" that a compute shader operates on is largely abstract it is up to each compute shader to decide what the space means. Fragment shader execution is defined by the fragments generated from the rasterization process.Ĭompute shaders work very differently. The frequency at which a shader stage executes is specified by the nature of that stage vertex shaders execute once per input vertex, for example (though some executions can be skipped via caching). All of the other shader stages have a well-defined set of input values, some built-in and some user-defined. Compute shaders operate differently from other shader stages.