I submit my matrices as program locals, not sure if there’s a better way to do it or not. My vertex program looks like this:

!!ARBvp1.0

# Purpose: Vertex lighting for 3-weight skeleton

ATTRIB iPos = vertex.position;

ATTRIB iNormal = vertex.normal;

ATTRIB iTexCoord = vertex.texcoord;

ATTRIB iBoneIdx = vertex.color;

ATTRIB iWeights = vertex.attrib[6];

PARAM wvp[4] = { state.matrix.mvp };

PARAM ambientCol = program.local[0];

PARAM diffuseCol = program.local[1];

PARAM lightDir = program.local[2];

PARAM bones[%i] = { program.local[%i…%i] };

OUTPUT oPos = result.position;

OUTPUT oColor = result.color;

OUTPUT oTexCoord = result.texcoord;

ADDRESS a;

TEMP mv0, mv1, mv2, modelNormal, dot, tempPos, boneIdx;

# Pass through the texcoords

MOV oTexCoord, iTexCoord;

# Extract the bone indices that were submitted as uchars

MUL boneIdx, iBoneIdx, 255.9;

# Compute the modelview matrix by summing up the weighted bone matrices

ARL a, boneIdx.x;

MUL mv0, bones[a.x+0], iWeights.x;

MUL mv1, bones[a.x+1], iWeights.x;

MUL mv2, bones[a.x+2], iWeights.x;

ARL a, boneIdx.y;

MAD mv0, bones[a.x+0], iWeights.y, mv0;

MAD mv1, bones[a.x+1], iWeights.y, mv1;

MAD mv2, bones[a.x+2], iWeights.y, mv2;

ARL a, boneIdx.z;

MAD mv0, bones[a.x+0], iWeights.z, mv0;

MAD mv1, bones[a.x+1], iWeights.z, mv1;

MAD mv2, bones[a.x+2], iWeights.z, mv2;

# Transform the normal to model coordinates

DP3 modelNormal.x, mv0, iNormal;

DP3 modelNormal.y, mv1, iNormal;

DP3 modelNormal.z, mv2, iNormal;

# Compute the diffuse lighting

DP3 dot.x, modelNormal, lightDir;

LIT dot, dot;

# Calculate final vertex color

MAD oColor, dot.y, diffuseCol, ambientCol;

MOV oColor.w, 1.0;

# Calculate the final vertex position

DP4 tempPos.x, mv0, iPos;

DP4 tempPos.y, mv1, iPos;

DP4 tempPos.z, mv2, iPos;

MOV tempPos.w, 1.0;

DP4 oPos.x, wvp[0], tempPos;

DP4 oPos.y, wvp[1], tempPos;

DP4 oPos.z, wvp[2], tempPos;

DP4 oPos.w, wvp[3], tempPos;

END

If someone tries zeckensack’s way, can you post the number of instructions your VP compiles to?