saturate - HLSL

Clamps x to the range [0, 1].

Syntax

ret saturate(x)

Where:

Name In/Out Template Type Component Type Size
x in scalar, vector, or matrix float any
ret out same as input x float same dimension(s) as input x

Minimum Shader Version

This intrinsic function is supported in the following (or above) shader versions:

Vertex Shader Pixel Shader
vs_1_1 ps_1_1

See Also

HLSL Intrinsic Functions