lod (sm4.1 - asm)

Returns the level of detail (LOD) that would be used for texture filtering.

lod dest[.mask], srcAddress[.swizzle], srcResource[.swizzle], srcSampler




[in] The address of the results.


[in] A set of texture coordinates.


[in] A texture register.


[in] A sampler register.



This behaves like the sample instruction, but a filtered sample is not generated. The instruction computes the following vector (ClampedLOD, NonClampedLOD, 0, 0). NonClampedLOD is a computed LOD value that ignores any clamping from either the sampler or the texture (ie: it can return negative values.) ClampedLOD is a computed LOD value that would be used by the actual sample instruction. The swizzle on srcResource allows the returned values to be swizzled arbitrarily before they are written to the destination.

If there is no resource bound to the specified slot, 0 is returned.

If the sampler is using anisotropic filtering the LOD should correspond to the fractional mip level based on the smaller axis of the elliptical footprint.

This is valid for the following texture types: Texture1D, Texture2D, Texture3D and TextureCube.

The lod instruction is not defined when used with a sampler that specifies point mip filtering, specifically, any D3D10_FILTER enum that ends in MIP_POINT. (An example of this would be D3D10_FILTER_MIN_MAG_MIP_POINT.)

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)