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
This commit is contained in:
gabest11 2012-02-10 07:03:55 +00:00
parent bc38796323
commit da7324dbf2
3 changed files with 41 additions and 5 deletions

View File

@ -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();

View File

@ -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];

View File

@ -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)
{