blob: a656bc6f4da12ef9b2bcf6666d635296908c06a2 [file] [log] [blame]
Name Strings
John Kessenich
OpenGL Architecture Review Board
Benj Lipchak (benj.lipchak 'at'
Copyright (c) 2005-2013 The Khronos Group Inc. Copyright terms at
Specification Update Policy
Khronos-approved extension specifications are updated in response to
issues and bugs prioritized by the Khronos OpenGL ES Working Group. For
extensions which have been promoted to a core Specification, fixes will
first appear in the latest version of that core Specification, and will
eventually be backported to the extension document. This policy is
described in more detail at
Ratified by the Khronos BOP, March 20, 2008.
Date: July 18, 2007 Revision: 0.99
OpenGL ES Extension #45
OpenGL ES 2.0 is required.
The standard derivative built-in functions and semantics from OpenGL 2.0 are
optional for OpenGL ES 2.0. When this extension is available, these
built-in functions are also available, as is a hint controlling the
quality/performance trade off.
New Procedures and Functions
New Tokens
Accepted by the <target> parameter of Hint and by the <pname> parameter of
GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev:
New Keywords
New Built-in Functions
New Macro Definitions
#define GL_OES_standard_derivatives 1
Additions to Chapter 5 of the OpenGL ES 2.0 specification:
In section 5.2 (Hints), add the following to the list of supported hints:
Derivative accuracy for fragment processing built-in functions dFdx, dFdy
and fwidth.
Additions to Chapter 8 of the OpenGL ES Shading Language specification:
Replace section 8.8 (Fragment Processing Functions) with the following
Fragment processing functions are only available in fragment shaders.
The built-in derivative functions dFdx, dFdy, and fwidth are optional, and
must be enabled by
#extension GL_OES_standard_derivatives : enable
before being used.
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.
The expected behavior of a derivative is specified using forward/backward
Forward differencing:
F(x+dx) - F(x) is approximately equal to dFdx(x).dx 1a
dFdx(x) is approximately equal to F(x+dx) - F(x) 1b
Backward differencing:
F(x-dx) - F(x) is approximately equal to -dFdx(x).dx 2a
dFdx(x) is approximately equal to F(x) - F(x-dx) 2b
With single-sample rasterization, dx <= 1.0 in equations 1b and 2b. For
multi-sample rasterization, dx < 2.0 in equations 1b and 2b.
dFdy is approximated similarly, with y replacing x.
An OpenGL ES implementation may use the above or other methods to perform
the calculation, subject to the following conditions:
1. The method may use piecewise linear approximations. Such linear
approximations imply that higher order derivatives, dFdx(dFdx(x)) and
above, are undefined.
2. The method may assume that the function evaluated is continuous.
Therefore derivatives within the body of a non-uniform conditional are
3. The method may differ per fragment, subject to the constraint that the
method may vary by window coordinates, not screen coordinates. The
invariance requirement described in section 3.1 of the OpenGL ES 2.0
specification is relaxed for derivative calculations, because the method
may be a function of fragment location.
Other properties that are desirable, but not required, are:
4. Functions should be evaluated within the interior of a primitive
(interpolated, not extrapolated).
5. 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.
6. Derivatives of constant arguments should be 0.
In some implementations, varying degrees of derivative accuracy may be
obtained by providing GL hints (section 5.6 of the OpenGL ES 2.0
specification), allowing a user to make an image quality versus speed trade
GLSL ES functions
genType dFdx (genType p)
Returns the derivative in x using local differencing for the input argument
genType dFdy (genType p)
Returns the derivative in y using local differencing for the input argument
These two functions are commonly used to estimate the filter width used to
anti-alias procedural textures. We are assuming that the expression is
being evaluated in parallel on a SIMD array so that at any given point in
time the value of the function is known at the grid points represented by
the SIMD array. Local differencing between SIMD array elements can
therefore be used to derive dFdx, dFdy, etc.
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.:
abs (dFdx (p)) + abs (dFdy (p));
New State
Add to Table 6.27: Hints
Get Value Type Get Command Initial Value Description
--------- ---- ----------- ------------- -----------
HINT_OES derivative
accuracy hint
Revision History
7/07/2005 Created.
7/06/2006 Removed from main specification document.
7/18/2007 Updated to match desktop GLSL spec and added hint.