Skip to main content

High-Tech And Vertex Juggling - NVIDIA's New GeForce3 GPU

Pixel Shader Programming, Continued

Above you see a typical example for EMBM.

Here's a list of the rather simple texture blending instructions:

Texture Blending InstructionParametersExplanation
adddest, src1, src2dest = src1 + sr2
subdest, src1, src2dest = src1 - src2
dp3dest, src1, src2dest = ( src1.x * src2.x + src1.y * src2.y ...)
lrpdest, factor, src1, src2dest = (factor)src1 + ( 1-factor)src2
muldest, src0, src1dest = src0 * src1
maddest, src0, src1, src2dest = ( src0 + src1 * src2 )
movdest, srcdest = src
cnddest, r0.a, src1, src2if ( r0.a > 0.5 ) { dest = src1; } else { dest = src2; }

The pixel shader supports argument and instruction modifiers as well, to make life easier for programmers:

ModifierExplanation
r0.aAlpha Replicate
1 - r0Invert
-r0Negate
r0_biasBias - subtract 0.5
r1+bx2Signed Scale - 2 * ( x - 0.5f )
_x2double result
_x4quadruple result
_d2halve result
_satclamp < 0 to 0 and < 1 to 1

So far about the dry theory of pixel shader programming. Let's get to something more interesting.