Skinning: temporary registers exceeded

I’ve been having some trouble with temporary registers - I’m getting errors on compile/link that the program will run in software mode, as too many temprorary registers are used.

The vertex shader in question is for skinning with 4 bone influences, and runs fine in CG on both NVidia and ATI cards:

attribute vec4 weights;
attribute vec4 matrixIndices;

uniform mat4 boneMatrices[24];
uniform vec3 globalCamPos;

void main()

int index = int(matrixIndices.x);
gl_Position = weights.x * boneMatrices[index] * gl_Vertex;

index = int(matrixIndices.y);
gl_Position = gl_Position + weights.y * boneMatrices[index] * gl_Vertex;

index = int(matrixIndices.z);
gl_Position = gl_Position + weights.z * boneMatrices[index] * gl_Vertex;

index = int(matrixIndices.w);
gl_Position = gl_Position + weights.w * boneMatrices[index] * gl_Vertex;

gl_Position = gl_ModelViewProjectionMatrix * gl_Position;


// float VdotN = abs(dot(oWorldEyeDir, oNormal));
// float oneMinusVdotN = 1.0-VdotN;
// oSkinSilouetteVec = vec2(oneMinusVdotN*oneMinusVdotN, oneMinusVdotN);

gl_Position = gl_ModelViewProjectionMatrix * gl_Position;
oColor = vec4(0.0, 0.0, 0.5, 1.0);

// gl_FrontColor = vec4(0.0, 0.0, 0.5, 1.0);

I’ve tried splitting up all of the matrix multiplies into temp mat4 variables, etc, etc, but can’t seem to fit the shader into the 12 vec4 temporary registers that are available to the ATI card. I haven’t even tried transforming my normal or tangent vectors; just the position vector seems to be too much.

Anyone else run into this problem on your ATI card, and find a solution?

glSlang is still a bit more limited, because the compilers and linkers are not completely ready yet. Therefore it´s possible to run into limits, which are not present with ARB_fp / ARB_vp.

Try updating your driver, Catalyst 4.5 has already increased the amount of usable registers. If that doesn´t help, you either have to wait for a driver, which supports more, or you have to use ARB_vp for now.


I got a similar problem when using ints on ATI R3xx hardware. When I commented out all lines where I use ints it worked for me.
I don’t know if this is a hardware limitation or just a GLSL compiler limitation.

Hmm, thanks for the replies – I’m using Catalyst 4.5 drivers.

I just emailed ATI’s developer relations, so I might have an answer sometime this week. I’ll post it when I get a reply.

I’m thinking you may be right - could have to do with the uniform matrix indirection… supposedly this feature was added recently.

Just heard back from ATI devrel. It’s a “current driver issue”:

“I’ve checked this out with our OpenGL team, and they say that this is a known issue with the current GLSL driver. Using an array of uniforms will cause over use of resources. This is something that will be fixed in an upcoming driver release.”

Hopefully this will be fixed in the next Catalyst package - it’s a pretty big limitation…

Sorry to bump old topics… Just thought I’d mention that the issue seems to still be there in full force.

I have a very similar skinning shader right now to the one posted above and with 3 weights it works but adding in the 4th weight exceeds temp registers.

Kind of sad that it has been 2 months and it is still there.

P.S. This is on an ATI mobility radeon 9700 running the omegas based off the cat 4.8 drivers.


Have ATI corrected this issue by now (31-10-2005)?

When running the Sknning Demo from 3DSLabs GLSL Demos, i get the same error message for the vertex shader (exceeds number of temporary registers).

Im currently using 5.10 catalyst drivers on my 9800 pro.
Is it my video card that is obsolete or is it still a driver related issue ?

// skinning.vert: uses two matrices to create a "blended" vertex
// author: Philip Rideout
// Copyright (c) 2005: 3Dlabs, Inc.

uniform vec3 LightPosition;
uniform vec3 SurfaceColor;
varying vec4 Color;
uniform int index0;
uniform int index1;
uniform mat4 transforms[13];
attribute float weight;

void main(void)
    mat4 transform = transforms[index0] * weight + transforms[index1] * (1.0 - weight);
    vec3 normal = normalize(gl_NormalMatrix * gl_Normal);;
    vec3 position = vec3(gl_ModelViewMatrix * gl_Vertex);
    vec3 lightVec   = normalize(LightPosition - position);
    float diffuse   = max(dot(lightVec, normal), 0.0);

    if (diffuse < 0.125)
         diffuse = 0.125;

    Color = vec4(SurfaceColor * diffuse, 1.0);
    gl_Position = transform * gl_Vertex;

Yes, the problem is basicly fixed around 5.8 and skinning now works in quite complicated setups (like 3*2 bones skinned shadow volume extrusion).

However skinning still makes it pretty sensitive to other problems, especially even simple conditionals.
I’m pretty sure it’ll work if you replace the if with a diffuse= max(diffuse,0.125)

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.