Modifiers

Modifiers are used to modify instructions, source registers, and destination registers. The order of operations specified in a given instruction is: source register selectors and source register modifiers; instruction execution; instruction modifiers; and destination register update based on write masks.

- (negate): Source modifier. Negation operator. ü ü ü ü
_abs: Source modifier. Absolute value of the source. - - ü ü
Arbitrary Swizzles: Source modifier. ü ü ü ü
_sat: Instruction modifier. Clamp from 0 to 1. - - - ü
[!](p[.swizzle]): Instruction modifier. Support predicate. - - ü* ü*

Note:
1) - No Support; ü Support; ? Unknown.
2) * See details in predicate register instruction in the next section.

When both _abs and negate (-) are present, the _abs happen first in NV30 and VS3.0.

Modifier can decrease instruction number and increase efficacy dramatically. For example, to get the sum of the absolute values of two vectors in NV30 or VS3.0, rather than doing:

ABS tmp0, X
ABS tmp1, Y
ADD Z, tmp0, tmp1

We can do:

ADD Z, |X|, |Y|


Instruction Sets

Now, let’s begin to analyze instruction sets in DX9 VS2.0, R300, NV30, and DX9 VS3.0. In fact, this is the key to determining the performance and functionality of the vertex program. If we were to exclude the new instructions about flow control, we couldn’t find important differences between DX8 VS1.1 and DX9 VS2.0. Several math functions become real instruction in DX9 VS2.0, like EXP, LOG and FRC. MOV instruction has been split in two. It now only moves floating point data and no longer accepts the address register as a destination. A new instruction, MOVA, has been introduced that moves a floating point value by rounding as defined here when writing to an address register. Moreover, the following macros are new: ABS, SINCOS, NRM, LRP, CRS, SGN, POW. To save space, we won’t include instruction set in DX8 VS1.1.

Add & multiply instruction ADD, DP3, DP4, MAD, MOV, SUB ADD, DP3, DP4, MAD, MADDX2, MOV, SUB ADD, DP3, DP4, MAD, MOV, SUB ADD, DP3, DP4, DPH, MAD, MOV, SUB
Math functions EXP, EXPP, FRC, LOG, LOGP, RCP, RSQ EXP, EXPP, EXPE, FRC, LOG, LOGP, POW, RCP, RSQ EXP, EXPP, FRC, LOG, LOGP, RCP, RSQ ABS, COS, EX2, EXP, FLR, FRC, LG2, LOG, POW, RCC, RCP, RSQ, SIN
Set on instructions SGE, SLT SGE, SLT SGE, SLT SEQ, SFL, SGE, SGT, SLE, SLT, SNE, STR
Static flow control instructions IF, ELSE, ENDIF, CALL, CALLNZ, LOOP, ENDLOOP, LABEL, REPEAT, ENDREP, RET CALL, LOOP, ENDLOOP, JUMP, JNZ, LABEL, REPEAT, ENDREPEAT, RETURN IF, ELSE, ENDIF, CALL, CALLNZ, LOOP, ENDLOOP, LABEL, REPEAT, ENDREP, RET BRA, CAL, RET
Dynamic flow control instructions - - IFC, BREAK, BREAKC
Address register instructions MOVA ARL, ARR MOVA ARA, ARL
Predicate register instruction - - SETP -
Graphics-oriented instructions DST, LIT DST, LIT DST, LIT DST, LIT, SSG
Texture instruction - - TEXLDV -
Minimum / maximum instructions MAX, MIN MAX, MIN MAX, MIN MAX, MIN

DX9 VS2.0 Macros:
ABS, CRS, LRP, M4X4, M4X3, M3X4, M3X3, M3X2, NRM, POW, SGN, SINCOS

Here, we can find apparent differences among instruction sets. It seems that R300 and NV30 each has its own strong points. Let’s go on to verify this.