Kommentar
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
Choose src1 if src0 >= 0. Otherwise, choose src2. The comparison is done per channel.
Syntax
| cmp dst, src0, src1, src2 |
|---|
where
- dst is the destination register.
- src0 is a source register.
- src1 is a source register.
- src2 is a source register.
Remarks
| Pixel shader versions | 1_1 | 1_2 | 1_3 | 1_4 | 2_0 | 2_x | 2_sw | 3_0 | 3_sw |
|---|---|---|---|---|---|---|---|---|---|
| cmp | x | x | x | x | x | x | x | x |
There are a few additional limitations for versions 1_2 and 1_3:
- Each shader can use up to a maximum of three cmp instructions.
- The destination register cannot be the same as any of the source registers.
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
Related topics