mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-09 21:40:10 +00:00
optimize memory access. Memory::GetPointer is a complex function, call it in loop will impact performance.
Test with MP1, Zelda TWW and Zelda TP, speed at least increased 2fps (for example, TP intro 14fps to 16fps) git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2136 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
553656966b
commit
c4ff501808
@ -644,6 +644,9 @@ void CatchUpGPU()
|
|||||||
// check if we are able to run this buffer
|
// check if we are able to run this buffer
|
||||||
if ((fifo.bFF_GPReadEnable) && !(fifo.bFF_BPEnable && fifo.bFF_Breakpoint))
|
if ((fifo.bFF_GPReadEnable) && !(fifo.bFF_BPEnable && fifo.bFF_Breakpoint))
|
||||||
{
|
{
|
||||||
|
// HyperIris: Memory::GetPointer is an expensive call, call it less, run faster
|
||||||
|
u8 *ptr = Memory::GetPointer(fifo.CPReadPointer);
|
||||||
|
|
||||||
while (fifo.CPReadWriteDistance > 0)
|
while (fifo.CPReadWriteDistance > 0)
|
||||||
{
|
{
|
||||||
// check if we are on a breakpoint
|
// check if we are on a breakpoint
|
||||||
@ -662,14 +665,14 @@ void CatchUpGPU()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// read the data and send it to the VideoPlugin
|
// read the data and send it to the VideoPlugin
|
||||||
|
|
||||||
u8 *ptr = Memory::GetPointer(fifo.CPReadPointer);
|
|
||||||
fifo.CPReadPointer += 32;
|
fifo.CPReadPointer += 32;
|
||||||
// We are going to do FP math on the main thread so have to save the current state
|
// We are going to do FP math on the main thread so have to save the current state
|
||||||
SaveSSEState();
|
SaveSSEState();
|
||||||
LoadDefaultSSEState();
|
LoadDefaultSSEState();
|
||||||
CPluginManager::GetInstance().GetVideo()->Video_SendFifoData(ptr,32);
|
CPluginManager::GetInstance().GetVideo()->Video_SendFifoData(ptr,32);
|
||||||
LoadSSEState();
|
LoadSSEState();
|
||||||
|
// adjust
|
||||||
|
ptr += 32;
|
||||||
|
|
||||||
fifo.CPReadWriteDistance -= 32;
|
fifo.CPReadWriteDistance -= 32;
|
||||||
|
|
||||||
@ -677,6 +680,8 @@ void CatchUpGPU()
|
|||||||
if (fifo.CPReadPointer >= fifo.CPEnd)
|
if (fifo.CPReadPointer >= fifo.CPEnd)
|
||||||
{
|
{
|
||||||
fifo.CPReadPointer = fifo.CPBase;
|
fifo.CPReadPointer = fifo.CPBase;
|
||||||
|
// adjust, take care
|
||||||
|
ptr = Memory::GetPointer(fifo.CPReadPointer);
|
||||||
LOG(COMMANDPROCESSOR, "BUFFER LOOP");
|
LOG(COMMANDPROCESSOR, "BUFFER LOOP");
|
||||||
// PanicAlert("loop now");
|
// PanicAlert("loop now");
|
||||||
}
|
}
|
||||||
|
@ -66,28 +66,39 @@ void ResetGatherPipe()
|
|||||||
|
|
||||||
void STACKALIGN CheckGatherPipe()
|
void STACKALIGN CheckGatherPipe()
|
||||||
{
|
{
|
||||||
|
// HyperIris: Memory::GetPointer is an expensive call, call it less, run faster
|
||||||
|
u8* pGatherPipe = Memory::GetPointer(CPeripheralInterface::Fifo_CPUWritePointer);
|
||||||
|
|
||||||
while (m_gatherPipeCount >= GATHER_PIPE_SIZE)
|
while (m_gatherPipeCount >= GATHER_PIPE_SIZE)
|
||||||
{
|
{
|
||||||
// copy the GatherPipe
|
// copy the GatherPipe
|
||||||
memcpy(Memory::GetPointer(CPeripheralInterface::Fifo_CPUWritePointer), m_gatherPipe, GATHER_PIPE_SIZE);
|
memcpy(pGatherPipe, m_gatherPipe, GATHER_PIPE_SIZE);
|
||||||
|
|
||||||
// [F|RES]: i thought GP is forced to mem1 ... strange
|
// [F|RES]: i thought GP is forced to mem1 ... strange
|
||||||
|
|
||||||
// move back the spill bytes
|
// move back the spill bytes
|
||||||
m_gatherPipeCount -= GATHER_PIPE_SIZE;
|
m_gatherPipeCount -= GATHER_PIPE_SIZE;
|
||||||
for (u32 i=0; i < m_gatherPipeCount; i++)
|
|
||||||
m_gatherPipe[i] = m_gatherPipe[i + GATHER_PIPE_SIZE];
|
// HyperIris: dunno why, but I use memcpy
|
||||||
|
//for (u32 i=0; i < m_gatherPipeCount; i++)
|
||||||
|
// m_gatherPipe[i] = m_gatherPipe[i + GATHER_PIPE_SIZE];
|
||||||
|
memcpy(m_gatherPipe, m_gatherPipe + GATHER_PIPE_SIZE, m_gatherPipeCount);
|
||||||
|
|
||||||
// increase the CPUWritePointer
|
// increase the CPUWritePointer
|
||||||
CPeripheralInterface::Fifo_CPUWritePointer += GATHER_PIPE_SIZE;
|
CPeripheralInterface::Fifo_CPUWritePointer += GATHER_PIPE_SIZE;
|
||||||
|
// adjust
|
||||||
|
pGatherPipe += GATHER_PIPE_SIZE;
|
||||||
|
|
||||||
if (CPeripheralInterface::Fifo_CPUWritePointer > CPeripheralInterface::Fifo_CPUEnd)
|
if (CPeripheralInterface::Fifo_CPUWritePointer > CPeripheralInterface::Fifo_CPUEnd)
|
||||||
_assert_msg_(DYNA_REC, 0, "Fifo_CPUWritePointer out of bounds: %08x (end = %08x)",
|
_assert_msg_(DYNA_REC, 0, "Fifo_CPUWritePointer out of bounds: %08x (end = %08x)",
|
||||||
CPeripheralInterface::Fifo_CPUWritePointer, CPeripheralInterface::Fifo_CPUEnd);
|
CPeripheralInterface::Fifo_CPUWritePointer, CPeripheralInterface::Fifo_CPUEnd);
|
||||||
|
|
||||||
if (CPeripheralInterface::Fifo_CPUWritePointer >= CPeripheralInterface::Fifo_CPUEnd)
|
if (CPeripheralInterface::Fifo_CPUWritePointer >= CPeripheralInterface::Fifo_CPUEnd)
|
||||||
|
{
|
||||||
CPeripheralInterface::Fifo_CPUWritePointer = CPeripheralInterface::Fifo_CPUBase;
|
CPeripheralInterface::Fifo_CPUWritePointer = CPeripheralInterface::Fifo_CPUBase;
|
||||||
|
// adjust, take care
|
||||||
|
pGatherPipe = Memory::GetPointer(CPeripheralInterface::Fifo_CPUWritePointer);
|
||||||
|
}
|
||||||
CommandProcessor::GatherPipeBursted();
|
CommandProcessor::GatherPipeBursted();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user