diff --git a/src/core/gpu.cpp b/src/core/gpu.cpp index 87d896d73..ba4d51ecd 100644 --- a/src/core/gpu.cpp +++ b/src/core/gpu.cpp @@ -33,10 +33,14 @@ void GPU::Reset() void GPU::SoftReset() { m_GPUSTAT.bits = 0x14802000; + m_drawing_area = {}; + m_drawing_offset = {}; m_crtc_state = {}; m_crtc_state.regs.display_address_start = 0; m_crtc_state.regs.horizontal_display_range = 0xC60260; m_crtc_state.regs.vertical_display_range = 0x3FC10; + m_GP0_command.clear(); + m_GPUREAD_buffer.clear(); m_render_state = {}; m_render_state.texture_page_changed = true; m_render_state.texture_color_mode_changed = true; @@ -48,7 +52,10 @@ void GPU::SoftReset() bool GPU::DoState(StateWrapper& sw) { if (sw.IsReading()) - FlushRender(); + { + // perform a reset to discard all pending draws/fb state + Reset(); + } sw.Do(&m_GPUSTAT.bits); diff --git a/src/core/gpu_hw.cpp b/src/core/gpu_hw.cpp index 0c724a2cf..1f8bcb287 100644 --- a/src/core/gpu_hw.cpp +++ b/src/core/gpu_hw.cpp @@ -8,6 +8,13 @@ GPU_HW::GPU_HW() = default; GPU_HW::~GPU_HW() = default; +void GPU_HW::Reset() +{ + GPU::Reset(); + + m_batch = {}; +} + void GPU_HW::LoadVertices(RenderCommand rc, u32 num_vertices) { const u32 texpage = diff --git a/src/core/gpu_hw.h b/src/core/gpu_hw.h index 63ec1c36c..b8b0215cf 100644 --- a/src/core/gpu_hw.h +++ b/src/core/gpu_hw.h @@ -11,6 +11,8 @@ public: GPU_HW(); virtual ~GPU_HW(); + virtual void Reset() override; + protected: struct HWVertex { diff --git a/src/core/gpu_hw_opengl.cpp b/src/core/gpu_hw_opengl.cpp index 897e40fb4..c15e0e21b 100644 --- a/src/core/gpu_hw_opengl.cpp +++ b/src/core/gpu_hw_opengl.cpp @@ -177,6 +177,7 @@ void GPU_HW_OpenGL::ClearFramebuffer() glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT); glBindFramebuffer(GL_FRAMEBUFFER, 0); + m_vram_read_texture_dirty = true; } void GPU_HW_OpenGL::DestroyFramebuffer()