mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-15 22:07:52 -07:00
drain GX pipelines when there's nothing else running. fixes some weird bugs, apparently.
This commit is contained in:
parent
7b48ce5b75
commit
391c8d43b0
@ -1663,9 +1663,6 @@ void ExecuteCommand()
|
|||||||
|
|
||||||
ExecParamCount = 0;
|
ExecParamCount = 0;
|
||||||
|
|
||||||
if (CycleCount > 0)
|
|
||||||
GXStat |= (1<<27);
|
|
||||||
|
|
||||||
switch (entry.Command)
|
switch (entry.Command)
|
||||||
{
|
{
|
||||||
case 0x10: // matrix mode
|
case 0x10: // matrix mode
|
||||||
@ -2180,6 +2177,9 @@ void ExecuteCommand()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (CycleCount > 0)
|
||||||
|
GXStat |= (1<<27);
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 CyclesToRunFor()
|
s32 CyclesToRunFor()
|
||||||
@ -2188,11 +2188,28 @@ s32 CyclesToRunFor()
|
|||||||
return CycleCount;
|
return CycleCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FinishWork(s32 cycles)
|
||||||
|
{
|
||||||
|
AddCycles(cycles);
|
||||||
|
if (NormalPipeline)
|
||||||
|
NormalPipeline -= std::min(NormalPipeline, cycles);
|
||||||
|
|
||||||
|
CycleCount = 0;
|
||||||
|
|
||||||
|
if (VertexPipeline || NormalPipeline || PolygonPipeline)
|
||||||
|
return;
|
||||||
|
|
||||||
|
GXStat &= ~(1<<27);
|
||||||
|
|
||||||
|
if (NumPushPopCommands == 0) GXStat &= ~(1<<14);
|
||||||
|
if (NumTestCommands == 0) GXStat &= ~(1<<0);
|
||||||
|
}
|
||||||
|
|
||||||
void Run(s32 cycles)
|
void Run(s32 cycles)
|
||||||
{
|
{
|
||||||
if (FlushRequest)
|
if (FlushRequest)
|
||||||
return;
|
return;
|
||||||
if (CycleCount <= 0 && CmdPIPE->IsEmpty())
|
if (CmdPIPE->IsEmpty() && !(GXStat & (1<<27)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CycleCount -= cycles;
|
CycleCount -= cycles;
|
||||||
@ -2210,13 +2227,7 @@ void Run(s32 cycles)
|
|||||||
|
|
||||||
if (CycleCount <= 0 && CmdPIPE->IsEmpty())
|
if (CycleCount <= 0 && CmdPIPE->IsEmpty())
|
||||||
{
|
{
|
||||||
// todo: advance remaining pipeline shit here
|
if (GXStat & (1<<27)) FinishWork(-CycleCount);
|
||||||
|
|
||||||
CycleCount = 0;
|
|
||||||
GXStat &= ~(1<<27);
|
|
||||||
|
|
||||||
if (NumPushPopCommands == 0) GXStat &= ~(1<<14);
|
|
||||||
if (NumTestCommands == 0) GXStat &= ~(1<<0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user