samplepos (sm4.1 - asm)

Queries the position of a sample in a given shader resource view or in the rasterizer.

samplepos dest[.mask], srcResource[.swizzle], sampleIndex (scalar operand)

 

ItemDescription

dest

[in] The address of the results of the operation.

srcResource

[in] The shader resource.

sampleIndex

[in] The index of the sample.

 

Remarks

This instruction returns the 2D sample position of sample sampleIndex for the given resource. It is valid only for resources that can be loaded using ld2dms unless the rasterizer is specified as srcResource.

srcResource can be a t# register (a shader resource view) or a rasterizer register.

The instruction computes the floating point vector (Xposition, Yposition, 0, 0).

The swizzle on srcResource allows the returned values to be swizzled arbitrarily before they are written to the destination. The sample position is relative to the pixel's center, based on the Pixel Coordinate System.

If sampleIndex is out of bounds a zero vector is returned. If there is no resource bound to the specified slot, 0 is returned.

samplepos can be used for things like custom resolves in shader code.

This instruction applies to the following shader stages:

Vertex ShaderGeometry ShaderPixel Shader
x

 

Minimum Shader Model

This function is supported in the following shader models.

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

 

 

 

Community Additions

ADD
Show:
© 2014 Microsoft