Graphics Reference
In-Depth Information
Fragment Processing Functions
Fragment processing functions are only available in fragment shaders.
Derivatives may be computationally expensive and/or numerically
unstable. Therefore, an OpenGL ES implementation may approximate
the true derivatives by using a fast but not entirely accurate derivative
computation. Derivatives are undefined within non-uniform control flow.
The expected behavior of a derivative is specified using forward-backward
differencing.
Forward differencing:
F ( x + dx ) - F ( x ) ~ dFdx ( x ) * dx
dFdx ~ ( F ( x + dx ) - F ( x ) )/ dx
Backward differencing:
F ( x - dx ) - F ( x ) ~ - dFdx ( x ) * dx
dFdx ~ ( F ( x ) - F ( x - dx ) )/ dx
With single-sample rasterization, dx <= 1.0 in the preceding equations. For
multisample rasterization, dx < 2.0 in the preceding equations.
dFdy is approximated similarly, with y replacing x.
An OpenGL ES implementation can use the preceding or other methods
to perform the calculation, subject to the following conditions:
• The method can use piecewise linear approximations. Such linear
approximations imply that higher-order derivatives, dFdx ( dFdx ( x ))
and above, are undefined.
• The method can assume that the function evaluated is continuous.
Therefore derivatives within the body of a non-uniform conditional
are undefined.
• The method can differ per fragment, subject to the constraint that the
method can vary by window coordinates, not screen coordinates. The
invariance requirement is relaxed for derivative calculations, because
the method can be a function of fragment location.
 
 
Search WWH ::




Custom Search