diff --git a/GPU/GLES/GLES_GPU.cpp b/GPU/GLES/GLES_GPU.cpp index 885e004bbb..0912b12206 100644 --- a/GPU/GLES/GLES_GPU.cpp +++ b/GPU/GLES/GLES_GPU.cpp @@ -503,6 +503,18 @@ void GLES_GPU::InitClear() { ScheduleEvent(GPU_EVENT_INIT_CLEAR); } +void GLES_GPU::Reinitialize() { + GPUCommon::Reinitialize(); + ScheduleEvent(GPU_EVENT_REINITIALIZE); +} + +void GLES_GPU::ReinitializeInternal() { + textureCache_.Clear(true); + depalShaderCache_.Clear(); + framebufferManager_.DestroyAllFBOs(); + framebufferManager_.Resized(); +} + void GLES_GPU::InitClearInternal() { bool useNonBufferedRendering = g_Config.iRenderingMode == FB_NON_BUFFERED_MODE; if (useNonBufferedRendering) { @@ -689,6 +701,10 @@ void GLES_GPU::ProcessEvent(GPUEvent ev) { PerformStencilUploadInternal(ev.fb_stencil_upload.dst, ev.fb_stencil_upload.size); break; + case GPU_EVENT_REINITIALIZE: + ReinitializeInternal(); + break; + default: GPUCommon::ProcessEvent(ev); } diff --git a/GPU/GLES/GLES_GPU.h b/GPU/GLES/GLES_GPU.h index c43ddf658a..26704164d9 100644 --- a/GPU/GLES/GLES_GPU.h +++ b/GPU/GLES/GLES_GPU.h @@ -36,6 +36,7 @@ public: GLES_GPU(); ~GLES_GPU(); virtual void InitClear(); + virtual void Reinitialize(); virtual void PreExecuteOp(u32 op, u32 diff); void ExecuteOpInternal(u32 op, u32 diff); virtual void ExecuteOp(u32 op, u32 diff); @@ -161,6 +162,7 @@ private: void PerformMemorySetInternal(u32 dest, u8 v, int size); void PerformStencilUploadInternal(u32 dest, int size); void InvalidateCacheInternal(u32 addr, int size, GPUInvalidationType type); + void ReinitializeInternal(); inline void UpdateVsyncInterval(bool force); static CommandInfo cmdInfo_[256]; diff --git a/GPU/GPUInterface.h b/GPU/GPUInterface.h index cd5969a147..a207d652b7 100644 --- a/GPU/GPUInterface.h +++ b/GPU/GPUInterface.h @@ -166,6 +166,7 @@ enum GPUEventType { GPU_EVENT_FB_MEMCPY, GPU_EVENT_FB_MEMSET, GPU_EVENT_FB_STENCIL_UPLOAD, + GPU_EVENT_REINITIALIZE, }; struct GPUEvent {