Example #1
0
        public void PushCommands(GpuContext gpu, int[] cmdBuffer)
        {
            List <ChCommand> commands = new List <ChCommand>();

            ChClassId currentClass = 0;

            for (int index = 0; index < cmdBuffer.Length; index++)
            {
                int cmd = cmdBuffer[index];

                int value        = (cmd >> 0) & 0xffff;
                int methodOffset = (cmd >> 16) & 0xfff;

                ChSubmissionMode submissionMode = (ChSubmissionMode)((cmd >> 28) & 0xf);

                switch (submissionMode)
                {
                case ChSubmissionMode.SetClass: currentClass = (ChClassId)(value >> 6); break;

                case ChSubmissionMode.Incrementing:
                {
                    int count = value;

                    for (int argIdx = 0; argIdx < count; argIdx++)
                    {
                        int argument = cmdBuffer[++index];

                        commands.Add(new ChCommand(currentClass, methodOffset + argIdx, argument));
                    }

                    break;
                }

                case ChSubmissionMode.NonIncrementing:
                {
                    int count = value;

                    int[] arguments = new int[count];

                    for (int argIdx = 0; argIdx < count; argIdx++)
                    {
                        arguments[argIdx] = cmdBuffer[++index];
                    }

                    commands.Add(new ChCommand(currentClass, methodOffset, arguments));

                    break;
                }
                }
            }

            ProcessCommands(gpu, commands.ToArray());
        }
Example #2
0
        public void PushCommands(NvGpuVmm Vmm, int[] CmdBuffer)
        {
            List <ChCommand> Commands = new List <ChCommand>();

            ChClassId CurrentClass = 0;

            for (int Index = 0; Index < CmdBuffer.Length; Index++)
            {
                int Cmd = CmdBuffer[Index];

                int Value        = (Cmd >> 0) & 0xffff;
                int MethodOffset = (Cmd >> 16) & 0xfff;

                ChSubmissionMode SubmissionMode = (ChSubmissionMode)((Cmd >> 28) & 0xf);

                switch (SubmissionMode)
                {
                case ChSubmissionMode.SetClass: CurrentClass = (ChClassId)(Value >> 6); break;

                case ChSubmissionMode.Incrementing:
                {
                    int Count = Value;

                    for (int ArgIdx = 0; ArgIdx < Count; ArgIdx++)
                    {
                        int Argument = CmdBuffer[++Index];

                        Commands.Add(new ChCommand(CurrentClass, MethodOffset + ArgIdx, Argument));
                    }

                    break;
                }

                case ChSubmissionMode.NonIncrementing:
                {
                    int Count = Value;

                    int[] Arguments = new int[Count];

                    for (int ArgIdx = 0; ArgIdx < Count; ArgIdx++)
                    {
                        Arguments[ArgIdx] = CmdBuffer[++Index];
                    }

                    Commands.Add(new ChCommand(CurrentClass, MethodOffset, Arguments));

                    break;
                }
                }
            }

            ProcessCommands(Vmm, Commands.ToArray());
        }
Example #3
0
 public ChCommand(ChClassId ClassId, int MethodOffset, params int[] Arguments)
 {
     this.ClassId      = ClassId;
     this.MethodOffset = MethodOffset;
     this.Arguments    = Arguments;
 }
Example #4
0
 public ChCommand(ChClassId classId, int methodOffset, params int[] arguments)
 {
     ClassId      = classId;
     MethodOffset = methodOffset;
     Arguments    = arguments;
 }