Пример #1
0
 private void CheckGeoUniformsCmd(PICACommand Cmd)
 {
     if (Cmd.Register == PICARegister.GPUREG_GSH_FLOATUNIFORM_INDEX)
     {
         GeoShader.SetIndexCommand(Cmd.Parameters[0]);
     }
     else if (
         Cmd.Register >= PICARegister.GPUREG_GSH_FLOATUNIFORM_DATA0 &&
         Cmd.Register <= PICARegister.GPUREG_GSH_FLOATUNIFORM_DATA7)
     {
         GeoShader.SetValueParameters(Cmd.Parameters);
     }
 }
Пример #2
0
        public PICACommandReader(uint[] Cmds)
        {
            Commands = new List <PICACommand>();

            VtxShader = new UniformManager();
            GeoShader = new UniformManager();

            int Index = 0;

            while (Index < Cmds.Length)
            {
                uint Parameter = Cmds[Index++];
                uint Command   = Cmds[Index++];

                uint Id          = (Command >> 0) & 0xffff;
                uint Mask        = (Command >> 16) & 0xf;
                uint ExtraParams = (Command >> 20) & 0x7ff;
                bool Consecutive = (Command >> 31) != 0;

                if (Consecutive)
                {
                    for (int i = 0; i < ExtraParams + 1; i++)
                    {
                        PICACommand Cmd = new PICACommand()
                        {
                            Register   = (PICARegister)Id++,
                            Parameters = new uint[] { Parameter },
                            Mask       = Mask
                        };

                        CheckVtxUniformsCmd(Cmd);
                        CheckGeoUniformsCmd(Cmd);

                        Commands.Add(Cmd);

                        if (i < ExtraParams)
                        {
                            Parameter = Cmds[Index++];
                        }
                    }
                }
                else
                {
                    List <uint> Parameters = new List <uint> {
                        Parameter
                    };

                    for (int i = 0; i < ExtraParams; i++)
                    {
                        Parameters.Add(Cmds[Index++]);
                    }

                    PICACommand Cmd = new PICACommand()
                    {
                        Register   = (PICARegister)Id,
                        Parameters = Parameters.ToArray(),
                        Mask       = Mask
                    };

                    CheckVtxUniformsCmd(Cmd);
                    CheckGeoUniformsCmd(Cmd);

                    Commands.Add(Cmd);
                }

                //Commands must be padded in 8 bytes blocks, so Index can't be even!
                if ((Index & 1) != 0)
                {
                    Index++;
                }
            }
        }