diff options
author | StapleButter <thetotalworm@gmail.com> | 2017-04-23 15:25:15 +0200 |
---|---|---|
committer | StapleButter <thetotalworm@gmail.com> | 2017-04-23 15:25:15 +0200 |
commit | 1759672d14424e57f497e8a33fc3ec349c3ca620 (patch) | |
tree | ad93541315adeb79337d15bf633b8cb17ca9fa04 /src/GPU3D.cpp | |
parent | 60cdc7d6f70343a99ed5b391aafd6188447f6c14 (diff) |
a few attempts at optimization
Diffstat (limited to 'src/GPU3D.cpp')
-rw-r--r-- | src/GPU3D.cpp | 75 |
1 files changed, 40 insertions, 35 deletions
diff --git a/src/GPU3D.cpp b/src/GPU3D.cpp index dc08841..b98c4fc 100644 --- a/src/GPU3D.cpp +++ b/src/GPU3D.cpp @@ -1807,6 +1807,45 @@ u32* GetLine(int line) } +void WriteToGXFIFO(u32 val) +{ + if (NumCommands == 0) + { + NumCommands = 4; + CurCommand = val; + ParamCount = 0; + TotalParams = CmdNumParams[CurCommand & 0xFF]; + + if (TotalParams > 0) return; + } + else + ParamCount++; + + for (;;) + { + if ((CurCommand & 0xFF) || (NumCommands == 4 && CurCommand == 0)) + { + CmdFIFOEntry entry; + entry.Command = CurCommand & 0xFF; + entry.Param = val; + CmdFIFOWrite(entry); + } + + if (ParamCount >= TotalParams) + { + CurCommand >>= 8; + NumCommands--; + if (NumCommands == 0) break; + + ParamCount = 0; + TotalParams = CmdNumParams[CurCommand & 0xFF]; + } + if (ParamCount < TotalParams) + break; + } +} + + u8 Read8(u32 addr) { printf("unknown GPU3D read8 %08X\n", addr); @@ -2012,41 +2051,7 @@ void Write32(u32 addr, u32 val) if (addr >= 0x04000400 && addr < 0x04000440) { - if (NumCommands == 0) - { - NumCommands = 4; - CurCommand = val; - ParamCount = 0; - TotalParams = CmdNumParams[CurCommand & 0xFF]; - - if (TotalParams > 0) return; - } - else - ParamCount++; - - for (;;) - { - if ((CurCommand & 0xFF) || (NumCommands == 4 && CurCommand == 0)) - { - CmdFIFOEntry entry; - entry.Command = CurCommand & 0xFF; - entry.Param = val; - CmdFIFOWrite(entry); - } - - if (ParamCount >= TotalParams) - { - CurCommand >>= 8; - NumCommands--; - if (NumCommands == 0) break; - - ParamCount = 0; - TotalParams = CmdNumParams[CurCommand & 0xFF]; - } - if (ParamCount < TotalParams) - break; - } - + WriteToGXFIFO(val); return; } |