Skip navigation
uchemo
Currently Being Moderated

skinned problem

Dec 29, 2011 1:54 AM

I write a vertex shader for skinned animation. But I got an error when I call Program3D::upload( kShader.m_kAGALShaderPair.vertexProgram.byteCode, kShader.m_kAGALShaderPair.fragmentProgram.byteCode ) :

Error: Error #3648: AGAL 验证失败: 对于 vertex 程序的 14 令牌中的 source operand 1,可读取临时寄存器组件,但无法写入。

    at flash.display3D::Program3D/upload()

 

in english:

 

Error: Error #3648:AGAL Verify failed: vertex program's 14 token source operand 1, read temporary register component, can not write.

 

The shader is:

 

<languageVersion: 1.0;>

vertex kernel TestSkinned3D <namespace: "Pixel Bender 3D examples";

                        vendor: "Adobe";

                        version: 1;>

{

        parameter float4x4 inp_matSkinWorldViewProject;

        parameter float4 inp_matSkinBone[90];

       

    input vertex float3 in_vtxPos

    <

            id : "PB3D_POSITION";

    >;

   

    input vertex float4 in_vtxWeight

    <

            id : "PB3D_WEIGHT";

    >;

   

    input vertex float4 in_vtxBoneIndex

    <

            id : "PB3D_BONE_INDEX";

    >;

   

    output float4 out_vtxClipPos;

 

    void evaluateVertex()

    {             

            int4 iIndex = int4(in_vtxBoneIndex);          

            //float fWeight4 = 1.0 - in_vtxWeight.x - in_vtxWeight.y - in_vtxWeight.z;

            float4 inPos4 = float4( in_vtxPos.x, in_vtxPos.y, in_vtxPos.z, 1.0 );

           

            float4 f4BonePos;                            

                       

        f4BonePos.x = dot( inPos4, inp_matSkinBone[iIndex.x] ) * in_vtxWeight.x ;       

        f4BonePos.y = dot( inPos4, inp_matSkinBone[iIndex.x + 1] ) * in_vtxWeight.x;        

        f4BonePos.z = dot( inPos4, inp_matSkinBone[iIndex.x + 2] ) * in_vtxWeight.x;

       

        f4BonePos.x += dot( inPos4, inp_matSkinBone[iIndex.y] ) * in_vtxWeight.y;

        f4BonePos.y += dot( inPos4, inp_matSkinBone[iIndex.y + 1] ) * in_vtxWeight.y;

        f4BonePos.z += dot( inPos4, inp_matSkinBone[iIndex.y + 2] ) * in_vtxWeight.y;  

 

        f4BonePos.x += dot( inPos4, inp_matSkinBone[iIndex.z] ) * in_vtxWeight.z;

        f4BonePos.y += dot( inPos4, inp_matSkinBone[iIndex.z + 1] ) * in_vtxWeight.z;

        f4BonePos.z += dot( inPos4, inp_matSkinBone[iIndex.z + 2] ) * in_vtxWeight.z;        

 

        f4BonePos.x += dot( inPos4, inp_matSkinBone[iIndex.w] ) * in_vtxWeight.w;

        f4BonePos.y += dot( inPos4, inp_matSkinBone[iIndex.w + 1] ) * in_vtxWeight.w;

        f4BonePos.z += dot( inPos4, inp_matSkinBone[iIndex.w + 2] ) * in_vtxWeight.w;

       

        f4BonePos.w = 1.0;

                out_vtxClipPos = f4BonePos * inp_matSkinWorldViewProject;           

    }

}

 
Replies
  • Currently Being Moderated
    Dec 29, 2011 4:19 AM   in reply to uchemo

    I have the same problem right now, my program is much much simpler.

     

    I think it relates to the count of temporary registers Agal has to use to compute your program. You can get it by looking at  AGALProgramPair.vertexProgram.temporaryRegisterCount.

    In the doc you can read, that if its over 8, the program.upload() will fail. But that not exactly true. Even some shaders with more than 9 registers are working while my program I have the problem with just uses 4 if I get it right. I just havent found out what exactly makes the change.

     

    Anyway...

     

    As soon as Iam using one float4x4 that is not a parameter and maybe one additional float4, its over. Even if I have under 8 temporary registers. Iam stucking for hours on this.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 30, 2011 2:20 AM   in reply to uchemo

    Ok, thats bad. To be honest, I have no idea how to fix this problem. Im stuck with this for 3 days now, cant getting my shader to work the way I want to.

     

    I hope someone else has an idea.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 19, 2012 4:15 PM   in reply to Pak762

    It's almost certainly runninng out of registers. The number of temporary registers available is very very limited and float4x4 fills them up very quickly.

     

    Bob

     
    |
    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