diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index ddd793b43b..a217aaa258 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -109,7 +109,6 @@ void __DisplayInit() { vCount = 0; hCount = 0; hCountTotal = 0; - hasSetMode = false; lastFrameTime = 0; InitGfxState(); @@ -133,6 +132,20 @@ void __DisplayDoState(PointerWrap &p) { p.Do(leaveVblankEvent); CoreTiming::RestoreRegisterEvent(leaveVblankEvent, "LeaveVBlank", &hleLeaveVblank); + p.Do(gstate); + p.Do(gstate_c); + p.Do(gpuStats); + gpu->DoState(p); + + ReapplyGfxState(); + + if (p.mode == p.MODE_READ) { + if (hasSetMode) { + gpu->InitClear(); + } + gpu->SetDisplayFramebuffer(framebuf.topaddr, framebuf.pspFramebufLinesize, framebuf.pspFramebufFormat); + } + p.DoMarker("sceDisplay"); } diff --git a/Core/HLE/sceGe.cpp b/Core/HLE/sceGe.cpp index b12b695c62..08eda4ba9f 100644 --- a/Core/HLE/sceGe.cpp +++ b/Core/HLE/sceGe.cpp @@ -31,13 +31,7 @@ void __GeInit() void __GeDoState(PointerWrap &p) { - p.Do(gstate); - p.Do(gstate_c); - p.Do(gpuStats); - - ReapplyGfxState(); - gpu->InvalidateCache(0, -1); - gpu->DoState(p); + // Everything is done in sceDisplay. p.DoMarker("sceGe"); } diff --git a/GPU/GLES/DisplayListInterpreter.cpp b/GPU/GLES/DisplayListInterpreter.cpp index bc02147ca4..d5fd95edac 100644 --- a/GPU/GLES/DisplayListInterpreter.cpp +++ b/GPU/GLES/DisplayListInterpreter.cpp @@ -1120,3 +1120,16 @@ void GLES_GPU::InvalidateCache(u32 addr, int size) { void GLES_GPU::Flush() { transformDraw_.Flush(); } + +void GLES_GPU::DoState(PointerWrap &p) { + GPUCommon::DoState(p); + + TextureCache_Clear(true); + gstate_c.textureChanged = true; + for (auto iter = vfbs_.begin(); iter != vfbs_.end(); ++iter) { + fbo_destroy((*iter)->fbo); + delete (*iter); + } + vfbs_.clear(); + shaderManager_->ClearCache(true); +} diff --git a/GPU/GLES/DisplayListInterpreter.h b/GPU/GLES/DisplayListInterpreter.h index 70590c3c84..fbb7f46c21 100644 --- a/GPU/GLES/DisplayListInterpreter.h +++ b/GPU/GLES/DisplayListInterpreter.h @@ -53,6 +53,7 @@ public: virtual void DumpNextFrame(); virtual void Flush(); + virtual void DoState(PointerWrap &p); private: void DoBlockTransfer();