TextureCache: Simplify XFB reconstruction

This also better handles in-memory interlaced XFB data placed by the CPU
by considering the stride from the VI.
This commit is contained in:
Stenzek
2019-03-31 14:11:53 +10:00
parent dbaba0062a
commit 708bd3d9f7
8 changed files with 228 additions and 427 deletions

View File

@ -686,6 +686,9 @@ static void BeginField(FieldType field, u64 ticks)
xfbAddr = GetXFBAddressTop();
}
// Multiply the stride by 2 to get the byte offset for each subsequent line.
fbStride *= 2;
if (potentially_interlaced_xfb && interlaced_video_mode && g_ActiveConfig.bForceProgressive)
{
// Strictly speaking, in interlaced mode, we're only supposed to read
@ -704,10 +707,10 @@ static void BeginField(FieldType field, u64 ticks)
// offset the xfb by (-stride_of_one_line) to get the start
// address of the full xfb.
if (field == FieldType::Odd && m_VBlankTimingOdd.PRB == m_VBlankTimingEven.PRB + 1 && xfbAddr)
xfbAddr -= fbStride * 2;
xfbAddr -= fbStride;
if (field == FieldType::Even && m_VBlankTimingOdd.PRB == m_VBlankTimingEven.PRB - 1 && xfbAddr)
xfbAddr -= fbStride * 2;
xfbAddr -= fbStride;
}
LogField(field, xfbAddr);
@ -787,10 +790,8 @@ void Update(u64 ticks)
}
// Create a fake VI mode for a fifolog
void FakeVIUpdate(u32 xfb_address, u32 fb_width, u32 fb_height)
void FakeVIUpdate(u32 xfb_address, u32 fb_width, u32 fb_stride, u32 fb_height)
{
u32 fb_stride = fb_width;
bool interlaced = fb_height > 480 / 2;
if (interlaced)
{
@ -807,7 +808,7 @@ void FakeVIUpdate(u32 xfb_address, u32 fb_width, u32 fb_height)
m_VBlankTimingEven.PRB = 503 - fb_height * 2;
m_VBlankTimingEven.PSB = 4;
m_PictureConfiguration.WPL = fb_width / 16;
m_PictureConfiguration.STD = fb_stride / 16;
m_PictureConfiguration.STD = (fb_stride / 2) / 16;
UpdateParameters();