max (sm4 - asm)

Component-wise float maximum.

max[_sat] dest[.mask], [-]src0[_abs][.swizzle], [-]src1[_abs][.swizzle],




[in] The result of the operation.

dest = src0 >= src1 ? src0 : src1


[in] The components to compare to src1.


[in] The components to compare to src0.



>= is used instead of > so that if min(x,y) = x then max(x,y) = y.

NaN has special handling. If one source operand is NaN, then the other source operand is returned and the choice is made per-component. If both are NaN, any NaN representation is returned.

Denorms are flushed with sign preserved before the comparison. However, the result written to dest may or may not be denorm flushed.

The following table shows the results obtained when executing the instruction with various classes of numbers, assuming that neither overflow or underflow occurs. F means finite real number.

src0 src1->-infF+infNaN
Fsrc0src0 or src1+infsrc0


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)