GPU: Add some missing state reset

This commit is contained in:
Connor McLaughlin 2019-10-04 20:33:37 +10:00
parent 4422fb0545
commit 4d22bec8fd
4 changed files with 18 additions and 1 deletions

View file

@ -33,10 +33,14 @@ void GPU::Reset()
void GPU::SoftReset() void GPU::SoftReset()
{ {
m_GPUSTAT.bits = 0x14802000; m_GPUSTAT.bits = 0x14802000;
m_drawing_area = {};
m_drawing_offset = {};
m_crtc_state = {}; m_crtc_state = {};
m_crtc_state.regs.display_address_start = 0; m_crtc_state.regs.display_address_start = 0;
m_crtc_state.regs.horizontal_display_range = 0xC60260; m_crtc_state.regs.horizontal_display_range = 0xC60260;
m_crtc_state.regs.vertical_display_range = 0x3FC10; m_crtc_state.regs.vertical_display_range = 0x3FC10;
m_GP0_command.clear();
m_GPUREAD_buffer.clear();
m_render_state = {}; m_render_state = {};
m_render_state.texture_page_changed = true; m_render_state.texture_page_changed = true;
m_render_state.texture_color_mode_changed = true; m_render_state.texture_color_mode_changed = true;
@ -48,7 +52,10 @@ void GPU::SoftReset()
bool GPU::DoState(StateWrapper& sw) bool GPU::DoState(StateWrapper& sw)
{ {
if (sw.IsReading()) if (sw.IsReading())
FlushRender(); {
// perform a reset to discard all pending draws/fb state
Reset();
}
sw.Do(&m_GPUSTAT.bits); sw.Do(&m_GPUSTAT.bits);

View file

@ -8,6 +8,13 @@ GPU_HW::GPU_HW() = default;
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) void GPU_HW::LoadVertices(RenderCommand rc, u32 num_vertices)
{ {
const u32 texpage = const u32 texpage =

View file

@ -11,6 +11,8 @@ public:
GPU_HW(); GPU_HW();
virtual ~GPU_HW(); virtual ~GPU_HW();
virtual void Reset() override;
protected: protected:
struct HWVertex struct HWVertex
{ {

View file

@ -177,6 +177,7 @@ void GPU_HW_OpenGL::ClearFramebuffer()
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0);
m_vram_read_texture_dirty = true;
} }
void GPU_HW_OpenGL::DestroyFramebuffer() void GPU_HW_OpenGL::DestroyFramebuffer()