mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-16 12:58:33 +02:00
Merge pull request #957 from degasus/frame_skipping
VideoCommon: rewrite frame skipping code
This commit is contained in:
@ -50,7 +50,7 @@ static u32 InterpretDisplayList(u32 address, u32 size)
|
||||
Statistics::SwapDL();
|
||||
|
||||
u8 *end = g_pVideoData + size;
|
||||
cycles = OpcodeDecoder_Run(false, end);
|
||||
cycles = OpcodeDecoder_Run(end);
|
||||
INCSTAT(stats.thisFrame.numDListsCalled);
|
||||
|
||||
// un-swap
|
||||
@ -105,7 +105,7 @@ static void UnknownOpcode(u8 cmd_byte, void *buffer, bool preprocess)
|
||||
}
|
||||
}
|
||||
|
||||
static u32 Decode(u8* end, bool skipped_frame)
|
||||
static u32 Decode(u8* end)
|
||||
{
|
||||
u8 *opcodeStart = g_pVideoData;
|
||||
if (g_pVideoData == end)
|
||||
@ -178,10 +178,7 @@ static u32 Decode(u8* end, bool skipped_frame)
|
||||
return 0;
|
||||
u32 address = DataReadU32();
|
||||
u32 count = DataReadU32();
|
||||
if (skipped_frame)
|
||||
cycles = 45; // xxx
|
||||
else
|
||||
cycles = 6 + InterpretDisplayList(address, count);
|
||||
cycles = 6 + InterpretDisplayList(address, count);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -218,21 +215,14 @@ static u32 Decode(u8* end, bool skipped_frame)
|
||||
return 0;
|
||||
u16 numVertices = DataReadU16();
|
||||
|
||||
if (skipped_frame)
|
||||
if (!VertexLoaderManager::RunVertices(
|
||||
cmd_byte & GX_VAT_MASK, // Vertex loader index (0 - 7)
|
||||
(cmd_byte & GX_PRIMITIVE_MASK) >> GX_PRIMITIVE_SHIFT,
|
||||
numVertices,
|
||||
end - g_pVideoData,
|
||||
g_bSkipCurrentFrame))
|
||||
{
|
||||
size_t size = numVertices * VertexLoaderManager::GetVertexSize(cmd_byte & GX_VAT_MASK);
|
||||
if ((size_t) (end - g_pVideoData) < size)
|
||||
return 0;
|
||||
DataSkip((u32)size);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!VertexLoaderManager::RunVertices(
|
||||
cmd_byte & GX_VAT_MASK, // Vertex loader index (0 - 7)
|
||||
(cmd_byte & GX_PRIMITIVE_MASK) >> GX_PRIMITIVE_SHIFT,
|
||||
numVertices,
|
||||
end - g_pVideoData))
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -260,13 +250,13 @@ void OpcodeDecoder_Shutdown()
|
||||
{
|
||||
}
|
||||
|
||||
u32 OpcodeDecoder_Run(bool skipped_frame, u8* end)
|
||||
u32 OpcodeDecoder_Run(u8* end)
|
||||
{
|
||||
u32 totalCycles = 0;
|
||||
while (true)
|
||||
{
|
||||
u8* old = g_pVideoData;
|
||||
u32 cycles = Decode(end, skipped_frame);
|
||||
u32 cycles = Decode(end);
|
||||
if (cycles == 0)
|
||||
{
|
||||
g_pVideoData = old;
|
||||
|
Reference in New Issue
Block a user