step

Compares two values, returning 0 or 1 based on which value is greater.

ret step(y, x)

Parameters

Item Description
y
[in] The first floating-point value to compare.
x
[in] The second floating-point value to compare.

Return Value

1 if the x parameter is greater than or equal to the y parameter; otherwise, 0.

Remarks

This function uses the following formula: (x >= y) ? 1 : 0. The function returns either 0 or 1 depending on whether the x parameter is greater than the y parameter. To compute a smooth interpolation between 0 and 1, use the smoothstep HLSL intrinsic function.

Type Description

Name Template Type Component Type Size
y scalar, vector, or matrix float any
x same as input y float same dimension(s) as input y
ret same as input y float same dimension(s) as input y

Minimum Shader Model

This function is supported in the following shader models.

Shader Model Supported
Shader Model 2 (DirectX HLSL) and higher shader models yes
Shader Model 1 (DirectX HLSL) yes (vs_1_1 and ps_1_4)

See also

Intrinsic Functions (DirectX HLSL)