GetSamplePosition (DirectX HLSL Texture Object)

Gets the position of the specified sample.

ret Object.GetSamplePosition( int s );

Parameters

Item Description
Object
A Texture2DMS or a Texture2DMSArray texture-object type.
s
[in] The zero-based sample index.

Return Value

Returns the (x,y) sample position, a two-component floating-point vector.

Minimum Shader Model

This function is supported in the following shader models.

vs_4_0 vs_4_1 ps_4_0 ps_4_1 gs_4_0 gs_4_1
x x x
  • Shader Model 4.1 is available in Direct3D 10.1 or higher.

Remarks

A pixel shader can be evaluated at sample frequency (run a pixel shader once per sample) or at pixel frequency (run a pixel shader once per pixel). Attach the SV_SampleIndex semantic to a pixel shader input to invoke a pixel shader at sample frequency, the input value is then used as a sample index when sampling the render target.

You can interpolate a pixel shader input in several ways. To interpolate at:

  • A pixel center, don't use any semantic.
  • A sample, use the SV_SampleIndex semantic.
  • A centroid location, use the _centroid modifier.

Texture-Object