Graphics Reference
In-Depth Information
Texture Lookup Functions
Texture lookup functions are available to vertex and fragment shaders.
However, level of detail is not implicitly computed for vertex shaders.
The functions in Table B-8 provide access to textures through samplers, as
set up through the OpenGL ES API. Texture properties such as size, pixel
format, number of dimensions, filtering method, number of mipmap
levels, depth comparison, and so on are also defined by OpenGL ES API
calls. Such properties are taken into account as the texture is accessed via
the built-in functions defined below.
Texture data can be stored by the GL as floating-point, unsigned
normalized integer, unsigned integer, or signed integer data. This is
determined by the type of the internal format of the texture. Texture
lookups on unsigned normalized integer and floating-point data return
floating-point values in the range [0, 1].
Texture lookup functions are provided that can return their result as
floating-point, unsigned integer, or signed integer values, depending on
the sampler type passed to the lookup function. Care must be taken to
use the right sampler type for texture access. Table B-8 lists the supported
combinations of sampler types and texture internal formats. Blank entries
are unsupported. Doing a texture lookup will return undefined values for
unsupported combinations.
Table B-8
Supported Combinations of Sampler and Internal Texture Formats
Internal Texture
Format
Floating-Point
Sampler Types
Signed Integer
Sampler Types
Unsigned Integer
Sampler Types
Floating point
Supported
Normalized
integer
Supported
Signed integer
Supported
Unsigned integer
Supported
If an integer sampler type is used, the result of a texture lookup is an
ivec4. If an unsigned integer sampler type is used, the result of a texture
lookup is a uvec4. If a floating-point sampler type is used, the result of a
texture lookup is a vec4, where each component is in the range [0, 1].
 
 
 
Search WWH ::




Custom Search