-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(re: #1658) Some users are reporting issues with the renderer breaking, and sometimes the errors also indicate "CONTEXT_LOST_WEBGL: loseContext: context lost" This would always result in some kind of crash or graphics instability. Any WebGL application can lose its context at any time, but this seems much more likely on older or sketchy hardware. What that means for Rapid is that we need to be able to detect and handle a context loss if it does occur. It means that all graphics objects and textures need to be recreated. Here's what this commit includes: - All code that was written to create Pixi objects in the constructor has been rewritten to remove and replace those things later in a `reset` function - The GraphicsSystem can watch for `webglcontextlost` and `webglcontextrestored` events - Added a `testContextLoss()` function to test that we can actually lose and recover from this situation - When restoring the context, we throw away the Pixi environment and recreate it - This required some changes to `scene` and `textures` to survive this sort of situation. These things need to stay around because they are used elsewhere (it's common to listen for scene.layerchange everywhere) - Switched to only using the "shared" Pixi Ticker. We had an issue where replacing the Pixi application added an extra render() call in the ticker so this code takes extra steps to ensure that we don't end up doing that. - Some other code like the Minimap and the Spector UI uses Pixi for things and needed to be changed too - Added a `highQuality` boolean that gets set to `false` after a context loss. We think that many context losses are caused by users with poor specs, so lowering the quality makes it more likely to keep Rapid running.
- Loading branch information
Showing
32 changed files
with
792 additions
and
324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.