From b3474b5a71c93ef11beb7d482b155209664b7c42 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Wed, 14 Dec 2016 18:33:23 +0100 Subject: [PATCH] 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) --- pcsx2/Gif_Unit.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pcsx2/Gif_Unit.h b/pcsx2/Gif_Unit.h index 43955af02a..718ac263d4 100644 --- a/pcsx2/Gif_Unit.h +++ b/pcsx2/Gif_Unit.h @@ -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 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(;;) {