From da7324dbf248c852fa9a18f1f4426e61d5690b1d Mon Sep 17 00:00:00 2001 From: gabest11 Date: Fri, 10 Feb 2012 07:03:55 +0000 Subject: [PATCH] Not transferring unused vif registers to the MTVU thread can save at least half of the ring buffer space. The whole set is about 400 bytes, including padding, but I could find references to only 6 regs. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5092 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/MTVU.h | 26 +++++++++++++++++++++++--- pcsx2/Vif.h | 9 +++++++++ plugins/GSdx/GSDrawScanline.cpp | 11 +++++++++-- 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/pcsx2/MTVU.h b/pcsx2/MTVU.h index 1e18065bf7..a2fe81ff43 100644 --- a/pcsx2/MTVU.h +++ b/pcsx2/MTVU.h @@ -134,6 +134,16 @@ protected: memcpy_fast(dest, &buffer[read_pos], size); incReadPos(size_u32(size)); } + __fi void ReadRegs(VIFregisters* dest) { + VIFregistersMTVU* src = (VIFregistersMTVU*)&buffer[read_pos]; + dest->cycle = src->cycle; + dest->mode = src->mode; + dest->num = src->num; + dest->mask = src->mask; + dest->itop = src->itop; + dest->top = src->top; + incReadPos(size_u32(sizeof(VIFregistersMTVU))); + } __fi void Write(u32 val) { GetWritePtr()[0] = val; @@ -143,6 +153,16 @@ protected: memcpy_fast(GetWritePtr(), src, size); write_offset += size_u32(size); } + __fi void WriteRegs(VIFregisters* src) { + VIFregistersMTVU* dest = (VIFregistersMTVU*)GetWritePtr(); + dest->cycle = src->cycle; + dest->mode = src->mode; + dest->num = src->num; + dest->mask = src->mask; + dest->top = src->top; + dest->itop = src->itop; + write_offset += size_u32(sizeof(VIFregistersMTVU)); + } void ExecuteTaskInThread() { PCSX2_PAGEFAULT_PROTECT { @@ -192,7 +212,7 @@ protected: case MTVU_VIF_UNPACK: { u32 vif_copy_size = (uptr)&vif.StructEnd - (uptr)&vif.tag; Read(&vif.tag, vif_copy_size); - Read(&vifRegs, sizeof(vifRegs)); + ReadRegs(&vifRegs); u32 size = Read(); MTVU_Unpack(&buffer[read_pos], vifRegs); incReadPos(size_u32(size)); @@ -252,10 +272,10 @@ public: void VifUnpack(vifStruct& _vif, VIFregisters& _vifRegs, u8* data, u32 size) { MTVU_LOG("MTVU - VifUnpack!"); u32 vif_copy_size = (uptr)&_vif.StructEnd - (uptr)&_vif.tag; - ReserveSpace(1 + size_u32(vif_copy_size) + size_u32(sizeof(_vifRegs)) + 1 + size_u32(size)); + ReserveSpace(1 + size_u32(vif_copy_size) + size_u32(sizeof(VIFregistersMTVU)) + 1 + size_u32(size)); Write(MTVU_VIF_UNPACK); Write(&_vif.tag, vif_copy_size); - Write(&_vifRegs, sizeof(_vifRegs)); + WriteRegs(&_vifRegs); Write(size); Write(data, size); incWritePos(); diff --git a/pcsx2/Vif.h b/pcsx2/Vif.h index e1df7ca466..4488efd8cd 100644 --- a/pcsx2/Vif.h +++ b/pcsx2/Vif.h @@ -215,6 +215,15 @@ struct VIFregisters { u32 addr; }; +struct VIFregistersMTVU { + vifCycle cycle; //data write cycle + u32 mode; + u32 num; + u32 mask; + u32 itop; + u32 top; // Not used in VIF0 +}; + static VIFregisters& vif0Regs = (VIFregisters&)eeHw[0x3800]; static VIFregisters& vif1Regs = (VIFregisters&)eeHw[0x3C00]; diff --git a/plugins/GSdx/GSDrawScanline.cpp b/plugins/GSdx/GSDrawScanline.cpp index af79af75f0..fcad7494df 100644 --- a/plugins/GSdx/GSDrawScanline.cpp +++ b/plugins/GSdx/GSDrawScanline.cpp @@ -103,8 +103,6 @@ void GSDrawScanline::EndDraw(uint64 frame, uint64 ticks, int pixels) #ifndef ENABLE_JIT_RASTERIZER -// FIXME: something's not right with the sky in burnout 3 - void GSDrawScanline::SetupPrim(const GSVertexSW* vertex, const uint32* index, const GSVertexSW& dscan) { GSScanlineSelector sel = m_global.sel; @@ -1179,6 +1177,15 @@ void GSDrawScanline::DrawScanline(int pixels, int left, int top, const GSVertexS case 2: break; } } + else + { + switch(sel.abd) + { + case 0: break; + case 1: ga = gad; break; + case 2: ga = GSVector4i::zero(); break; + } + } if(sel.pabe) {