mirror of https://github.com/PCSX2/pcsx2.git
GIF: remove 'done' of the GS_Packet struct
The struct is copied in various ring buffer (hot path) We only need the return status of the function so use a reference instead of a state variable Side note: if we align the struct to 16B maybe the compiler can use SSE to copy it. Warning: it breaks save state compatibility
This commit is contained in:
parent
7b3984059a
commit
d589be9415
|
@ -123,11 +123,13 @@ struct Gif_Tag {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GS_Packet {
|
struct GS_Packet {
|
||||||
|
// PERF note: this struct is copied various time in hot path. Don't add
|
||||||
|
// new field
|
||||||
|
|
||||||
u32 offset; // Path buffer offset for start of packet
|
u32 offset; // Path buffer offset for start of packet
|
||||||
u32 size; // Full size of GS-Packet
|
u32 size; // Full size of GS-Packet
|
||||||
s32 cycles; // EE Cycles taken to process this GS packet
|
s32 cycles; // EE Cycles taken to process this GS packet
|
||||||
s32 readAmount; // Dummy read-amount data needed for proper buffer calculations
|
s32 readAmount; // Dummy read-amount data needed for proper buffer calculations
|
||||||
bool done; // 0 = Incomplete, 1 = Complete
|
|
||||||
GS_Packet() { Reset(); }
|
GS_Packet() { Reset(); }
|
||||||
void Reset() { memzero(*this); }
|
void Reset() { memzero(*this); }
|
||||||
};
|
};
|
||||||
|
@ -160,7 +162,6 @@ struct Gif_Path_MTVU {
|
||||||
void Reset() { fakePackets = 0;
|
void Reset() { fakePackets = 0;
|
||||||
gsPackQueue.reset();
|
gsPackQueue.reset();
|
||||||
fakePacket.Reset();
|
fakePacket.Reset();
|
||||||
fakePacket.done = 1; // Fake packets don't get processed by pcsx2
|
|
||||||
fakePacket.size =~0u; // Used to indicate that its a fake packet
|
fakePacket.size =~0u; // Used to indicate that its a fake packet
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -264,11 +265,12 @@ struct Gif_Path {
|
||||||
curSize += size;
|
curSize += size;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If completed a GS packet (with EOP) then returned GS_Packet.done = 1
|
// If completed a GS packet (with EOP) then set done to true
|
||||||
// MTVU: This function only should be called called on EE thread
|
// MTVU: This function only should be called called on EE thread
|
||||||
GS_Packet ExecuteGSPacket() {
|
GS_Packet ExecuteGSPacket(bool &done) {
|
||||||
if (mtvu.fakePackets) { // For MTVU mode...
|
if (mtvu.fakePackets) { // For MTVU mode...
|
||||||
mtvu.fakePackets--;
|
mtvu.fakePackets--;
|
||||||
|
done = true;
|
||||||
return mtvu.fakePacket;
|
return mtvu.fakePacket;
|
||||||
}
|
}
|
||||||
pxAssert(!isMTVU());
|
pxAssert(!isMTVU());
|
||||||
|
@ -317,9 +319,8 @@ struct Gif_Path {
|
||||||
|
|
||||||
if (gifTag.tag.EOP) {
|
if (gifTag.tag.EOP) {
|
||||||
GS_Packet t = gsPack;
|
GS_Packet t = gsPack;
|
||||||
t.done = 1;
|
done = true;
|
||||||
|
|
||||||
|
|
||||||
dmaRewind = 0;
|
dmaRewind = 0;
|
||||||
|
|
||||||
gsPack.Reset();
|
gsPack.Reset();
|
||||||
|
@ -568,8 +569,9 @@ struct Gif_Unit {
|
||||||
for(;;) {
|
for(;;) {
|
||||||
if (stat.APATH) { // Some Transfer is happening
|
if (stat.APATH) { // Some Transfer is happening
|
||||||
Gif_Path& path = gifPath[stat.APATH-1];
|
Gif_Path& path = gifPath[stat.APATH-1];
|
||||||
GS_Packet gsPack = path.ExecuteGSPacket();
|
bool done = false;
|
||||||
if(!gsPack.done) {
|
GS_Packet gsPack = path.ExecuteGSPacket(done);
|
||||||
|
if(!done) {
|
||||||
if (stat.APATH == 3 && CanDoP3Slice() && !gsSIGNAL.queued) {
|
if (stat.APATH == 3 && CanDoP3Slice() && !gsSIGNAL.queued) {
|
||||||
if(!didPath3 && /*!Path3Masked() &&*/ checkPaths(1,1,0)) { // Path3 slicing
|
if(!didPath3 && /*!Path3Masked() &&*/ checkPaths(1,1,0)) { // Path3 slicing
|
||||||
didPath3 = true;
|
didPath3 = true;
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
// the lower 16 bit value. IF the change is breaking of all compatibility with old
|
// the lower 16 bit value. IF the change is breaking of all compatibility with old
|
||||||
// states, increment the upper 16 bit value, and clear the lower 16 bits to 0.
|
// states, increment the upper 16 bit value, and clear the lower 16 bits to 0.
|
||||||
|
|
||||||
static const u32 g_SaveVersion = (0x9A0C << 16) | 0x0000;
|
static const u32 g_SaveVersion = (0x9A0D << 16) | 0x0000;
|
||||||
|
|
||||||
// this function is meant to be used in the place of GSfreeze, and provides a safe layer
|
// this function is meant to be used in the place of GSfreeze, and provides a safe layer
|
||||||
// between the GS saving function and the MTGS's needs. :)
|
// between the GS saving function and the MTGS's needs. :)
|
||||||
|
|
Loading…
Reference in New Issue