?/TD>
Microsoft DirectX 9.0

cmp (Pixel Shader)


Conditionally chooses between src1 and src2, based on the comparison src0 >= 0. The comparison is done per channel.

Syntax

cmp dst, src0, src1, src2

where

Remarks

Pixel shader versions1_11_21_31_42_02_x2_sw3_03_sw
cmpxxxxxxxxx

There are a few additional limitations for versions 1_2 and 1_3:

This example does a four-channel comparison.

ps_1_4
def c0, -0.6, 0.6, 0, 0.6
def c1  0,0,0,0
def c2  1,1,1,1

mov r1, c1
mov r2, c2

cmp r0, c0, r1, r2   // r0 is assigned 1,0,0,0 based on the following:

// r0.x = c2.x because c0.x <  0
// r0.y = c1.y because c0.y >= 0
// r0.z = c1.z because c0.z >= 0
// r0.w = c1.w because c0.w >= 0

Instruction Information

Minimum operating systemWindows 98


© 2002 Microsoft Corporation. All rights reserved.