Graphics Reference
In-Depth Information
is specified for the sampler state, the texture will be sampled multiple times and compared
against the comparison value. The final return value is then the filtered result of all compari-
sons. This can be used to efficiently implement percentage closer filtering for shadow maps.
Gather Methods
The Gather family of methods returns four values when given a single texture coordinate.
The values come from a 2x2 quad of texels, using the same location that would be used for
bilinear filtering. GatherRed returns the four red components of the texels, GatherGreen
returns the four green components, GatherBlue returns the four blue components, and
GatherAlpha returns the four alpha components. Gather returns the four red components,
making it functionally equivalent to GatherRed. Since the method returns a 2x2 quad, it
can only be used on Texture2D and Texture2DArray resource objects. GatherCmp meth-
ods are also available, which work similarly to SampleCmp.
One of the more useful cases for the Gather methods is in pixel shaders that perform
image processing. Normally gathering rgb values for a 2x2 quad of texels requires four
sample operations, with one for each texel. This can be made more efficient by calling
GatherRed, GatherGreen, and GatherBlue retrieve the same data in only three instruc-
tions. Another useful case for Gather instructions is implementing custom shadow map
filtering kernels, which can be done efficiently with GatherCmp.
Load Methods
The Load method provides direct, unaltered, read-only access to texture data in a manner
similar to what we have seen with the buffer types. Like the Buffer Load method, it takes
an int index parameter, rather than a [0,1] texture address. Since it is the most basic means
of accessing texture data, it is available on all texture resource types and in all stages. The
array operator is also available, which provides similar functionality. For multisampled
textures, Load provides access to the individual subsamples of a pixel. This functionality
can be used to implement custom MSAA resolves, or to integrate MSAA into a deferred
rendering pipeline. Like the Load method for a Buffer object, the return type is determined
by the type that was used as a template parameter when declaring the texture object.
Get Methods
Texture resource objects implement several methods for querying information about
the underlying resource. All texture resource object types implement GetDimenslons,
which returns the size, number of mip levels, number of samples (for multisampled tex-
tures), and number of elements (for texture arrays). Texture2DMS objects also support the
GetSamplePosition method, which returns the position of a MSAA sample point within
the pixel given a sample index.
Search WWH ::




Custom Search