3 Replies Latest reply: Dec 12, 2011 3:57 PM by Pak762 RSS

    Parameter register problem?

    Pak762 Community Member



      iam trying to set some parameters of my fragmentshader. First I used the ProgramConstantHelper but it simply is to slow to use in the final program.

      After some errors I couldnt figure out how setting the parameters with setProgramConstantsFromVector works, better said, I did not know which registers I have to set. To find that out I first inspected some values in the debugger and than wrote a little code giving me this output.


      [object BombExplosionShader]

      FragmentParameter: color startRegister: 1 offset: 0

      FragmentParameter: size startRegister: 1 offset: 3

      FragmentParameter: fposition startRegister: 2 offset: 0

      FragmentParameter: resolution startRegister: 2 offset: 2

      FragmentParameter: strength startRegister: 3 offset: 0

      FragmentParameter: thickness startRegister: 3 offset: 1


      first I thought every parameter has its own register, but I was wrong. If the compiler is able to put some parameters into one register, it does.


      this is the code to set the parameters of the vector:


      this.m_parameters[0]= colorR;

      this.m_parameters[1]= colorG;

      this.m_parameters[2]= colorB;

      this.m_parameters[3]= size;

      this.m_parameters[4]= posX;

      this.m_parameters[5]= posY;

      this.m_parameters[6]= resX;

      this.m_parameters[7]= resY;

      this.m_parameters[8]= strength;

      this.m_parameters[9]= thickness;


      The vector is generated with: new Vector.<Number>(12, true);



      and this is the call of setProgramConstantsFromVector:


      this.m_context3D.setProgramConstantsFromVector(Context3DProgramType.FRAGMENT, 1, this.m_parameters);


      can someone tell me what is wrong with the code?