Graphics Reference
In-Depth Information
In the prototypes below, the “g” in the return type “gvec4” is used as a
placeholder for nothing; “i” or “u” making a return type of vec4, ivec4,
or uvec4. In these cases, the sampler argument type also starts with “g”,
indicating the same substitution done on the return type; it is either a
floating-point, signed integer, or unsigned integer sampler, matching the
basic type of the return type, as described above.
For shadow forms (the sampler parameter is a shadow type), a depth
comparison lookup on the depth texture bound to
sampler
is done
as described in section 3.8.16, “Texture Comparison Modes,” of the
OpenGL ES Graphics System Specification. See the table below for which
component specifies
Dref
. The texture bound to
sampler
must be a depth
texture, or results are undefined. If a non-shadow texture call is made
to a sampler that represents a depth texture with depth comparisons
turned on, then results are undefined. If a shadow texture call is made
to a sampler that represents a depth texture with depth comparisons
turned off, then results are undefined. If a shadow texture call is made
to a sampler that does not represent a depth texture, then results are
undefined.
In all functions below, the
bias
parameter is optional for fragment shaders.
The
bias
parameter is not accepted in a vertex shader. For a fragment
shader, if
bias
is present, it is added to the implicit level of detail prior to
performing the texture access operation.
The implicit level of detail is selected as follows: For a texture that is not
mipmapped, the texture is used directly. If it is mipmapped and running
in a fragment shader, the LOD computed by the implementation is used
to do the texture lookup. If it is mipmapped and running on the vertex
shader, then the base texture is used.
Some texture functions (non-“
Lod
” and non-“
Grad
” versions) may
require implicit derivatives. Implicit derivatives are undefined within non-
uniform control flow and for vertex texture fetches.
For
Cube
forms, the direction of
P
is used to select which face to do a
two-dimensional texture lookup in, as described in section 3.8.10, “Cube
Map Texture Selection,” in the OpenGL ES Graphics System Specification.
For
Array
forms, the array layer used will be
max
(0,
min
(
d
− 1,
loor
(
layer
+ 0.5)))
where
d
is the depth of the texture array and
layer
comes from the
component indicated in Table B-9.