GPU/HW: Only copy the dirty area to the VRAM read texture

This commit is contained in:
Connor McLaughlin
2019-11-05 22:34:27 +10:00
parent da51d49d18
commit cc7483ad58
8 changed files with 85 additions and 35 deletions

View File

@ -1,6 +1,7 @@
#include "gpu_hw.h"
#include "YBaseLib/Assert.h"
#include "YBaseLib/Log.h"
#include "common/state_wrapper.h"
#include "settings.h"
#include "system.h"
#include <imgui.h>
@ -11,15 +12,6 @@ GPU_HW::GPU_HW() = default;
GPU_HW::~GPU_HW() = default;
void GPU_HW::Reset()
{
GPU::Reset();
m_batch = {};
m_batch_ubo_data = {};
m_batch_ubo_dirty = true;
}
bool GPU_HW::Initialize(HostDisplay* host_display, System* system, DMA* dma, InterruptController* interrupt_controller,
Timers* timers)
{
@ -33,6 +25,29 @@ bool GPU_HW::Initialize(HostDisplay* host_display, System* system, DMA* dma, Int
return true;
}
void GPU_HW::Reset()
{
GPU::Reset();
m_batch = {};
m_batch_ubo_data = {};
m_batch_ubo_dirty = true;
SetFullVRAMDirtyRectangle();
}
bool GPU_HW::DoState(StateWrapper& sw)
{
if (!GPU::DoState(sw))
return false;
// invalidate the whole VRAM read texture when loading state
if (sw.IsReading())
SetFullVRAMDirtyRectangle();
return true;
}
void GPU_HW::UpdateSettings()
{
GPU::UpdateSettings();
@ -228,11 +243,11 @@ void GPU_HW::DispatchRenderCommand(RenderCommand rc, u32 num_vertices, const u32
if (m_vram_dirty_rect.Valid() && (m_render_state.GetTexturePageRectangle().Intersects(m_vram_dirty_rect) ||
m_render_state.GetTexturePaletteRectangle().Intersects(m_vram_dirty_rect)))
{
Log_WarningPrintf("Invalidating VRAM read cache due to drawing area overlap");
if (!IsFlushed())
FlushRender();
Log_WarningPrintf("Invalidating VRAM read cache due to drawing area overlap");
m_vram_read_texture_dirty = true;
UpdateVRAMReadTexture();
}
}