4 Replies Latest reply on Jan 19, 2012 4:15 PM by AIF Bob

    skinned problem

    uchemo Level 1

      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;           

          }

      }

        • 1. Re: skinned problem
          Pak762 Level 1

          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.

          • 2. Re: skinned problem
            uchemo Level 1

            thanks, I have look at AGALProgramPair.vertexProgram.temporaryRegister, it is 4.

            • 3. Re: skinned problem
              Pak762 Level 1

              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.

              • 4. Re: skinned problem
                AIF Bob Level 3

                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