Graphics Reference
In-Depth Information
Other properties that are desirable, but not required, are
• Functions should be evaluated within the interior of a primitive
(interpolated, not extrapolated).
• Functions for
dFdx
should be evaluated while holding
y
constant.
Functions for
dFdy
should be evaluated while holding
x
constant.
However, mixed higher-order derivatives, like
dFdx
(
dFdy
(
y
)) and
dFdy
(
dFdx
(
x
)), are undefined.
• Derivatives of constant arguments should be 0.
In some implementations, varying degrees of derivative accuracy
can be obtained by providing hints using
glHint
(GL_FRAGMENT_SHADER_DERIVATIVE_HINT)
, allowing a user to make an
image quality versus speed trade-off.
Table B-10 describes the fragment processing functions.
Table B-10
Fragment Processing Functions
Syntax
Description
genType
dFdx
(genType
p
)
Returns the derivative in
x
using local differencing
for the input argument
p
.
genType
dFdy
(genType
p
)
Returns the derivative in
y
using local differencing
for the input argument
p
.
genType
fwidth
(genType
p
)
Returns the sum of the absolute derivative in
x
and
y
using local differencing for the input argument
p
;
i.e.,
result =
abs
(
dFdx
(
p
)) +
abs
(
dFdy
(
p
)).