Skip to main content

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

Programming The Vertex Shader

This information is only for the ones of you who are interested and have a bit of programming experience as well as a minimal understanding of 3D math.

These are the instructions:

InstructionParametersAction
nopdo nothing
movdest, srcmove
muldest, src1, rc2Set dest to the product of src1 and src2
adddest, src1, rc2Add src1 to src2. [And the optional negation creates subtraction]
maddest, src1, rc2, rc3Multiply src1 by src2 and add src3 - into dst
rsqdest, srcReciprocal square root of src (much more useful than straight 'square root').dest.x = dest.y = dest.z = dest.w = 1/sqrt(src)
dp3dest, src1, src23 Component dot product
dp4dest, src1, src24 Component dot product
dstdest, src1, src2Calculate distance vector. src1 vector is (NA,d*d,d*d,NA) and src2 is (NA,1/d,NA,1/d).dest is set to (1,d,d*d,1/d)
litdest, srcCalculates lighting coefficients from two dot products and a power. src is:src.x = n o l (unit normal and light vectors)src.y = n o h (unit normal and halfangle vectors)src.z is unusedsrc.w = power (in range +128 to -128)
mindest, src1, src2Component-wise min operation
maxdest, src1, src2Component-wise max operation
sltdest, src1, src2dest = (src1 < src2) ? 1 : 0
sgedest, src1, src2dst = (src1 >= src2) ? 1 : 0
exppdest, src.wdest.x = 2 ** (int)src.wdest.y = fractional part (src.w)dest.z = 2 ** src.wdest.w = 1.0
logdest, src.wdest.x = exponent((int)src.w)dest.y = mantissa(src.w)dest.z = log2(src.w)dest.w = 1.0
rcpdest, src.wdest.x = dest.y = dest.z = dest.w = 1 / src

These few instructions are already quite powerful. To make the handling easier, NVIDIA added a few more features, 'costless' negation and swizzling...