Shader Operation Codes
This section lists the operation codes that can be contained in the first 16 bits (0 - 15) of an instruction token. The sections that follow describe the token format of the instructions that correspond to the operation codes.
- D3DSIO_ABS
- The ABS instruction computes absolute value.
- D3DSIO_ADD
- The ADD instruction adds sources into the destination.
- D3DSIO_BEM
- The BEM instruction applies a bump environment-map transform.
- D3DSIO_BREAK
- The BREAK instruction breaks from a loop.
- D3DSIO_BREAKC
- The BREAK_COMP instruction breaks from a loop, depending on the results of a conditional compare.
- D3DSIO_BREAKP
- The BREAK PRED instruction breaks from a loop, using predication.
- D3DSIO_CALL
- The CALL instruction calls a subroutine.
- D3DSIO_CALLNZ
- The CALLNZ instruction calls a subroutine if not zero.
- D3DSIO_CMP
- The CMP instruction chooses between sources, based on a comparison to zero.
- D3DSIO_CND
- The CND instruction chooses between sources, based on a comparison to greater than 0.5.
- D3DSIO_COMMENT
- Specifies the comment token.
- D3DSIO_CRS
- The CRS instruction computes cross product.
- D3DSIO_DCL
- The DCL instruction declares registers.
- D3DSIO_DEF
- The DEF instruction defines constants.
- D3DSIO_DEFB
- The DEFB instruction declares a Boolean constant.
- D3DSIO_DEFI
- The DEFI instruction declares an integer constant.
- D3DSIO_DP2ADD
- The DP2ADD instruction performs a 2-D dot product and scalar addition.
- D3DSIO_DP3
- The DP3 instruction computes three-component dot product.
- D3DSIO_DP4
- The DP4 instruction computes four-component dot product.
- D3DSIO_DST
- The DST instruction computes distance.
- D3DSIO_DSX
- The DSX instruction computes rate of change in the x direction.
- D3DSIO_DSY
- The DSY instruction computes rate of change in the y direction.
- D3DSIO_ELSE
- The ELSE instruction begins an ELSE block.
- D3DSIO_END
- Specifies the end token.
- D3DSIO_ENDIF
- The ENDIF instruction ends an IF...ELSE block.
- D3DSIO_ENDLOOP
- The ENDLOOP instruction marks the end of a loop block.
- D3DSIO_ENDREP
- The ENDREP instruction marks the end of a repeat block.
- D3DSIO_EXP
- The EXP instruction provides full precision exponential 2x.
- D3DSIO_EXPP
- The EXPP instruction provides partial precision exponential 2x.
- D3DSIO_FRC
- The FRC instruction returns fractional component.
- D3DSIO_IF
- The IF instruction begins an IF block.
- D3DSIO_IFC
- The IF_COMP instruction begins an if block with a comparison.
- D3DSIO_LABEL
- The LABEL instruction marks the next instruction as label.
- D3DSIO_LIT
- The LIT instruction calculates lighting.
- D3DSIO_LOG
- The LOG instruction calculates full precision log2(x).
- D3DSIO_LOGP
- The LOGP instruction calculates partial precision log2(x).
- D3DSIO_LOOP
- The LOOP instruction begins a LOOP...ENDLOOP block.
- D3DSIO_LRP
- The LRP instruction interpolates linearly between registers.
- D3DSIO_M3x2
- The M3x2 instruction performs 3x2 multiply.
- D3DSIO_M3x3
- The M3x3 instruction performs 3x3 multiply.
- D3DSIO_M3x4
- The M3x4 instruction performs 3x4 multiply.
- D3DSIO_M4x3
- The M4x3 instruction performs 4x3 multiply.
- D3DSIO_M4x4
- The M4x4 instruction performs 4x4 multiply.
- D3DSIO_MAD
- The MAD instruction multiplies and adds sources.
- D3DSIO_MAX
- The MAX instruction determines maximum.
- D3DSIO_MIN
- The MIN instruction determines minimum.
- D3DSIO_MOV
- The MOV instruction moves data between registers.
- D3DSIO_MOVA
- The MOVA instruction moves data from floating-point register to integer register.
- D3DSIO_MUL
- The MUL instruction multiplies sources into the destination.
- D3DSIO_NOP
- The NOP instruction performs a no-op, or no operation.
- D3DSIO_NRM
- The NRM instruction normalizes a 4-D vector.
- D3DSIO_PHASE
- The PHASE instruction marks the transition between pixel shader version 1 and 2.
- D3DSIO_POW
- The POW instruction calculates full precision (src1)src0.
- D3DSIO_RCP
- The RCP instruction computes the reciprocal of source.
- D3DSIO_REP
- The REP instruction starts a REPEAT...ENDREP block.
- D3DSIO_RET
- The RET instruction returns from a subroutine.
- D3DSIO_RSQ
- The RSQ instruction computes reciprocal square root of source.
- D3DSIO_SETP
- The SETP instruction sets the predicate register.
- D3DSIO_SGE
- The SGE instruction determines a greater than or equal comparison.
- D3DSIO_SGN
- The SGN instruction determines the sign of the source.
- D3DSIO_SINCOS
- The SINCOS instruction computes sine and cosine of the source.
- D3DSIO_SLT
- The SLT instruction determines a less than comparison.
- D3DSIO_SUB
- The SUB instruction subtracts sources and stores the result in the destination.
- D3DSIO_TEX
- The TEX instruction loads destination with color data (RGBA) that is sampled from the source texture.
- D3DSIO_TEXBEM
- The TEXBEM instruction applies bump environment-map transform.
- D3DSIO_TEXBEML
- The TEXBEML instruction applies bump environment-map transform with luminance correction.
- D3DSIO_TEXCOORD
- The TEXCOORD instruction copies texture coordinate data (UVW1) as color data (RGBA).
- D3DSIO_TEXDEPTH
- The TEXDEPTH instruction calculates depth value to be used in pixel depth buffer comparison test.
- D3DSIO_TEXDP3
- The TEXDP3 instruction performs three-component dot product for a texture.
- D3DSIO_TEXDP3TEX
- The TEXDP3TEX instruction performs three-component dot product and uses the result to do a 1-D texture lookup.
- D3DSIO_TEXKILL
- The TEXKILL instruction cancels rendering of current pixel.
- D3DSIO_TEXLDD
- The TEXLDD instruction samples a texture with adjustable level of detail (LOD) bias.
- D3DSIO_TEXLDL
- The TEXLDL instruction samples a texture with the LOD from the W component.
- D3DSIO_TEXM3x2DEPTH
- The TEXM3x2DEPTH instruction calculates depth value to be used in pixel depth testing.
- D3DSIO_TEXM3x2PAD
- The TEXM3x2PAD instruction performs the first row multiplication of a two-row matrix multiply.
- D3DSIO_TEXM3x2TEX
- The TEXM3x2TEX instruction performs the final row of a 3x2 matrix multiply and uses the result in a texture lookup.
- D3DSIO_TEXM3x3
- The TEXM3x3 instruction performs 3x3 matrix multiply when used in conjunction with two TEXM3x3PAD instructions.
- D3DSIO_TEXM3x3PAD
- The TEXM3x3PAD instruction performs the first or second row multiply of a three-row matrix multiply.
- D3DSIO_TEXM3x3SPEC
- The TEXM3x3SPEC instruction performs a 3x3 matrix multiply and uses the result in a texture lookup. Used for specular reflection and environment mapping.
- D3DSIO_TEXM3x3TEX
- The TEXM3x3TEX instruction performs a 3x3 matrix multiply and uses the result in a texture lookup.
- D3DSIO_TEXM3x3VSPEC
- The TEXM3x3VSPEC instruction performs a 3x3 matrix multiply and uses the result in a texture lookup. Used for specular reflection and environment mapping where the eye-ray vector is not constant.
- D3DSIO_TEXREG2AR
- The TEXREG2AR instruction copies alpha and red (AR) color components of source as texture address data (UV).
- D3DSIO_TEXREG2GB
- The TEXREG2GB instruction copies green and blue color components of source as texture address data.
- D3DSIO_TEXREG2RGB
- The TEXREG2RGB instruction copies red, green, and blue (RGB) color components of source as texture address data.
Comments
For more information about each instruction that is embedded in each operation code, see the Shader Reference in the latest DirectX SDK documentation.