sampleinfo (sm4.1 - asm)

Queries the number of samples in a given shader resource view or in the rasterizer.

[_uint] dest[.mask], srcResource[.swizzle]




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


[in] The shader resource.



This instruction returns the number of samples for the given resource or the rasterizer. It is valid only for resources that can be loaded using ld2dms unless the rasterizer is specified as srcResource. srcResource could be a t# register (a shader resource view) or a rasterizer register.

The instruction computes the vector (SampleCount,0,0,0).

The swizzle on srcResource allows the returned values to be swizzled arbitrarily before they are written to the destination. The returned value is floating point, unless the _uint modifier is used, in which case the returned value is integer. If there is no resource bound to the specified slot, 0 is returned.

This instruction applies to the following shader stages:

Vertex ShaderGeometry ShaderPixel Shader


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


Related topics

Shader Model 4 Assembly (DirectX HLSL)