step
Keywords: step, NVIDIA, NVIDIA Cg Toolkit, Cg Toolkit, Shader, Shader Programming, GPU Shader Programming, GPU Program

> ## Name

> step - implement a step function returning either zero or one

> ## Synopsis

>     float  step(float  a, float  x);
>     float1 step(float1 a, float1 x);
>     float2 step(float2 a, float2 x);
>     float3 step(float3 a, float3 x);
>     float4 step(float4 a, float4 x);

>     half   step(half  a, half  x);
>     half1  step(half1 a, half1 x);
>     half2  step(half2 a, half2 x);
>     half3  step(half3 a, half3 x);
>     half4  step(half4 a, half4 x);

>     fixed  step(fixed  a, fixed  x);
>     fixed1 step(fixed1 a, fixed1 x);
>     fixed2 step(fixed2 a, fixed2 x);
>     fixed3 step(fixed3 a, fixed3 x);
>     fixed4 step(fixed4 a, fixed4 x);

> ## Parameters

> a
>   Scalar or vector reference value.
> x
>   Scalar or vector.

> ## Description

> Implements a step function returning one for each component of x that is greater than or equal to the corresponding component in the reference vector a, and zero otherwise.

> ## Reference Implementation

> step for float3 vectors could be implemented this way:

>     float3 step(float3 a, float3 x)
>     {
>       return x >= a;
>     }

> ## Profile Support

> step is supported in all profiles.

> Support in the fp20 is limited.

> ## See Also

> max, min, saturate, smoothstep