max (sm4 - asm)

Component-wise float maximum.

max[_sat] dest[.mask], [-]src0[_abs][.swizzle], [-]src1[_abs][.swizzle],
Item Description
dest
[in] The result of the operation.
dest = src0 >= src1 ? src0 : src1
src0
[in] The components to compare to src1.
src1
[in] The components to compare to src0.

Remarks

= 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-> -inf F +inf NaN
-inf -inf src1 +inf -inf
F src0 src0 or src1 +inf src0
+inf +inf +inf +inf +inf
NaN -inf src1 +inf NaN

This instruction applies to the following shader stages:

Vertex Shader Geometry Shader Pixel Shader
x x x

Minimum Shader Model

This function is supported in the following shader models.

Shader Model Supported
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

Shader Model 4 Assembly (DirectX HLSL)