gather4_c (sm5 - asm)

Same as gather4, except this instrution performs comparison on texels, similar to sample_c.

gather4_c[_aoffimmi(u,v)] dest[.mask], srcAddress[.swizzle], srcResource[.swizzle], srcSampler[.r], srcReferenceValue
Item Description
dest
[in] The address of the result of the operation
srcAddress
[in] A set of texture coordinates.
srcResource
[in] A texture register.
srcSampler
[in] A sampler register.
srcReferenceValue
[in] A register with a single component selected, which is used in the comparison.

Remarks

For a description of how srcReferenceValue gets compared against each fetched texel, see sample_c. Unlike sample_c, gather4_c returns each comparison result, rather than filtering them. The order of operations is srcReferenceValue {ComparisonFunction} texel.R.

For TextureCube corners, where there are three real texels and a fourth must be synthesized, the synthesis must occur after the comparison step. This means the returned comparison result for the syntesized texel can be 0, 0.33 , 0.66 , or 1. Some implementations may only return either 0 or 1 for the synthesized texel. Aside from this listing of possible results, the method for synthesizing the texel is unspecified.

For formats with float32 components, if the value being fetched is normalized, or +-INF, it is used in the comparison operation untouched. NaN is used in the comparison operation as NaN, but the exact bit representation of the NaN may be changed. Denorms are flushed to zero going into the comparison. For TextureCubes, some synthesis of the missing 4th texel must occur at corners, so the notion of returning bits unchanged for the synthesized texel does not apply.

Formats supported for gather4_c are same as those supported for sample_c. These are single-component formats, thus the .R on srcSampler, rather than an arbitrary swizzle. gather4_c on an unbound resource returns 0.

Use this instruction for custom shadow map filtering.

This instruction applies to the following shader stages:

Vertex Hull Domain Geometry Pixel Compute
X X X X X X

Minimum Shader Model

This instruction is supported in the following shader models:

Shader Model Supported
Shader Model 5 yes
Shader Model 4.1 no
Shader Model 4 no
Shader Model 3 (DirectX HLSL) no
Shader Model 2 (DirectX HLSL) no
Shader Model 1 (DirectX HLSL) no

Shader Model 5 Assembly (DirectX HLSL)