Possible bug in ATI drivers?

I have an ATI X600 using the latest Omega drivers on a laptop machine running Windows XP.

My problem appears when trying to implement skinning on the GPU. I use the program.env parameters to pass the bone matrices to the vertex shader. However, there are some nearprogram.env[51] that doesn’t appear to work well: the shader seems to be reading rubbish from it. I can work around this problem by skipping the first 50 program.envs (my card has 256 available).

I didn’t test it on nVidia hardware, so I can not assure it is an ATI bug.

Does any one of you have any idea of what is happenning?

Thanks in advance.

Can you post the shader?

I found out that it also happens on Nvidia hardware! It’s very strange.

Here is the shader:

!!ARBvp1.0
PARAM mvp[4] = { state.matrix.mvp };
PARAM model[4] = { state.matrix.program[0] };
TEMP temp, modelpos, resultpos;
ADDRESS iBoneMat;
TEMP vertexBonePosition, pos1, pos2;
PARAM boneMat[54] = { program.env[0..53] };
ATTRIB boneIdx = vertex.attrib[11]; # (idx0,weight0,idx1,weight1) 
ATTRIB boneRelPos0 = vertex.attrib[12]; 
ATTRIB boneRelPos1 = vertex.attrib[14]; 
#First bone weight
ARL iBoneMat.x, boneIdx.x;
DP4 pos1.x, boneMat[iBoneMat.x], boneRelPos0;
DP4 pos1.y, boneMat[iBoneMat.x+1], boneRelPos0;
DP4 pos1.z, boneMat[iBoneMat.x+2], boneRelPos0;
MUL pos1.xyz, pos1, boneIdx.y; # apply first weight
#Second bone weight
ARL iBoneMat.x, boneIdx.z;
DP4 pos2.x, boneMat[iBoneMat.x], boneRelPos1;
DP4 pos2.y, boneMat[iBoneMat.x+1], boneRelPos1;
DP4 pos2.z, boneMat[iBoneMat.x+2], boneRelPos1;
MAD vertexBonePosition.xyz, pos2, boneIdx.w, pos1; # apply second weight and add to first weight
MOV vertexBonePosition.w, 1.0;
# calculate vertex final position
DP4 resultpos.x, mvp[0], vertexBonePosition;
DP4 resultpos.y, mvp[1], vertexBonePosition;
DP4 resultpos.z, mvp[2], vertexBonePosition;
DP4 resultpos.w, mvp[3], vertexBonePosition;

MOV result.fogcoord.x, resultpos.z;
MOV result.position, resultpos;
END

Any ideas?

If the behavior is the same on both ATI and Nvidia it is likely that the problem is somewhere in your program.

Do you upload the matrices correctly? In what format do you specify the attribute with indices and weights?