hi guys,
I wrote a GLSL vertex shader for my skeleton animation, and it works well under Nvidia card(from 6100 to 7950).
But it run very slowly under ATI card X1650XT on WinXP with the lastest 7.4 driver, and I found the link log said:
“Link successful. The GLSL vertex shader will run in software - unsupported language element used”
After some debuging I found the unsupported language element is that dynamic array index used for bone matrix.
And I search the net and find someone say that current graphic card does not support non-compile-time-constant array index.
So I am confused, if dynamic array index is not supported, How can I or how do you guys do the GPU skeleton animation?
By the way, the glsl language spec is too vague to catch whether or not it support dynamic array index.
Any help or insight would be appreciated.
attribute vec4 bone;
attribute vec4 weight;
uniform mat4 boneMatrices[32];
void main()
{
vec4 blendVertex = vec4(0, 0, 0, 0);
vec4 blendWeight = weight;
ivec4 blendBone = ivec4(bone);
for(int i = 0; (i < 4) && (blendWeight.x > 0); i++)
{
blendVertex += boneMatrices[blendBone.x] * gl_Vertex * blendWeight.x;
blendBone = blendBone.yzwx;
blendWeight = blendWeight.yzwx;
}
gl_Position = gl_ModelViewProjectionMatrix * blendVertex;
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_FrontColor = gl_Color;
vec4 ecPos = gl_ModelViewMatrix * blendVertex;
gl_FogFragCoord = abs(ecPos.z);
}