GPU: Eliminate temporary buffer when reading back

This commit is contained in:
Connor McLaughlin
2019-11-14 17:16:59 +10:00
parent 3998b9684e
commit 9ea7a8418c
11 changed files with 39 additions and 50 deletions

View File

@ -10,6 +10,7 @@ Log_SetChannel(GPU_SW);
GPU_SW::GPU_SW()
{
m_vram.fill(0);
m_vram_ptr = m_vram.data();
}
GPU_SW::~GPU_SW()
@ -37,15 +38,9 @@ void GPU_SW::Reset()
m_vram.fill(0);
}
void GPU_SW::ReadVRAM(u32 x, u32 y, u32 width, u32 height, void* buffer)
void GPU_SW::ReadVRAM(u32 x, u32 y, u32 width, u32 height)
{
u16* buffer_ptr = static_cast<u16*>(buffer);
for (u32 yoffs = 0; yoffs < height; yoffs++)
{
u16* src_ptr = GetPixelPtr(x, y + yoffs);
std::copy_n(src_ptr, width, buffer_ptr);
buffer_ptr += width;
}
// No need to do anything - pointer is already up to date.
}
void GPU_SW::FillVRAM(u32 x, u32 y, u32 width, u32 height, u32 color)