mirror of
https://github.com/servo/servo
synced 2026-05-09 16:42:16 +02:00
This change ensures that all Surfman surfaces used for WebRendering rendering are released in the WebGL thread properly by: - Moving `WebGLThread` shutdown to the renderer. The renderer starts it, so it makes sense that the renderer also shuts it down when it can guarantee that no WebRender painting is currently happening and no images will be in use again. - Delaying WebGL context release until all WebRender operations have finished. This ensures that the `SwapChain` is still available for use in the external image handler. The second point is accomplished by sharing a usage map between the renderer and the `WebGLThread` which tracks whether WebRender is currently rendering a particular context. In addition, once the WebGL external image handler is notified that WebRender has finished rendering, it informs the WebGLThread so that it can released any contexts already marked for deletion. Testing: This fixes very common intermittent crashes when running `/_webgl/conformance` locally. It should reduce the incidence of these flaky crashes on the CI. Fixes: #40399. Fixes: #40417. Signed-off-by: Martin Robinson <mrobinson@igalia.com>