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)|
[in] The address of the results of the operation.
[in] The shader resource.
[in] The index of the sample.
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 Shader||Geometry Shader||Pixel Shader|
This function is supported in the following shader models.
|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|