Graphics Reference
In-Depth Information
6.5.5 Textures
Textures are among the most commonly-used resources in the rendering pipeline, and
make use of specialized texture sampling units in graphics hardware. Consequently HLSL
exposes a large interface for sampling texture data, to allow shader programs to make the
most use of the hardware's capabilities. HLSL includes read-only texture resource object
types, corresponding to the various texture resource types in D3D11. A full listing of these
types is given in Table 6.4.
Intrinsic
Description
Texture1D
One-dimensional texture
Texture1DArray
Array of one-dimensional textures
Texture2D
Two-dimensional texture
Texture2DArray
Array of two-dimensional textures
Texture2DMS
Two-dimensional texture with multisampling
Texture2DMSAr>ray
Array of two-dimensional textures with multisampling
Texture3D
Three-dimensional texture
Texture3DArray
Array of three-dimensional textures
Array of six 2D textures, representing faces of a cube
TextuneCube
TextureCubeArray
Array of cube textures
Table 6.4. Texture resource objects.
The texture resource object types each support a subset of all of the texture opera-
tions, and consequently, each object type has its own interface. Consult the HLSL docu-
mentation to see if a method is supported for a given texture object type. The following
sections describe how each of the methods can be used for accessing a texture object.
Sample Methods
Traditional texture sampling operations are performed with the Sample family of methods
available on the texture objects. These methods each take a set of floating-point texture
coordinates representing the memory location to sample, where each component is nor-
malized to the range [0,1]. The number of components depends on the texture type. For
instance, a TexturelD only accepts a single float, while a Texture2D accepts two floats,
and a Texture3D accepts three. If a texture array is used, an additional floating-point com-
ponent is passed, indicating the index of the array to use.
The Sample method allows for hardware texture filtering (minification, magnifica-
tion, and mip-map interpolation) to be performed, according to a given sampler state. The
Search WWH ::




Custom Search