diff --git a/gfx/webrender_bindings/RenderThread.cpp b/gfx/webrender_bindings/RenderThread.cpp index de04bde1eecd..1234a0a3ce03 100644 --- a/gfx/webrender_bindings/RenderThread.cpp +++ b/gfx/webrender_bindings/RenderThread.cpp @@ -867,7 +867,22 @@ static DeviceResetReason GLenumToResetReason(GLenum aReason) { void RenderThread::HandleDeviceReset(const char* aWhere, GLenum aReason) { MOZ_ASSERT(IsInRenderThread()); + // This happens only on simulate device reset. if (aReason == LOCAL_GL_NO_ERROR) { + MOZ_ASSERT(XRE_IsGPUProcess()); + + if (!mHandlingDeviceReset) { + mHandlingDeviceReset = true; + + MutexAutoLock lock(mRenderTextureMapLock); + mRenderTexturesDeferred.clear(); + for (const auto& entry : mRenderTextures) { + entry.second->ClearCachedResources(); + } + // Simulate DeviceReset does not need to notify the device reset to + // GPUProcessManager. It is already done by + // GPUProcessManager::SimulateDeviceReset(). + } return; }