Skip navigation
Currently Being Moderated

Registers limit in Pixel Bender 3D?

Mar 24, 2011 5:42 PM

I'm trying to do a shader that does skeletal animation (vertex skinning) using a PixelBender3D, my code looks like this:


parameter float4x4 WorldViewProjection;
parameter float4x4 Bones[32];


input vertex float4 Position       < id : "PB3D_POSITION";           >;
input vertex float4 Normals        < id : "PB3D_NORMAL";             >;
input vertex float4 UV               < id : "PB3D_TEXTURE_COORDS";     >;
input vertex float4 BlendWeight     < id : "PB3D_WEIGHT";              >;
input vertex float4 BlendID         < id : "PB3D_BONE_INDEX";         >;

output float4 vertexClipPosition;


void evaluateVertex()
// Blend between the weighted bone matrices.
float4x4 skinTransform;

int4 iBlendID = int4(BlendID);
skinTransform += BlendWeight[0]*Bones[iBlendID[0]];
skinTransform += BlendWeight[1]*Bones[iBlendID[1]];
skinTransform += BlendWeight[2]*Bones[iBlendID[2]];
skinTransform += BlendWeight[3]*Bones[iBlendID[3]];


vertexClipPosition = Position * skinTransform;
vertexClipPosition *= WorldViewProjection;

Compiles fine but running it I receive an exception that says: Register allocator has run out of registers.
This is not a very complex shader, it's very usual stuff in HLSL\CG\GLSL, and basically every graphics card around can handle something like that.
What kind of limitations in register number has this current version of PixelBender3D? Will newer versions improve on it? Is it a problem of PB3D or if I try to do it in Agal (I still need to learn that) I'll hit the same problem? Am I doing something wrong?

  • Currently Being Moderated
    Mar 24, 2011 9:44 PM   in reply to EcIipse

    There's a limit of 128 constant registers, however I think the limit you're running into is the limit on temporary registers in the code. Unfortunately some of the hardware we support only allows for 8 temporary registers so that's the limit we have for AGAL and Pixel Bender 3D.


    As things currently stand, you might be able to do better by programming directly in AGAL, however that's because you might be able to do better hand optimizations than we're currently doing in the compiler, rather than because the limits are any different. We are very aware that we need to improve the optimization in the compiler and we're working on that.



    Mark as:
  • Currently Being Moderated
    Mar 25, 2011 9:12 AM   in reply to EcIipse

    Mapping variables in the high level PB code to the low level registers is an arcane art. I'll take a look at this though and see what we can do.



    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points