ftoi (sm4 - asm)

Floating point to signed integer conversion.

ftoi dest[.mask], [-]src0[_abs][.swizzle]




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

dest = src0 - round_ni(src0)


[in] The component to convert.



The conversion is performed per-component. Rounding is always performed towards zero, following the C convention for casts from float to int. Applications that require different rounding semantics can invoke the round instructions before casting to integer.

Inputs are clamped to the range [-2147483648.999f ... 2147483647.999f] prior to conversion, and input NaN values produce a zero result.

Optional negate and absolute value modifiers are applied to the source values before conversion.

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 yes
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)