MTVU/gif: prebuilt the fake packet

GS_Packet constructor calls memset which is quite slow and useless as data is overwritten

Vtune overhead of Gif_Unit::Execute goes from 5.8% to 3.0% (EE thread)
This commit is contained in:
Gregory Hainaut 2016-12-14 18:33:23 +01:00
parent 29d229264d
commit b3474b5a71
1 changed files with 7 additions and 5 deletions

View File

@ -146,10 +146,15 @@ static __fi void incTag(u32& offset, u32& size, u32 incAmount) {
struct Gif_Path_MTVU {
u32 fakePackets; // Fake packets pending to be sent to MTGS
GS_Packet fakePacket;
Mutex gsPackMutex; // Used for atomic access to gsPackQueue
std::deque<GS_Packet> gsPackQueue; // VU1 programs' XGkick(s)
Gif_Path_MTVU() { Reset(); }
void Reset() { fakePackets = 0; gsPackQueue.clear(); }
void Reset() { fakePackets = 0; gsPackQueue.clear();
fakePacket.Reset();
fakePacket.done = 1; // Fake packets don't get processed by pcsx2
fakePacket.size =~0u; // Used to indicate that its a fake packet
}
};
struct Gif_Path {
@ -256,10 +261,7 @@ struct Gif_Path {
GS_Packet ExecuteGSPacket() {
if (mtvu.fakePackets) { // For MTVU mode...
mtvu.fakePackets--;
GS_Packet fakePack;
fakePack.done = 1; // Fake packets don't get processed by pcsx2
fakePack.size =~0u; // Used to indicate that its a fake packet
return fakePack;
return mtvu.fakePacket;
}
pxAssert(!isMTVU());
for(;;) {