예제 #1
0
 public void CallMethod(AMemory Memory, NsGpuPBEntry PBEntry)
 {
     if (Methods.TryGetValue(PBEntry.Method, out NvGpuMethod Method))
     {
         Method(Memory, PBEntry);
     }
     else
     {
         WriteRegister(PBEntry);
     }
 }
예제 #2
0
        private void VertexEndGl(AMemory Memory, NsGpuPBEntry PBEntry)
        {
            SetFrameBuffer(0);

            long[] Tags = UploadShaders(Memory);

            Gpu.Renderer.BindProgram();

            SetAlphaBlending();

            UploadTextures(Memory, Tags);
            UploadUniforms(Memory);
            UploadVertexArrays(Memory);
        }
예제 #3
0
        private void ClearBuffers(AMemory Memory, NsGpuPBEntry PBEntry)
        {
            int Arg0 = PBEntry.Arguments[0];

            int FbIndex = (Arg0 >> 6) & 0xf;

            int Layer = (Arg0 >> 10) & 0x3ff;

            GalClearBufferFlags Flags = (GalClearBufferFlags)(Arg0 & 0x3f);

            SetFrameBuffer(0);

            //TODO: Enable this once the frame buffer problems are fixed.
            //Gpu.Renderer.ClearBuffers(Layer, Flags);
        }
예제 #4
0
        private void CbBind(AMemory Memory, NsGpuPBEntry PBEntry)
        {
            int Index = PBEntry.Arguments[0];

            bool Enabled = (Index & 1) != 0;

            Index = (Index >> 4) & 0x1f;

            if (TryGetCpuAddr(NvGpuEngine3dReg.ConstBufferNAddress, out long Position))
            {
                ConstBuffers[Index].Position = Position;
                ConstBuffers[Index].Enabled  = Enabled;

                ConstBuffers[Index].Size = ReadRegister(NvGpuEngine3dReg.ConstBufferNSize);
            }
        }
예제 #5
0
        private void CbData(AMemory Memory, NsGpuPBEntry PBEntry)
        {
            if (TryGetCpuAddr(NvGpuEngine3dReg.ConstBufferNAddress, out long Position))
            {
                int Offset = ReadRegister(NvGpuEngine3dReg.ConstBufferNOffset);

                foreach (int Arg in PBEntry.Arguments)
                {
                    Memory.WriteInt32(Position + Offset, Arg);

                    Offset += 4;
                }

                WriteRegister(NvGpuEngine3dReg.ConstBufferNOffset, Offset);
            }
        }
예제 #6
0
        private void QueryControl(AMemory Memory, NsGpuPBEntry PBEntry)
        {
            if (TryGetCpuAddr(NvGpuEngine3dReg.QueryAddress, out long Position))
            {
                int Seq  = Registers[(int)NvGpuEngine3dReg.QuerySequence];
                int Ctrl = Registers[(int)NvGpuEngine3dReg.QueryControl];

                int Mode = Ctrl & 3;

                if (Mode == 0)
                {
                    //Write mode.
                    Memory.WriteInt32(Position, Seq);
                }
            }

            WriteRegister(PBEntry);
        }
예제 #7
0
        private void ClearBuffers(AMemory Memory, NsGpuPBEntry PBEntry)
        {
            if (HasDataToRender)
            {
                HasDataToRender = false;

                Gpu.Renderer.DrawFrameBuffer(0);
            }

            int Arg0 = PBEntry.Arguments[0];

            int FbIndex = (Arg0 >> 6) & 0xf;

            int Layer = (Arg0 >> 10) & 0x3ff;

            GalClearBufferFlags Flags = (GalClearBufferFlags)(Arg0 & 0x3f);

            SetFrameBuffer(0);

            Gpu.Renderer.ClearBuffers(Layer, Flags);
        }